Skip to content

feat(op)!: Add gen_ai prefix to existing ops and add embeddings, generate_content, and rerank ops - #543

Merged
msonnb merged 1 commit into
mainfrom
ms/op-gen-ai
Jul 31, 2026
Merged

feat(op)!: Add gen_ai prefix to existing ops and add embeddings, generate_content, and rerank ops#543
msonnb merged 1 commit into
mainfrom
ms/op-gen-ai

Conversation

@msonnb

@msonnb msonnb commented Jul 30, 2026

Copy link
Copy Markdown
Member

Description

Adds gen_ai.embeddings, gen_ai.generate_content and gen_ai.rerank to gen ai ops and adds the gen_ai. prefix to existing ops to align with the docs and SDKs.

PR Checklist

  • I have run yarn test and verified that the tests pass.
  • I have run yarn generate to generate and format code and docs.

If an attribute was added:

  • The attribute is in a namespace (e.g. nextjs.function_id, not function_id)
  • I have used the correct value for apply_scrubbing (i.e. manual or auto. Use never only for values that should never be scrubbed such as IDs)

If an attribute was deprecated:

@msonnb
msonnb requested review from a team, Lms24, cleptric, mjq and nsdeschenes as code owners July 30, 2026 08:12
@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

Semver Impact of This PR

🔴 Major (breaking changes)

📋 Changelog Preview

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


Breaking Changes 🛠

  • (op) Add gen_ai prefix to existing ops and add embeddings, generate_content, and rerank ops by msonnb in #543

New Features ✨

Attributes

  • Add query, deprecated in favor of db.query.text by alexander-alderman-webb in #530
  • Add aws.operation_name, deprecated in favor of rpc.method by alexander-alderman-webb in #536
  • Add db.params, deprecated in favor of db.query.parameter.<key> by alexander-alderman-webb in #529
  • Add code, deprecated in favor of rpc.response.status_code by alexander-alderman-webb in #533
  • Add django.function_name, deprecated in favor of code.function.name by alexander-alderman-webb in #538
  • Add port, deprecated in favor of server.port by alexander-alderman-webb in #532
  • Add redis.command, deprecated in favor of db.operation.name by alexander-alderman-webb in #531
  • Add address, deprecated in favor of server.address by alexander-alderman-webb in #534
  • Add aws_region, deprecated in favor of cloud.region by alexander-alderman-webb in #537
  • Add gcp_region, deprecated in favor of cloud.region by alexander-alderman-webb in #535
  • Add django.middleware_name (deprecated) in favor of middleware.name by alexander-alderman-webb in #520
  • Add starlite.middleware_name (deprecated) in favor of middleware.name by alexander-alderman-webb in #519
  • Add aws.request.url (deprecated) in favor of url.full by sentrivana in #488
  • Add subprocess.pid (deprecated) in favor of process.pid by sentrivana in #487
  • Add litestar.middleware_name (deprecated) in favor of middleware.name by sentrivana in #486
  • Add starlette.middleware_name (deprecated) in favor of middleware.name by sentrivana in #485
  • Add redis.key (deprecated) in favor of db.redis.key by sentrivana in #484
  • Add db.mongodb.collection (deprecated) in favor of db.collection.name by sentrivana in #483
  • Add Kafka messaging attributes by chargome in #474
  • Deprecate rpc.grpc.status_code in favor of rpc.response.status_code by lucas-zimerman in #494
  • Add deprecated messaging.destination_kind by andreiborza in #509
  • Add sentry.segment.name.source attribute by Lms24 in #466
  • Add attribute transformations by constantinius in #465
  • Add stable app vitals attributes by buenaflor in #493
  • Deprecate sentry.frames.* attributes by buenaflor in #500
  • Add missing AI legacy aliases from Relay SpanData by vgrozdanic in #498

Op

  • Add object storage span operations by msonnb in #545
  • Add http.client.stream op by msonnb in #544

Other

  • (conventions) Support multiple examples by Lms24 in #505
  • (descriptions) Add http.route description template for http.server span description inference by Lms24 in #518

Internal Changes 🔧

Attribute

  • Add more examples for valid sentry.kind values by Lms24 in #517
  • Improve db.statement example and add deprecation reason by Lms24 in #501

Attributes

  • Disambiguate http.route and url.template attributes by Lms24 in #521
  • Improve description of sentry.segment.name.source by Lms24 in #511
  • Deprecate sentry.span.source and change backfill status of sentry.source by Lms24 in #510

