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

Apollo v2 BeforeSpanCallback does not allow returning `null`

Open adinauer opened this issue 3 years ago • 3 comments

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

adinauer avatar Jun 30 '22 13:06 adinauer

Strictly speaking, this would be a breaking change, I guess, but it's a bug so that it would be fine.

philipphofmann avatar Jun 30 '22 14:06 philipphofmann

We can also do on the next major to avoid breakages.

adinauer avatar Jun 30 '22 15:06 adinauer

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.

adinauer avatar Jul 20 '22 12:07 adinauer