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

Contexts.setTrace can't be null

Open leonchen83 opened this issue 1 year ago • 1 comments

Integration

sentry-android

Build System

Gradle

AGP Version

7.4.2

Proguard

Enabled

Version

7.8.0

Steps to Reproduce

Contexts.setTrace(final @Nullable SpanContext traceContext)

Expected Result

it's Nullable. so traceContext can set to null.

Actual Result

throw NPE. We want set this value to null as same as iOS sdk.

leonchen83 avatar May 13 '24 02:05 leonchen83

Thanks for opening this issue @leonchen83. We'll change this to actually allow setting null.

adinauer avatar May 13 '24 12:05 adinauer

I've just taken a more detailed look at this and we do actually want a trace context to be there. Transactions are even dropped, if trace context is missing. I'll send a PR to update the annotation(s) but we'll keep requiring trace.

adinauer avatar Sep 25 '24 13:09 adinauer

Hi but this behavior is not consistent with the iOS SDK, and we do not need to set the context trace

leonchen83 avatar Sep 29 '24 03:09 leonchen83

Thanks, I'll clarify about consistency, but for now I'll move forward with the @NotNull since that reflects what the current implementation does.

adinauer avatar Sep 30 '24 06:09 adinauer

We just had a talk about this and want to keep trace context required, i.e. @NotNull.

adinauer avatar Oct 09 '24 08:10 adinauer