Deps

  • Bump dompurify from 3.4.11 to 3.4.12 by dependabot in #525
  • Bump fast-uri from 3.1.2 to 3.1.4 by dependabot in #526
  • Bump svgo from 4.0.1 to 4.0.2 by dependabot in #524
  • Bump js-yaml from 4.2.0 to 4.3.0 by dependabot in #516
  • Bump astro from 6.4.7 to 7.1.0 in /docs by dependabot in #514

Other

  • (attrs) Backport attributes and normalizations from Relay by Dav1dde in #497
  • (codeowners) Assign telemetry-experience to gen_ai/ai attributes by vgrozdanic in #506
  • (deps-dev) Bump tar from 7.5.16 to 7.5.19 by dependabot in #515
  • (release) Show version in workflow run title by constantinius in #504

🤖 This preview updates automatically when you update the PR.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 49b319b. Configure here.

Comment thread model/op/gen_ai.json
Comment thread model/op/gen_ai.json
Comment on lines +6 to 9
"name": "gen_ai.chat",
"description": "A chat interaction with a generative AI model"
},
{

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Prefixing field names in gen_ai.json causes breaking changes to both the exported constant names and their underlying string values, affecting downstream consumers and data processing.
Severity: HIGH

Suggested Fix

To avoid breaking downstream consumers, revert the field names in gen_ai.json to their original unprefixed form (e.g., chat, execute_tool). If the prefix is necessary, introduce new fields and deprecate the old ones, or modify the code generator in scripts/generate_op.ts to handle the prefixing logic correctly without creating double-prefixed constant names and provide backward-compatibility aliases for the old constants.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: model/op/gen_ai.json#L6-L9

Potential issue: Changing the field names in `gen_ai.json` from unprefixed (e.g.,
`chat`) to prefixed (e.g., `gen_ai.chat`) introduces two breaking changes. First, it
alters the generated constant names from `GEN_AI_CHAT_SPAN_OP` to
`GEN_AI_GEN_AI_CHAT_SPAN_OP`. Since this is a publicly published package, any downstream
consumer importing the old constant names will receive `undefined` at runtime, causing
silent failures. Second, it changes the underlying string values of these constants from
`'chat'` to `'gen_ai.chat'`. Any system, such as the Sentry backend or SDKs, that
matches or filters spans based on these string values will fail to recognize spans using
the old values, leading to incorrect categorization or missing telemetry data.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine to be honest, given we fix incorrect ops. Now, the other question is, whether the exported constant names make much sense given they now all start with GEN_AI_GEN_AI_* 😅 IMHO grouping span ops by "category" was unnecessary and more unnecessary that we added this category to the generated op constant names. Anyway, we can fix this in a follow-up. Your changes are necessary fixes because the previous ops were wrong.

Comment thread model/op/gen_ai.json
Comment on lines +6 to 9
"name": "gen_ai.chat",
"description": "A chat interaction with a generative AI model"
},
{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine to be honest, given we fix incorrect ops. Now, the other question is, whether the exported constant names make much sense given they now all start with GEN_AI_GEN_AI_* 😅 IMHO grouping span ops by "category" was unnecessary and more unnecessary that we added this category to the generated op constant names. Anyway, we can fix this in a follow-up. Your changes are necessary fixes because the previous ops were wrong.

@msonnb

msonnb commented Jul 30, 2026

Copy link
Copy Markdown
Member Author

Now, the other question is, whether the exported constant names make much sense given they now all start with GEN_AI_GEN_AI_*

yeah i agree, similar thing happening with a lot of the browser ops starting with BROWSER_BROWSER_

@Lms24 Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually sorry, let's hold off from merging until we clarified whether the Rust package has any consumers that could break

@Lms24 Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relay doesn't depend on ops, for python we don't even generate them and the Sentry frontend neither uses any exported ops from the JS package. So we're good to break here. I'll track renaming the ops constants in general in #546

Can you still add a ! to the commit message to indicate that this is a breaking change?

@msonnb msonnb changed the title feat(op): Add gen_ai embeddings, generate_content, and rerank operations feat(op)!: Add gen_ai embeddings, generate_content, and rerank operations Jul 31, 2026
@msonnb msonnb changed the title feat(op)!: Add gen_ai embeddings, generate_content, and rerank operations feat(op)!: Add gen_ai prefix to existing ops and add embeddings, generate_content, and rerank ops Jul 31, 2026
…`generate_content`, and `rerank` ops

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@msonnb
msonnb merged commit 4aa2e1c into main Jul 31, 2026
16 checks passed
@msonnb
msonnb deleted the ms/op-gen-ai branch July 31, 2026 10:28
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