Repository navigation
fix(names): Add missing gen_ai ops to span name rules - #579
Merged
Merged
Conversation
The name rules only covered chat, execute_tool, handoff and invoke_agent. Add the remaining gen_ai ops emitted by the JavaScript and Python SDKs so their spans get names inferred from the existing templates. Co-Authored-By: Claude <[email protected]>
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛Names
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Lms24
marked this pull request as ready for review
August 26, 2026 15:39
Lms24
requested review from
a team,
cleptric,
mjq and
nsdeschenes
as code owners
August 26, 2026 15:39
nsdeschenes
approved these changes
Aug 26, 2026
Lms24
enabled auto-merge (squash)
August 27, 2026 11:07
RulaKhaled
added a commit
to getsentry/sentry-javascript
that referenced
this pull request
Aug 27, 2026
…eaming (#23573) 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 fallback `Generative AI model operation` is 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_content` and `gen_ai.rerank` — the last three were only added to the conventions' inference rule in [sentry-conventions#579](getsentry/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 an `unknown` model sentinel, so its names were already conformant; a test now locks that in. The SDK emits no `gen_ai.responses` or `gen_ai.text_completion` spans. `gen_ai.execute_tool` spans 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
4 tasks
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.
The
gen_aispan name rules only listedchat,execute_tool,handoffandinvoke_agent. Add the remaining ops emitted by the JS and Python SDKs, all of which fit the existing templates:gen_ai.create_agentgen_ai.embeddingsgen_ai.generate_contentgen_ai.rerankgen_ai.responsesgen_ai.text_completion