-
-
Notifications
You must be signed in to change notification settings - Fork 205
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
Set Scope.User.Id to the InstallationId by default #3425
Conversation
b8d789e
to
c541459
Compare
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.
I think this is doing it the wrong way around. Now the client and the session manager each hold their own version of an installationIdHelper
. And the client tries to fix a missing ID after the fact?
The ID is part of the state and should sit on the hub if it's getting used in multiple places, which, if it's getting resolved in the GlobalSessionManager
, is already sort of happening. In that case, it should be set on the user where applicable.
The client should not need go around trying to cover gaps in the setup.
That sounds good in principal. In practice, I had to delay setting the User.Id until the client since setting it earlier impacts various other functionality. Here, for example, the client runs an enricher: sentry-dotnet/src/Sentry/SentryClient.cs Line 147 in c541459
The enricher does this: sentry-dotnet/src/Sentry/Internal/Enricher.cs Lines 79 to 82 in 5bcb9ca
Setting the User.Id before this point would break the enricher then (as it changes the result of the call to The MainSentryEventProcessor does something similar for events. I think utlimately the InstallationId is not state that's held by the hub at all... rather it's state that gets initialised the first time the SDK runs for a particular project on a particular device. It sets a unique ID identifying that installation and stores it on the file system. Logically, it's a piece of context that stays the same for the duration of the application's execution so it's similar to some of the other stuff we new up when initialising the SDK/Options. It's accessed by the Global Session Manager and also by the Sentry Client - but neither of these creates/owns/stores that state. I'm thinking maybe we could move it to be a Lazy property on the SentryOptions then ( |
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.
Ahh, I like this a lot better! That makes a lot of sense, putting it on the options! Thanks for that!
Resolves #3302