Skip to content

Conversation

RulaKhaled
Copy link
Member

@RulaKhaled RulaKhaled commented Sep 29, 2025

This PR fixes a mismatch between ai.telemetry.functionId and gen_ai.function_id. Function ids were ignored unless the span name contained exactly one dot. This caused:

  • gen_ai.function_id to be missing or inconsistent for valid generation spans.
  • Mismatch between ai.telemetry.functionId and gen_ai.function_id, making trace exploration and metrics harder to interpret.

We now always respect experimental_telemetry.functionId when present, where function id could be set as part of request.


Note

Always update Vercel AI generate span names and set gen_ai.function_id when experimental_telemetry.functionId is present, removing the dot-count check.

  • Core (Vercel AI span processing):
    • In packages/core/src/utils/vercel-ai/index.ts processGenerateSpan:
      • Remove name.split('.') dot-count check; always apply experimental_telemetry.functionId.
      • When present, append function ID to the operation name and set gen_ai.function_id.
      • Clarify comments on telemetry function ID usage.

Written by Cursor Bugbot for commit 4b9fa48. This will update automatically on new commits. Configure here.

…al_telemetry.functionId for Vercel AI gen spans
Copy link

linear bot commented Sep 29, 2025

@RulaKhaled RulaKhaled requested a review from mydea September 29, 2025 11:57
Copy link
Contributor

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,350 - 8,980 +4%
GET With Sentry 1,322 14% 1,409 -6%
GET With Sentry (error only) 5,974 64% 5,974 -
POST Baseline 1,171 - 1,210 -3%
POST With Sentry 496 42% 519 -4%
POST With Sentry (error only) 1,031 88% 1,051 -2%
MYSQL Baseline 3,262 - 3,269 -0%
MYSQL With Sentry 402 12% 475 -15%
MYSQL With Sentry (error only) 2,636 81% 2,678 -2%

View base workflow run

@RulaKhaled RulaKhaled changed the title fix(core): Remove name.split('.') Check and Always Respect experimental_telemetry.functionId for Vercel AI gen spans fix(core): Remove name.split('.') check and always respect experimental_telemetry.functionId for Vercel AI gen spans Sep 29, 2025
@RulaKhaled RulaKhaled changed the title fix(core): Remove name.split('.') check and always respect experimental_telemetry.functionId for Vercel AI gen spans fix(core): Remove check and always respect experimental_telemetry.functionId for Vercel AI gen spans Sep 29, 2025
@RulaKhaled RulaKhaled changed the title fix(core): Remove check and always respect experimental_telemetry.functionId for Vercel AI gen spans fix(core): Remove check and always respect ai.telemetry.functionId for Vercel AI gen spans Sep 29, 2025
@RulaKhaled RulaKhaled merged commit c5bbdc6 into develop Sep 29, 2025
186 of 189 checks passed
@RulaKhaled RulaKhaled deleted the rolaabuhasna/js-992-investigate-inconsistent-function-id-in-span-attributes branch September 29, 2025 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants