-
-
Notifications
You must be signed in to change notification settings - Fork 226
feat(logs): apply default attributes from Scope #4784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
### Features
- apply default attributes from Scope ([#4784](https://github.com/getsentry/sentry-dotnet/pull/4784))If none of the above apply, you can opt out of this check by adding |
| if (scope.PropagationContext._dynamicSamplingContext is { } dynamicSamplingContext) | ||
| { | ||
| if (dynamicSamplingContext.Items.TryGetValue("replay_id", out var replayId)) | ||
| { | ||
| SetAttribute("sentry.replay_id", replayId); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: Could alternatively get from IReplaySession.ActiveReplayId.
But I guess reading it via the Scope unifies the source, and avoid a dependency to IReplaySession.
| if (scope.User.Id is { } userId) | ||
| { | ||
| SetAttribute("user.id", userId); | ||
| } | ||
| if (scope.User.Username is { } userName) | ||
| { | ||
| SetAttribute("user.name", userName); | ||
| } | ||
| if (scope.User.Email is { } userEmail) | ||
| { | ||
| SetAttribute("user.email", userEmail); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: PII
Do we need to check SentryOptions.SendDefaultPii?
Or do/can/should we assume that the data is set only when enabled already, or explicitly set by user code.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4784 +/- ##
==========================================
+ Coverage 73.91% 73.96% +0.05%
==========================================
Files 485 485
Lines 17682 17717 +35
Branches 3494 3510 +16
==========================================
+ Hits 13069 13104 +35
Misses 3755 3755
Partials 858 858 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fixes #4493
closes #4733
See docs: https://develop.sentry.dev/sdk/telemetry/logs/#default-attributes
Changes
Scope.internalAPIs for thatHowever, it seems that we're missing a lot of the Contexts on the
Scope,where we currently mostly apply them to
Events.TODO
Scopewith the data neededCHANGELOG.mdentry