Skip to content

Commit 66617d6

Browse files
committed
passing span ID as well
1 parent ea206a7 commit 66617d6

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

sentry-android-ndk/src/main/java/io/sentry/android/ndk/NdkScopeObserver.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import io.sentry.SentryLevel;
88
import io.sentry.SentryOptions;
99
import io.sentry.SpanContext;
10+
import io.sentry.SpanId;
1011
import io.sentry.ndk.INativeScope;
1112
import io.sentry.ndk.NativeScope;
1213
import io.sentry.protocol.SentryId;
@@ -131,21 +132,14 @@ public void removeExtra(final @NotNull String key) {
131132

132133
@Override
133134
public void setTrace(@Nullable SpanContext spanContext, @NotNull IScope scope) {
134-
options.getLogger().log(SentryLevel.INFO, "Attempting to set the trace ID");
135-
136135
if(spanContext == null) {
137136
return;
138137
}
139138

140-
@Nullable SentryId traceId = spanContext.getTraceId();
141-
String traceIdString = traceId.toString();
142-
143-
options.getLogger().log(SentryLevel.INFO, "Fetched trace ID '%s'.", traceIdString);
144-
145139
try {
146-
options.getExecutorService().submit(() -> nativeScope.setTraceId(traceIdString));
140+
options.getExecutorService().submit(() -> nativeScope.setTraceId(spanContext.getTraceId().toString(), spanContext.getSpanId().toString()));
147141
} catch (Throwable e) {
148-
options.getLogger().log(SentryLevel.ERROR, e, "Scope sync setTraceId(%s) has an error.", traceIdString);
142+
options.getLogger().log(SentryLevel.ERROR, e, "Scope sync setTraceId failed.");
149143
}
150144
}
151145
}

0 commit comments

Comments
 (0)