Repository navigation
feat(tracing): AI Agents templates for @trace decorator - #4676
Merged
Merged
Conversation
@trace decorator@trace decorator
sentrivana
reviewed
Aug 11, 2025
Co-authored-by: Ivana Kellyer <ivana.kellyer@sentry.io>
…-python into manual-instrumentation2
sentrivana
reviewed
Aug 13, 2025
sentrivana
left a comment
Collaborator
There was a problem hiding this comment.
Tests are looking much better, also thanks for the dedup.
There's still some places where it'd be good to dedup, see comments
sentrivana
approved these changes
Aug 13, 2025
antonpirker
enabled auto-merge (squash)
August 13, 2025 10:54
sentrivana
added a commit
that referenced
this pull request
Oct 29, 2026
### Description Removes the private `_get_usage_attributes()` helper from `sentry_sdk/tracing_utils.py`. Nothing on `major/3.0` calls it anymore. It pulled `gen_ai.usage.*` token counts out of return values for the AI Agents `@trace` templates added in #4676. #7457 ("Remove trace template, trace_ignore_status_codes") deleted the template code that called it, but left the helper behind. **Evidence** - On `major/3.0`, `git grep -w _get_usage_attributes` matches only the definition. There are no callers in `sentry_sdk` or `tests`. - No open PR touches it. `_get_value()` is still imported by the LangChain integration, so it stays. On `master` the helper is still used, because the trace templates still exist there. This change only applies to `major/3.0`. #### Issues n/a <!-- junior-request-attribution:start --> via **Ivana Kellyer**. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AC0BTREZTS2Z%3A1793270559.842119 --> -- [View Junior Session](https://junior-prod.sentry.dev/conversations/slack%3AC0BTREZTS2Z%3A1793270559.842119) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0BTREZTS2Z%3A1793270559.842119/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Ivana Kellyer <ivana.kellyer@sentry.io>
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.
Adding a
templateparameter to the@tracedecorator to make it easier to manually create spans for insights modules. Currently there are three templates supportedai_agent,ai_tool, andai_chat.