Skip to content

chore: Move startup tracing into the SDK #2234

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

Merged
merged 11 commits into from
Jul 11, 2025
Merged

Conversation

bitsandfoxes
Copy link
Contributor

@bitsandfoxes bitsandfoxes commented Jul 9, 2025

This is in part to help with #2227

We can have startup tracing be its own integration within the SDK instead of shipping it as a .cs that compiles with the game.

Things to note:

  1. We can use the RuntimeInitializeOnLoadMethod attribute from within the SDK. The only requirement is that those are static methods and take no arguments
  2. These methods get called whether the integration got registered or not, hence the IsStartupTracingAllowed check.
  3. For each method we have to first confirm that it is "allowed" to create a span
  4. We make sure this only ever gets executed once by setting the StartupAlreadyCaptured after scene loading.
  5. Setting the StartupAlreadyCaptured also handles the case of manual initialization later than during startup since
    • Those methods always get called
    • We can make sure that late initialization does not (wrongly) start a new startup transaction

#skip-changelog

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't have any tests on this prior. :(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How much of it was AI?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having Startup Tracing be split between SentryInitialization and SentryIntegration we can delete the latter and move everything into internal StartupTracing inside the SDK.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How much of it was AI?

@bitsandfoxes bitsandfoxes merged commit 884b55b into main Jul 11, 2025
139 of 141 checks passed
@bitsandfoxes bitsandfoxes deleted the chore/cleanup-init branch July 11, 2025 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants