Repository navigation
Not planned
Labels
Description
Problem
The SDK has separate paths for adding its default data to telemetry:
- Events and transactions go through
Enricher.Applyat send time (MainSentryEventProcessorandSentryClient). - Check-ins go through a separate
Enricher.Apply(SentryCheckIn)overload. - Logs and metrics use
SetDefaultAttributes.
Much of what Enricher sets doesn't change after init, but it is recomputed for every event. Suggested here as a follow-up to #4882, the idea is to push this data onto the root scope at init, so it reaches telemetry the same way as other scope data.
Current state and target
Data set by Enricher |
Changes after init? | Target |
|---|---|---|
| Runtime and OS contexts | No | Root scope |
| SDK name, version and package | No | Root scope |
| Release, distribution, environment | No | Root scope |
| Default tags | No | Root scope |
| App start time, device boot time | No | Root scope |
Environment.UserName, {{auto}} IP address |
No, but depends on whether the user is already set | To decide |
User.Id from InstallationId |
No | Already on the root scope in global mode (GlobalRootScopeIntegration). Non-global mode still uses Enricher. |
App.InForeground |
Yes | Stays at send time |
Work
- Add a way to populate the root scope at init in both global and non-global mode.
- Move the data that doesn't change out of
Enricher. - Keep
App.InForegroundapplied at send time, and decide where that code lives. - Decide what replaces
Enricher.Apply(SentryCheckIn).SentryCheckInisn't anIEventLike. - Remove
Enricherif nothing is left in it.
Things to watch
- Non-global mode. The scope stack is async-local and is created with a fresh
Scopewhen a flow has none (SentryScopeManager.NewStack). Data pushed onto one root scope at init isn't guaranteed to be on every stack. This is whyUser.Idis still set inEnricheroutside global mode. - Behaviour change. User code could see these values on the scope where they weren't set before, and code that sets them conditionally could behave differently. Earlier discussion suggested waiting for the next major version.
- Native scope sync. Default tags are forwarded to the Android and Cocoa SDKs through the scope observer in
SentrySdk.InitHub, andEnricherapplies them to managed events. Moving them must not change what native crashes receive. - Overlapping work. DataCollection phase 2: migrate core enricher (UserInfo) #5428 also changes how
Enricherhandles user info.
Activity
linear-code commentedon Nov 9, 2026
NET-912
jamescrosswell commentedon Nov 26, 2026
Superseded by #5671, which moved release, environment, SDK, default tags, OS and runtime contexts, and boot time into
ScopeDefaults, resolved once at init. The design in #5197 chose that over setting them on the root scope, for the non-global-mode reason given above.