feat(tracing): Improve @trace decorator. #4648
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4648 +/- ##
==========================================
+ Coverage 85.07% 85.08% +0.01%
==========================================
Files 156 156
Lines 15824 15836 +12
Branches 2677 2677
==========================================
+ Hits 13462 13474 +12
+ Misses 1583 1582 -1
- Partials 779 780 +1
|
@trace decorator.
antonpirker
marked this pull request as ready for review
August 5, 2025 12:46
Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
szokeasaurusrex
left a comment
Member
There was a problem hiding this comment.
Added a few small suggestions, can do a more in depth review once they're addressed
sentrivana
pushed a commit
that referenced
this pull request
Aug 12, 2025
Update the `@trace` decorator and make it more powerful. It accepts now
the following parameters: `op`, `name`, `attributes`.
Example usage:
```python
import sentry_sdk
from sentry_sdk.consts import OP
# Simple usage (like before)
@sentry_sdk.trace
def process_data():
# Function implementation
pass
# With custom parameters
@sentry_sdk.trace(
op=OP.DB_QUERY,
name="Get user data",
attributes={"postgres": True}
)
def make_db_query(sql):
# Function implementation
pass
```
This creates better DX for our users.
---------
Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
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.
Update the
@tracedecorator and make it more powerful. It accepts now the following parameters:op,name,attributes.Example usage:
This creates better DX for our users.