-
-
Notifications
You must be signed in to change notification settings - Fork 55
feat: Trace Generation Integration #2123
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
Conversation
|
@@ -19,8 +19,6 @@ public void Register(IHub hub, SentryOptions options) | |||
return; | |||
} | |||
|
|||
options.DiagnosticLogger?.LogDebug("Registering Session integration."); |
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.
The hub already logs which integration get registered. This is redundant.
@@ -4,11 +4,16 @@ | |||
|
|||
namespace Sentry.Unity; | |||
|
|||
internal interface ISentryMonoBehaviour |
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'm creating an internal interface to be able to mock this in the tests.
src/Sentry.Unity/SentryUnitySDK.cs
Outdated
// For now, we're creating a new trace after initializing to be able to tie errors and crashes together on all | ||
// layers. To be able to regenerate new traces based on some mechanism, this will move into some sort of | ||
// integration i.e. scene manager. | ||
SentrySdk.SetTrace(SentryId.Create(), SpanId.Create()); | ||
|
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.
This is the part that is getting replaced by the integration.
src/sentry-dotnet
Outdated
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.
The changes here contain: InternalsVisibleTo
for the tests and removing the internal SentrySdk.SetTrace
that got replaced by accessing the scope directly.
…try/sentry-unity into feat/trace-id-integration
…try/sentry-unity into feat/trace-id-integration
public void Register(IHub hub, SentryOptions options) | ||
{ | ||
hub.ConfigureScope(scope => | ||
scope.SetPropagationContext(new SentryPropagationContext(SentryId.Create(), SpanId.Create()))); |
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.
This constructor feels like a lot of boiler plate. In fact even having to pass a new propagation context feels redundant as it seems it's the main use case we have, just setting a new propagation context.
Could also be solved with an extension method like ResetPropagationContext()
that calls SetPropagationContext(new SentryPropagationContext(SentryId.Create(), SpanId.Create())))
This PR adds an integration that is responsible for generating a new trace based
on already existing mechanisms using in the
SceneManagerIntegration
and theSessionIntegration
In practical terms this translates into the following flow:
TraceGenerationIntegration
gets registered and starts a new traceTraceGenerationIntegration
kicks in and creates a new traceLogically, this separates the startup from the actual game. During gameplay the trace gets re-generated every time the game gains focus. This can/might/should/could get updated in the future by different lifecycle events. I.e. touches on mobile (like Android does it).