Skip to content

Conversation

@bitsandfoxes
Copy link
Contributor

@bitsandfoxes bitsandfoxes commented Feb 20, 2025

📜 Description

This PR adds a enableTraceIdGeneration option to the AndroidOptions. This option is then used in the ActiviytLifeCycleIntegration and the SentryGestureListener to control whether the SDK generates a new trace.

💡 Motivation and Context

The idea is that Hybrid SDK should control trace generation. For that they need a way to disable the automatic trace creation in the Java SDK. This is so we can ensure that a single trace ID manages the entire lifecycle of a game/app, linking errors and events top-down.

💚 How did you test it?

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

@github-actions
Copy link
Contributor

github-actions bot commented Feb 20, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 1201533

@github-actions
Copy link
Contributor

github-actions bot commented Feb 20, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 378.22 ms 432.56 ms 54.34 ms
Size 1.58 MiB 2.21 MiB 641.57 KiB

Previous results on branch: feat/auto-trace-id-generation

Startup times

Revision Plain With Sentry Diff
b68b2b0 337.22 ms 428.22 ms 91.00 ms
b35d87a 404.45 ms 405.02 ms 0.57 ms
f864475 415.13 ms 478.10 ms 62.97 ms

App size

Revision Plain With Sentry Diff
b68b2b0 1.58 MiB 2.21 MiB 641.57 KiB
b35d87a 1.58 MiB 2.21 MiB 641.30 KiB
f864475 1.58 MiB 2.21 MiB 641.28 KiB

@bitsandfoxes bitsandfoxes force-pushed the feat/auto-trace-id-generation branch from fc43927 to d0f9805 Compare February 20, 2025 14:10
@bitsandfoxes bitsandfoxes force-pushed the feat/auto-trace-id-generation branch 2 times, most recently from e8ba360 to ac7be23 Compare February 20, 2025 14:56
@bitsandfoxes bitsandfoxes force-pushed the feat/auto-trace-id-generation branch from b4f9292 to 46039a5 Compare February 20, 2025 15:17
@bitsandfoxes bitsandfoxes requested a review from romtsn February 20, 2025 16:44
@bitsandfoxes bitsandfoxes marked this pull request as ready for review February 20, 2025 16:44
Copy link
Member

@romtsn romtsn left a comment

Choose a reason for hiding this comment

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

LGTM, I only have one concern about hybrid-mixed apps (e.g. UaaL or a RN bundle for some screens within a regular android app): this would disable it for the entire run of a process, so it's either-or and not that you can have mixed traces, but I'm not sure if we should think/support this already now.

Co-authored-by: Roman Zavarnitsyn <rom4ek93@gmail.com>
@krystofwoldrich
Copy link
Contributor

The support for hybrid-mixed apps is not clearly defined at the moment. But a simple answer is the mixed app initializes native (Android) manually thus the user should enable enableTraceIdGeneration to avoid long traces.

@bitsandfoxes
Copy link
Contributor Author

I only have one concern about hybrid-mixed apps

The main use-case is Hybrid SDKs controlling the generation. And it's true by default.

@bitsandfoxes bitsandfoxes enabled auto-merge (squash) February 24, 2025 11:11
@bitsandfoxes bitsandfoxes merged commit e5e95de into main Feb 24, 2025
33 checks passed
@bitsandfoxes bitsandfoxes deleted the feat/auto-trace-id-generation branch February 24, 2025 17:27
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.

5 participants