sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Fix tag extraction logic, bump to Timber 5.0.1

Open markushi opened this issue 8 months ago • 1 comments

:scroll: Description

Timber 5.+ switched to Kotlin, allowing us to directly access the internal tag value, instead of the existing workaround.

According to the release Timber 5.x is binary compatible: https://github.com/JakeWharton/timber/releases/tag/5.0.0 so we should be good with just bumping the version here.

:bulb: Motivation and Context

Fixes https://github.com/getsentry/sentry-java/issues/4484

:green_heart: How did you test it?

Added extra unit tests.

We should still manually test compatibility with Timber 4.x, as the internal tag value was declared the following:

final ThreadLocal<String> explicitTag = new ThreadLocal<>();

And with 5.x it's

@get:JvmSynthetic // Hide from public API.
internal val explicitTag = ThreadLocal<String>()

:pencil: 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.

:crystal_ball: Next steps

markushi avatar Jun 13 '25 07:06 markushi

Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 482.28 ms 524.24 ms 41.96 ms
Size 1.58 MiB 2.09 MiB 518.64 KiB

Previous results on branch: markushi/fix/timber-tag-handling

Startup times

Revision Plain With Sentry Diff
6d73df9ba081e06b17a04a283ccf312e2aba4e43 457.70 ms 519.40 ms 61.70 ms
d43b221a4fed98d86ae48b48af2f9688f3f31623 438.89 ms 507.69 ms 68.80 ms

App size

Revision Plain With Sentry Diff
6d73df9ba081e06b17a04a283ccf312e2aba4e43 1.58 MiB 2.08 MiB 511.33 KiB
d43b221a4fed98d86ae48b48af2f9688f3f31623 1.58 MiB 2.08 MiB 511.33 KiB

github-actions[bot] avatar Jun 13 '25 07:06 github-actions[bot]

Closing this PR as it only works for Timber 5.x and does not seem to fix the underlying root issue of ThreadLocal usages within the Timber library.

markushi avatar Jul 07 '25 11:07 markushi