Sentry-java: Failed to capture traces if `sentry-trace` header exists

Created on 8 Dec 2020  路  2Comments  路  Source: getsentry/sentry-java

_Platform:_

  • [x] Spring -> 2.2.1.RELEASE

_IDE:_

  • [x] IntelliJ -> IntelliJ IDEA 2020.2.4 (Community Edition)
    Build #IC-202.8194.7, built on November 24, 2020

_Build system:_

  • [x] Maven -> 3.6.3

_Android Gradle Plugin:_

  • [ ] Yes -> If yes, which version?
  • [x] No

_Sentry Android Gradle Plugin:_

  • [ ] Yes -> If yes, which version?
  • [x] No

_Proguard/R8:_

  • [ ] Enabled
  • [ ] Disabled

_Platform installed with:_

  • [ ] JCenter
  • [ ] Bintray
  • [x] Maven Central
  • [ ] Manually

The version of the SDK:
4.0.0-alpha.1


I have the following issue:

So if the sentry-trace header is exists it will startTransaction in this line https://github.com/getsentry/sentry-java/blob/main/sentry-spring/src/main/java/io/sentry/spring/tracing/SentryTracingFilter.java#L88.
The transactionContext only set the parentSampled in https://github.com/getsentry/sentry-java/blob/main/sentry/src/main/java/io/sentry/TransactionContext.java#L42, but does not set the sampled (set to null) https://github.com/getsentry/sentry-java/blob/main/sentry/src/main/java/io/sentry/TransactionContext.java#L40

This will lead to always skipping the capture process in https://github.com/getsentry/sentry-java/blob/main/sentry/src/main/java/io/sentry/Hub.java#L652-L658 because the transaction.isSampled() returns null

Expected result:

  • Result it should capture the traces even with sentry-trace header exists
bug

All 2 comments

Thanks @ano1404 for reporting. Fix is on a way.

@ano1404 thanks a lot for trying it out and raising the issue 鉂わ笍

Was this page helpful?
0 / 5 - 0 ratings