Skip to content

Commit c658b5a

Browse files
authored
Merge f3056ff into dd37382
2 parents dd37382 + f3056ff commit c658b5a

File tree

9 files changed

+391
-13
lines changed

9 files changed

+391
-13
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
- Replace deprecated `SimpleInstrumentation` with `SimplePerformantInstrumentation` for graphql 22 ([#3974](https://github.com/getsentry/sentry-java/pull/3974))
2323
- Cache requests for Spring using Springs `ContentCachingRequestWrapper` instead of our own Wrapper to also cache parameters ([#3641](https://github.com/getsentry/sentry-java/pull/3641))
2424
- Previously only the body was cached which could lead to problems in the FilterChain as Request parameters were not available
25+
- We now hold a strong reference to the underlying OpenTelemetry span when it is created through Sentry API ([#3997](https://github.com/getsentry/sentry-java/pull/3997))
26+
- This keeps it from being garbage collected too early
2527

2628
## 8.0.0-rc.2
2729

sentry-android-core/src/test/java/io/sentry/android/core/EnvelopeFileObserverIntegrationTest.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ class EnvelopeFileObserverIntegrationTest {
5252

5353
@AfterTest
5454
fun shutdown() {
55-
Files.delete(file.toPath())
55+
delete(file)
56+
}
57+
58+
private fun delete(f: File) {
59+
f.listFiles()?.forEach { delete(it) }
60+
Files.delete(f.toPath())
5661
}
5762

5863
@Test

sentry-opentelemetry/sentry-opentelemetry-bootstrap/api/sentry-opentelemetry-bootstrap.api

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,58 @@ public final class io/sentry/opentelemetry/OtelSpanFactory : io/sentry/ISpanFact
3939
public fun createTransaction (Lio/sentry/TransactionContext;Lio/sentry/IScopes;Lio/sentry/TransactionOptions;Lio/sentry/TransactionPerformanceCollector;)Lio/sentry/ITransaction;
4040
}
4141

42+
public final class io/sentry/opentelemetry/OtelStrongRefSpanWrapper : io/sentry/opentelemetry/IOtelSpanWrapper {
43+
public fun <init> (Lio/opentelemetry/api/trace/Span;Lio/sentry/opentelemetry/IOtelSpanWrapper;)V
44+
public fun finish ()V
45+
public fun finish (Lio/sentry/SpanStatus;)V
46+
public fun finish (Lio/sentry/SpanStatus;Lio/sentry/SentryDate;)V
47+
public fun getContexts ()Lio/sentry/protocol/Contexts;
48+
public fun getData ()Ljava/util/Map;
49+
public fun getData (Ljava/lang/String;)Ljava/lang/Object;
50+
public fun getDescription ()Ljava/lang/String;
51+
public fun getFinishDate ()Lio/sentry/SentryDate;
52+
public fun getMeasurements ()Ljava/util/Map;
53+
public fun getOperation ()Ljava/lang/String;
54+
public fun getSamplingDecision ()Lio/sentry/TracesSamplingDecision;
55+
public fun getScopes ()Lio/sentry/IScopes;
56+
public fun getSpanContext ()Lio/sentry/SpanContext;
57+
public fun getStartDate ()Lio/sentry/SentryDate;
58+
public fun getStatus ()Lio/sentry/SpanStatus;
59+
public fun getTag (Ljava/lang/String;)Ljava/lang/String;
60+
public fun getTags ()Ljava/util/Map;
61+
public fun getThrowable ()Ljava/lang/Throwable;
62+
public fun getTraceId ()Lio/sentry/protocol/SentryId;
63+
public fun getTransactionName ()Ljava/lang/String;
64+
public fun getTransactionNameSource ()Lio/sentry/protocol/TransactionNameSource;
65+
public fun isFinished ()Z
66+
public fun isNoOp ()Z
67+
public fun isProfileSampled ()Ljava/lang/Boolean;
68+
public fun isSampled ()Ljava/lang/Boolean;
69+
public fun makeCurrent ()Lio/sentry/ISentryLifecycleToken;
70+
public fun setContext (Ljava/lang/String;Ljava/lang/Object;)V
71+
public fun setData (Ljava/lang/String;Ljava/lang/Object;)V
72+
public fun setDescription (Ljava/lang/String;)V
73+
public fun setMeasurement (Ljava/lang/String;Ljava/lang/Number;)V
74+
public fun setMeasurement (Ljava/lang/String;Ljava/lang/Number;Lio/sentry/MeasurementUnit;)V
75+
public fun setOperation (Ljava/lang/String;)V
76+
public fun setStatus (Lio/sentry/SpanStatus;)V
77+
public fun setTag (Ljava/lang/String;Ljava/lang/String;)V
78+
public fun setThrowable (Ljava/lang/Throwable;)V
79+
public fun setTransactionName (Ljava/lang/String;)V
80+
public fun setTransactionName (Ljava/lang/String;Lio/sentry/protocol/TransactionNameSource;)V
81+
public fun startChild (Lio/sentry/SpanContext;Lio/sentry/SpanOptions;)Lio/sentry/ISpan;
82+
public fun startChild (Ljava/lang/String;)Lio/sentry/ISpan;
83+
public fun startChild (Ljava/lang/String;Ljava/lang/String;)Lio/sentry/ISpan;
84+
public fun startChild (Ljava/lang/String;Ljava/lang/String;Lio/sentry/SentryDate;Lio/sentry/Instrumenter;)Lio/sentry/ISpan;
85+
public fun startChild (Ljava/lang/String;Ljava/lang/String;Lio/sentry/SentryDate;Lio/sentry/Instrumenter;Lio/sentry/SpanOptions;)Lio/sentry/ISpan;
86+
public fun startChild (Ljava/lang/String;Ljava/lang/String;Lio/sentry/SpanOptions;)Lio/sentry/ISpan;
87+
public fun storeInContext (Lio/opentelemetry/context/Context;)Lio/opentelemetry/context/Context;
88+
public fun toBaggageHeader (Ljava/util/List;)Lio/sentry/BaggageHeader;
89+
public fun toSentryTrace ()Lio/sentry/SentryTraceHeader;
90+
public fun traceContext ()Lio/sentry/TraceContext;
91+
public fun updateEndDate (Lio/sentry/SentryDate;)Z
92+
}
93+
4294
public final class io/sentry/opentelemetry/OtelTransactionSpanForwarder : io/sentry/ITransaction {
4395
public fun <init> (Lio/sentry/opentelemetry/IOtelSpanWrapper;)V
4496
public fun finish ()V

sentry-opentelemetry/sentry-opentelemetry-bootstrap/src/main/java/io/sentry/opentelemetry/OtelSpanFactory.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,11 @@ public OtelSpanFactory() {
158158
sentrySpan.getSpanContext().setOrigin(spanOptions.getOrigin());
159159
}
160160

161-
return sentrySpan;
161+
if (sentrySpan == null) {
162+
return null;
163+
} else {
164+
return new OtelStrongRefSpanWrapper(otelSpan, sentrySpan);
165+
}
162166
}
163167

164168
private @NotNull Tracer getTracer() {

0 commit comments

Comments
 (0)