getsentry / getsentry/sentry-dotnet

Move setup code to GlobalRootScopeIntegration (v7)

Open
#5,197 1 comment 0 reactions 0 assignees View on GitHub
.NET Breaking Change Improvement Next Major
Dominant language
C#
Stars
770
Forks
248
Avg merge
3d 4h
Merged PRs (30d)
49

Description

> We could potentially set more stuff here. There are lots of scope properties that never change and which we currently set on the scope every time we capture an event. These are all candidates, I think:
> https://github.com/getsentry/sentry-dotnet/blob/f50b36095ca58d50837602fba76372311684a779/src/Sentry/Scope.cs#L498-L517
>
>
> More of a performance improvement but might result in a subtle behavioural change for some users (perhaps code that checks/expects things to not be set in certain circumstances and sets them conditionally on this basis ). To be safe, perhaps we delay a change like that until the next major release.

_Originally posted by @jamescrosswell in [#5039](https://github.com/getsentry/sentry-dotnet/pull/5039/changes#r2957195128)_

Some of these things can currently be set via the SentryOptions:
https://github.com/getsentry/sentry-dotnet/blob/55b2d5dcc829c078d22637a5f7ffc0efb13cc196/src/Sentry/SentrySdk.cs#L67-L68

But that in itself is confusing since now it's hard to tell which one should win (Scope or Options).

See:
- https://github.com/getsentry/sentry-dotnet/pull/5376/changes#r3559383552

And it seems we're always copying them from the options into the Scope anyway 😕.

It might be easier if we removed those things from the options and just configured them in a root scope (or allowed the user to configure them in a root scope)... so there was only ever one place these were configured (on the scope).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.