feat(logs): Add user attributes to logs#4423
Merged
szokeasaurusrex merged 1 commit intomasterfrom Jun 5, 2025
Merged
Conversation
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #4423 +/- ##
==========================================
- Coverage 80.67% 80.64% -0.03%
==========================================
Files 142 142
Lines 15982 15986 +4
Branches 2729 2732 +3
==========================================
- Hits 12893 12892 -1
- Misses 2232 2238 +6
+ Partials 857 856 -1
|
AbhiPrasad
reviewed
May 28, 2025
| elif propagation_context is not None: | ||
| log["trace_id"] = propagation_context.trace_id | ||
|
|
||
| if self.should_send_default_pii() and isolation_scope._user is not None: |
Contributor
There was a problem hiding this comment.
shouldn't we also check the global and current scope?
Member
Author
There was a problem hiding this comment.
It should not be necessary. User should always only be set on the isolation scope:
sentry-python/sentry_sdk/api.py
Lines 332 to 334 in 747f0f3
I checked the (few) places we manually call set_user on a scope, these also use the isolation scope only.
a903eb6 to
285abb0
Compare
285abb0 to
076e4d1
Compare
szokeasaurusrex
added a commit
that referenced
this pull request
Jun 5, 2025
We are always just using the current scope anyway; it is less confusing if we eliminate the parameter Stacked on: - #4423
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.
Example log with user attributes: https://sentry-sdks.sentry.io/explore/logs/trace/362b3309f7f9471eb504af407bf51932/?logsSortBys=-timestamp&project=4505239425777664&source=logs&tab=logs×tamp=1748448946
Closes #4422