Skip to content

fix(names): Add missing gen_ai ops to span name rules - #579

Merged
Lms24 merged 2 commits into
mainfrom
lms/fix-names-gen_ai-ops
Aug 27, 2026
Merged

Lms24 merged 2 commits into
mainfrom
lms/fix-names-gen_ai-ops

Conversation

@Lms24

@Lms24 Lms24 commented Aug 26, 2026

Copy link
Copy Markdown
Member

The gen_ai span name rules only listed chat, execute_tool, handoff and invoke_agent. Add the remaining ops emitted by the JS and Python SDKs, all of which fit the existing templates:

  • gen_ai.create_agent
  • gen_ai.embeddings
  • gen_ai.generate_content
  • gen_ai.rerank
  • gen_ai.responses
  • gen_ai.text_completion

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]>
@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (attributes) Add graphql.processing.type by andreiborza in #572
  • (span-names) Add url.domainrule for http.client spans by Lms24 in #575

Bug Fixes 🐛

Names

  • Add missing gen_ai ops to span name rules by Lms24 in #579
  • Include tool name in gen_ai.execute_tool span names by Lms24 in #580
  • Correct graphql span name examples by andreiborza in #573

Internal Changes 🔧

  • (attributes) Add search alias for segment name by nsdeschenes in #577

🤖 This preview updates automatically when you update the PR.

@Lms24
Lms24 marked this pull request as ready for review August 26, 2026 15:39
@Lms24
Lms24 requested review from a team, cleptric, mjq and nsdeschenes as code owners August 26, 2026 15:39
@Lms24
Lms24 enabled auto-merge (squash) August 27, 2026 11:07
@Lms24
Lms24 merged commit 8fa7671 into main Aug 27, 2026
16 checks passed
@Lms24
Lms24 deleted the lms/fix-names-gen_ai-ops branch August 27, 2026 11:10
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
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