feat(core): Emit low-cardinality gen_ai inference span names when streaming - #23573
Merged
RulaKhaled merged 1 commit intoAug 27, 2026
Conversation
Contributor
size-limit report 📦
|
RulaKhaled
force-pushed
the
rolaabuhasna/js-3410-emit-low-cardinality-gen-ai-inference-span-names
branch
from
August 25, 2026 13:50
dac5b71 to
314f52f
Compare
RulaKhaled
marked this pull request as ready for review
August 25, 2026 14:15
RulaKhaled
requested review from
JPeer264 and
isaacs
and removed request for
a team
August 25, 2026 14:15
isaacs
approved these changes
Aug 25, 2026
isaacs
left a comment
Member
There was a problem hiding this comment.
There are some opportunities for a bit of factoring to reduce the overhead here and prune some dead fallback branches, but that can also be done in a subsequent followup.
JPeer264
approved these changes
Aug 26, 2026
JPeer264
left a comment
Member
There was a problem hiding this comment.
Isaac already brought up great points. Other then his points - LGTM
RulaKhaled
force-pushed
the
rolaabuhasna/js-3410-emit-low-cardinality-gen-ai-inference-span-names
branch
from
August 26, 2026 09:30
d21d777 to
41dfc75
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 16742a1. Configure here.
…when streaming
When span streaming is on, inference spans use `{operation} {model}`, or
`{operation}` when the model is missing or empty. `gen_ai.execute_tool`
drops the tool name from the span name, which stays on `gen_ai.tool.name`.
Static lifecycle names are unchanged.
Every instrumented method supplies an operation, so the convention
fallback `Generative AI model operation` is unreachable and is not wired
up at any site.
RulaKhaled
force-pushed
the
rolaabuhasna/js-3410-emit-low-cardinality-gen-ai-inference-span-names
branch
from
August 27, 2026 10:44
3b5da13 to
b7aa981
Compare
Lms24
approved these changes
Aug 27, 2026
RulaKhaled
deleted the
rolaabuhasna/js-3410-emit-low-cardinality-gen-ai-inference-span-names
branch
August 27, 2026 11:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

When span streaming is enabled, gen_ai inference span names follow the inference templates:
{operation} {model}when a model is known,{operation}when it is not. Instrumented methods always have an operation, so the convention fallbackGenerative AI model operationis not emitted today.traceLifecycle: 'static'keeps the previous names (chat unknown). Known models stay in the name in both lifecycles (chat gpt-4).The inference ops the SDK emits are
gen_ai.chat,gen_ai.embeddings,gen_ai.generate_contentandgen_ai.rerank— the last three were only added to the conventions' inference rule in sentry-conventions#579, but the naming here is derived from the operation rather than hardcoded per op, so they were already covered. The Vercel AI channel path never emitted anunknownmodel sentinel, so its names were already conformant; a test now locks that in. The SDK emits nogen_ai.responsesorgen_ai.text_completionspans.gen_ai.execute_toolspans keep the tool name in their name (execute_tool getWeather) — the tool name is a bounded, resolved value, so it behaves like a known model rather than a high-cardinality identifier. Agent ops (gen_ai.invoke_agent,gen_ai.create_agent,gen_ai.handoff) are out of scope here and handled in #23582 (JS-3409).Fixes #23525