fix(names): Add gen_ai.function_id and gen_ai.pipeline.name to agent span name templates - #593
Merged
Merged
Conversation
…ent span names
The agent category only offered `{{gen_ai.operation.name}} {{gen_ai.agent.name}}`
before falling through to the bare operation, so agent spans the SDKs already
emit had no template backing them: Vercel AI puts the value on
`gen_ai.function_id`, LangChain on `gen_ai.pipeline.name`, and sentry-python
already emits `invoke_agent {run_name}` with `run_name` on `gen_ai.function_id`.
Add both templates after the `agent.name` one so it stays the most specific
match, and before the bare operation fallback.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
RulaKhaled
requested review from
a team,
Lms24,
cleptric,
mjq and
nsdeschenes
as code owners
August 27, 2026 13:35
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Attributes
Other
Bug Fixes 🐛Names
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
RulaKhaled
added a commit
to getsentry/sentry-javascript
that referenced
this pull request
Aug 28, 2026
… streaming (#23582) With span streaming enabled (the default), `gen_ai.invoke_agent` names follow the [agent span name conventions](https://getsentry.github.io/sentry-conventions/names/#gen_ai-agent): `{operation} {name}` from `gen_ai.agent.name`, `gen_ai.pipeline.name` or `gen_ai.function_id`, otherwise `{operation}`. In practice this only changes LangChain chain spans, and only their prefix. They were named `chain format_prompt`, which does not lead with the operation like every other agent span; they are now `invoke_agent format_prompt`. The chain name itself is bounded, so it stays in the name. A chain the SDK cannot name falls back to `invoke_agent` rather than carrying the `unknown_chain` sentinel, the same way a missing model is dropped in #23573. LangGraph agent names and Vercel AI `functionId`s are unchanged in both lifecycles — both are bounded, low-cardinality values. The `pipeline.name` and `function_id` templates are added in getsentry/sentry-conventions#593. LangChain still emits its chain name on `langchain.chain.name`; moving it to `gen_ai.pipeline.name` is tracked in [JS-3452](https://linear.app/getsentry/issue/JS-3452/move-langchainchainname-to-gen-aipipelinename) and should land before v11 ships, so the emitted name matches a published template. Span names are unaffected by that move — they are built from the local chain name, not read back off the attribute. The other two ops in the agent rule need nothing: the SDK emits no `gen_ai.handoff` spans, and `gen_ai.create_agent` was dropped in v11. Neither is listed in the migration table. The migration entry lives in `MIGRATION.md` rather than `docs/migration/v11-end-state.md`, which was removed by #23623. Fixes #23524 --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Lms24
reviewed
Aug 28, 2026
Lms24
left a comment
Member
There was a problem hiding this comment.
Looks good from my end! Let's keep this open a bit longer for product/agent monitoring folks to weigh in
Lms24
approved these changes
Aug 28, 2026
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 agent category currently only offers
{{gen_ai.operation.name}} {{gen_ai.agent.name}}before falling through to the bare operation, so agent span names the SDKs already emit have no template backing them:invoke_agent weather_agent— Vercel AI, value ongen_ai.function_idinvoke_agent format_prompt— LangChain, value ongen_ai.pipeline.name(after thegetsentry/sentry-javascriptfollow-up; JS currently useslangchain.chain.name)invoke_agent {run_name}—sentry-pythonalready emits this for LangChain agent executors, withrun_nameongen_ai.function_idBoth attributes are already registered and both carry bounded, low-cardinality values.
🤖 Generated with Claude Code