sentry-java
sentry-java copied to clipboard
Apollo v2 BeforeSpanCallback does not allow returning `null`
Integration
sentry-apollo
Build System
Gradle
AGP Version
Proguard
Disabled
Version
6.1.4
Steps to Reproduce
https://github.com/getsentry/sentry-java/blob/524ee49b212c3f2eead20960c3c6825ccdbf8007/sentry-apollo/src/main/java/io/sentry/apollo/SentryApolloInterceptor.kt#L150
Expected Result
Can return null by changing the return signature to ISpan?
In case null is returned, original span needs to be set to non traced as other integrations do (Feign / OkHttp).
Actual Result
Can't return null
Strictly speaking, this would be a breaking change, I guess, but it's a bug so that it would be fine.
We can also do on the next major to avoid breakages.
Maybe returning a NoOpSpan could serve as workaround until we fix this. This might require us to explicitly handle NoOpSpan and finish the old span / set sampled to false.