feat(explore): Add sentry conventions context to trace item attributes#117913
Merged
Conversation
The trace item attributes endpoint can now expand each attribute with the sentry conventions metadata (brief, details, examples, deprecation, and replacement attribute) sourced from sentry_conventions.attributes. The context is only attached when the caller passes expand=context and the organizations:data-browsing-attribute-context feature is enabled; otherwise the response is unchanged. Only fields actually present in ATTRIBUTE_METADATA are included (e.g. last_received is intentionally omitted). The metadata lookup falls back from the public alias to the internal name, mirroring _update_attribute_definitions_with_deprecations, since a convention may be keyed under either name. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0c23d14. Configure here.
Use isDeprecated/replacementAttribute instead of snake_case to match the camelCase response-body convention. Co-Authored-By: Claude <noreply@anthropic.com>
A user-supplied tag can share a name with a sentry convention (e.g. gen_ai.request.model). Gate the convention metadata lookup on attributeSource.source_type == sentry so user attributes never pick up convention metadata. Co-Authored-By: Claude <noreply@anthropic.com>
…cstring Co-Authored-By: Claude <noreply@anthropic.com>
…istration The flag is already registered on master. Co-Authored-By: Claude <noreply@anthropic.com>
…ribute-context-expand
The expand=context param is internal-only (gated behind data-browsing-attribute-context), so hide it from the public spec while keeping it functional. Co-Authored-By: Claude <noreply@anthropic.com>
context is only returned via the internal expand=context param, so it should not appear in the public response example. Co-Authored-By: Claude <noreply@anthropic.com>
brief is always present for a known convention (0/644 missing) and isDeprecated is always derivable, so type them as required. details, examples, and replacementAttribute remain optional. Co-Authored-By: Claude <noreply@anthropic.com>
…on_context Co-Authored-By: Claude <noreply@anthropic.com>
…xt builder Mirror the example normalization: wrap a non-list additional_context in a list instead of iterating it into characters. Defensive — the field is always a list or None today, but this keeps it consistent with examples. Co-Authored-By: Claude <noreply@anthropic.com>
wmak
approved these changes
Jun 17, 2026
Comment on lines
+500
to
+506
| span_id=uuid4().hex[:16], | ||
| organization_id=self.organization.id, | ||
| parent_span_id=None, | ||
| timestamp=before_now(days=0, minutes=10).replace(microsecond=0), | ||
| transaction="foo", | ||
| duration=100, | ||
| exclusive_time=100, |
Member
There was a problem hiding this comment.
a lot of these parameters are already defaulted in the store_segment method and aren't needed
…lper The span_id, parent_span_id, transaction, duration, and exclusive_time arguments in _store_basic_segment all match store_segment defaults and are not asserted on, so drop them to keep the helper minimal. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
skaasten
approved these changes
Jun 18, 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.

Summary
Extends the
GET /organizations/{org}/trace-items/attributes/endpoint so eachreturned attribute can carry a
contextobject sourced from the sentryconventions metadata (
sentry_conventions.attributes.ATTRIBUTE_METADATA).The
contextis only attached when:expand=context, andorganizations:data-browsing-attribute-contextfeature flag is enabled.When the flag is disabled, the request behaves exactly as before even if
expand=contextis passed.Response shape (when expanded):
{ "key": "transaction", "name": "transaction", "attributeSource": { "source_type": "sentry" }, "attributeType": "string", "context": { "brief": "The sentry transaction (segment name).", "details": ["..."], // longer-form notes (additional_context) "examples": ["GET /"], // normalized to a list "isDeprecated": true, "replacementAttribute": "sentry.segment.name" } }Notes / decisions
internal name, mirroring
_update_attribute_definitions_with_deprecationsin
search/eap/spans/attributes.py— a convention may be keyed under either.This matters for ~44 span attributes (e.g.
span.op→sentry.op).metadata.deprecationcan beNone(492/644 attributes), which the builderhandles.
🤖 Generated with Claude Code