Skip to content

Commit 49cc6bb

Browse files
authored
POTEL 30 - span.startChild now uses .makeCurrent() by default (#3544)
* Partially fix class loading into bootstrap classloader * startChild span now makes the child span the current span by default * changelog
1 parent afff380 commit 49cc6bb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
- Support spans that are split into multiple batches ([#3539](https://github.com/getsentry/sentry-java/pull/3539))
1212
- When spans belonging to a single transaction were split into multiple batches for SpanExporter, we did not add all spans because the isSpanTooOld check wasn't inverted.
1313
- Parse and use `send-default-pii` and `max-request-body-size` from `sentry.properties` ([#3534](https://github.com/getsentry/sentry-java/pull/3534))
14+
- `span.startChild` now uses `.makeCurrent()` by default ([#3544](https://github.com/getsentry/sentry-java/pull/3544))
15+
- This caused an issue where the span tree wasn't correct because some spans were not added to their direct parent
1416
- Partially fix bootstrap class loading ([#3543](https://github.com/getsentry/sentry-java/pull/3543))
1517
- There was a problem with two separate Sentry `Scopes` being active inside each OpenTelemetry `Context` due to using context keys from more than one class loader.
1618

sentry-opentelemetry/sentry-opentelemetry-extra/src/main/java/io/sentry/opentelemetry/OtelSpanWrapper.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ public OtelSpanWrapper(
129129
return NoOpSpan.getInstance();
130130
}
131131

132-
return scopes.getOptions().getSpanFactory().createSpan(scopes, spanOptions, spanContext, this);
132+
final @NotNull ISpan childSpan =
133+
scopes.getOptions().getSpanFactory().createSpan(scopes, spanOptions, spanContext, this);
134+
// TODO [POTEL] spanOptions.isBindToScope with default true?
135+
childSpan.makeCurrent();
136+
return childSpan;
133137
}
134138

135139
@Override

0 commit comments

Comments
 (0)