Skip to content

Commit afff380

Browse files
authored
POTEL 29 - Partially fix bootstrap class loading (#3543)
* Partially fix class loading into bootstrap classloader * changelog
1 parent a62056e commit afff380

File tree

19 files changed

+250
-164
lines changed

19 files changed

+250
-164
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+
- Partially fix bootstrap class loading ([#3543](https://github.com/getsentry/sentry-java/pull/3543))
15+
- 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.
1416

1517
## 8.0.0-alpha.2
1618

sentry-opentelemetry/sentry-opentelemetry-agent/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ val upstreamAgent = configurations.create("upstreamAgent") {
5454
dependencies {
5555
bootstrapLibs(projects.sentry)
5656
bootstrapLibs(projects.sentryOpentelemetry.sentryOpentelemetryBootstrap)
57+
bootstrapLibs(projects.sentryOpentelemetry.sentryOpentelemetryExtra)
5758
javaagentLibs(projects.sentryOpentelemetry.sentryOpentelemetryAgentcustomization)
5859
upstreamAgent(Config.Libs.OpenTelemetry.otelJavaAgent)
5960
}

sentry-opentelemetry/sentry-opentelemetry-agentcustomization/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ dependencies {
2424
exclude(group = "io.opentelemetry")
2525
exclude(group = "io.opentelemetry.javaagent")
2626
}
27-
// compileOnly(projects.sentryOpentelemetry.sentryOpentelemetryBootstrap)
28-
implementation(projects.sentryOpentelemetry.sentryOpentelemetryBootstrap)
27+
compileOnly(projects.sentryOpentelemetry.sentryOpentelemetryBootstrap)
28+
implementation(projects.sentryOpentelemetry.sentryOpentelemetryExtra)
2929

3030
compileOnly(Config.Libs.OpenTelemetry.otelSdk)
3131
compileOnly(Config.Libs.OpenTelemetry.otelExtensionAutoconfigureSpi)

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

Lines changed: 0 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -10,169 +10,10 @@ public final class io/sentry/opentelemetry/InternalSemanticAttributes {
1010
public fun <init> ()V
1111
}
1212

13-
public final class io/sentry/opentelemetry/OpenTelemetryUtil {
14-
public fun <init> ()V
15-
public static fun applyOpenTelemetryOptions (Lio/sentry/SentryOptions;)V
16-
}
17-
18-
public final class io/sentry/opentelemetry/OtelContextScopesStorage : io/sentry/IScopesStorage {
19-
public fun <init> ()V
20-
public fun close ()V
21-
public fun get ()Lio/sentry/IScopes;
22-
public fun set (Lio/sentry/IScopes;)Lio/sentry/ISentryLifecycleToken;
23-
}
24-
25-
public final class io/sentry/opentelemetry/OtelSpanContext : io/sentry/SpanContext {
26-
public fun <init> (Lio/opentelemetry/sdk/trace/ReadWriteSpan;Lio/sentry/TracesSamplingDecision;Lio/sentry/opentelemetry/OtelSpanWrapper;Lio/sentry/Baggage;)V
27-
public fun getOperation ()Ljava/lang/String;
28-
public fun getStatus ()Lio/sentry/SpanStatus;
29-
public fun setOperation (Ljava/lang/String;)V
30-
public fun setStatus (Lio/sentry/SpanStatus;)V
31-
}
32-
33-
public final class io/sentry/opentelemetry/OtelSpanFactory : io/sentry/ISpanFactory {
34-
public fun <init> ()V
35-
public fun createSpan (Lio/sentry/IScopes;Lio/sentry/SpanOptions;Lio/sentry/SpanContext;Lio/sentry/ISpan;)Lio/sentry/ISpan;
36-
public fun createTransaction (Lio/sentry/TransactionContext;Lio/sentry/IScopes;Lio/sentry/TransactionOptions;Lio/sentry/TransactionPerformanceCollector;)Lio/sentry/ITransaction;
37-
public fun retrieveCurrentSpan (Lio/sentry/IScope;)Lio/sentry/ISpan;
38-
public fun retrieveCurrentSpan (Lio/sentry/IScopes;)Lio/sentry/ISpan;
39-
}
40-
41-
public final class io/sentry/opentelemetry/OtelSpanWrapper : io/sentry/ISpan {
42-
public fun <init> (Lio/opentelemetry/sdk/trace/ReadWriteSpan;Lio/sentry/IScopes;Lio/sentry/SentryDate;Lio/sentry/TracesSamplingDecision;Lio/sentry/opentelemetry/OtelSpanWrapper;Lio/sentry/Baggage;)V
43-
public fun finish ()V
44-
public fun finish (Lio/sentry/SpanStatus;)V
45-
public fun finish (Lio/sentry/SpanStatus;Lio/sentry/SentryDate;)V
46-
public fun getContexts ()Lio/sentry/protocol/Contexts;
47-
public fun getData ()Ljava/util/Map;
48-
public fun getData (Ljava/lang/String;)Ljava/lang/Object;
49-
public fun getDescription ()Ljava/lang/String;
50-
public fun getFinishDate ()Lio/sentry/SentryDate;
51-
public fun getLocalMetricsAggregator ()Lio/sentry/metrics/LocalMetricsAggregator;
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 toBaggageHeader (Ljava/util/List;)Lio/sentry/BaggageHeader;
88-
public fun toSentryTrace ()Lio/sentry/SentryTraceHeader;
89-
public fun traceContext ()Lio/sentry/TraceContext;
90-
public fun updateEndDate (Lio/sentry/SentryDate;)Z
91-
}
92-
93-
public final class io/sentry/opentelemetry/OtelTransactionSpanForwarder : io/sentry/ITransaction {
94-
public fun <init> (Lio/sentry/opentelemetry/OtelSpanWrapper;)V
95-
public fun finish ()V
96-
public fun finish (Lio/sentry/SpanStatus;)V
97-
public fun finish (Lio/sentry/SpanStatus;Lio/sentry/SentryDate;)V
98-
public fun finish (Lio/sentry/SpanStatus;Lio/sentry/SentryDate;ZLio/sentry/Hint;)V
99-
public fun forceFinish (Lio/sentry/SpanStatus;ZLio/sentry/Hint;)V
100-
public fun getContexts ()Lio/sentry/protocol/Contexts;
101-
public fun getData (Ljava/lang/String;)Ljava/lang/Object;
102-
public fun getDescription ()Ljava/lang/String;
103-
public fun getEventId ()Lio/sentry/protocol/SentryId;
104-
public fun getFinishDate ()Lio/sentry/SentryDate;
105-
public fun getLatestActiveSpan ()Lio/sentry/ISpan;
106-
public fun getLocalMetricsAggregator ()Lio/sentry/metrics/LocalMetricsAggregator;
107-
public fun getName ()Ljava/lang/String;
108-
public fun getOperation ()Ljava/lang/String;
109-
public fun getSamplingDecision ()Lio/sentry/TracesSamplingDecision;
110-
public fun getSpanContext ()Lio/sentry/SpanContext;
111-
public fun getSpans ()Ljava/util/List;
112-
public fun getStartDate ()Lio/sentry/SentryDate;
113-
public fun getStatus ()Lio/sentry/SpanStatus;
114-
public fun getTag (Ljava/lang/String;)Ljava/lang/String;
115-
public fun getThrowable ()Ljava/lang/Throwable;
116-
public fun getTransactionNameSource ()Lio/sentry/protocol/TransactionNameSource;
117-
public fun isFinished ()Z
118-
public fun isNoOp ()Z
119-
public fun isProfileSampled ()Ljava/lang/Boolean;
120-
public fun isSampled ()Ljava/lang/Boolean;
121-
public fun makeCurrent ()Lio/sentry/ISentryLifecycleToken;
122-
public fun scheduleFinish ()V
123-
public fun setContext (Ljava/lang/String;Ljava/lang/Object;)V
124-
public fun setData (Ljava/lang/String;Ljava/lang/Object;)V
125-
public fun setDescription (Ljava/lang/String;)V
126-
public fun setMeasurement (Ljava/lang/String;Ljava/lang/Number;)V
127-
public fun setMeasurement (Ljava/lang/String;Ljava/lang/Number;Lio/sentry/MeasurementUnit;)V
128-
public fun setName (Ljava/lang/String;)V
129-
public fun setName (Ljava/lang/String;Lio/sentry/protocol/TransactionNameSource;)V
130-
public fun setOperation (Ljava/lang/String;)V
131-
public fun setStatus (Lio/sentry/SpanStatus;)V
132-
public fun setTag (Ljava/lang/String;Ljava/lang/String;)V
133-
public fun setThrowable (Ljava/lang/Throwable;)V
134-
public fun startChild (Lio/sentry/SpanContext;Lio/sentry/SpanOptions;)Lio/sentry/ISpan;
135-
public fun startChild (Ljava/lang/String;)Lio/sentry/ISpan;
136-
public fun startChild (Ljava/lang/String;Ljava/lang/String;)Lio/sentry/ISpan;
137-
public fun startChild (Ljava/lang/String;Ljava/lang/String;Lio/sentry/SentryDate;)Lio/sentry/ISpan;
138-
public fun startChild (Ljava/lang/String;Ljava/lang/String;Lio/sentry/SentryDate;Lio/sentry/Instrumenter;)Lio/sentry/ISpan;
139-
public fun startChild (Ljava/lang/String;Ljava/lang/String;Lio/sentry/SentryDate;Lio/sentry/Instrumenter;Lio/sentry/SpanOptions;)Lio/sentry/ISpan;
140-
public fun startChild (Ljava/lang/String;Ljava/lang/String;Lio/sentry/SpanOptions;)Lio/sentry/ISpan;
141-
public fun toBaggageHeader (Ljava/util/List;)Lio/sentry/BaggageHeader;
142-
public fun toSentryTrace ()Lio/sentry/SentryTraceHeader;
143-
public fun traceContext ()Lio/sentry/TraceContext;
144-
public fun updateEndDate (Lio/sentry/SentryDate;)Z
145-
}
146-
147-
public final class io/sentry/opentelemetry/SentryContextStorage : io/opentelemetry/context/ContextStorage {
148-
public fun <init> (Lio/opentelemetry/context/ContextStorage;)V
149-
public fun attach (Lio/opentelemetry/context/Context;)Lio/opentelemetry/context/Scope;
150-
public fun current ()Lio/opentelemetry/context/Context;
151-
}
152-
153-
public final class io/sentry/opentelemetry/SentryContextWrapper : io/opentelemetry/context/Context {
154-
public fun get (Lio/opentelemetry/context/ContextKey;)Ljava/lang/Object;
155-
public fun toString ()Ljava/lang/String;
156-
public fun with (Lio/opentelemetry/context/ContextKey;Ljava/lang/Object;)Lio/opentelemetry/context/Context;
157-
public static fun wrap (Lio/opentelemetry/context/Context;)Lio/sentry/opentelemetry/SentryContextWrapper;
158-
}
159-
16013
public final class io/sentry/opentelemetry/SentryOtelKeys {
16114
public static final field SENTRY_BAGGAGE_KEY Lio/opentelemetry/context/ContextKey;
16215
public static final field SENTRY_SCOPES_KEY Lio/opentelemetry/context/ContextKey;
16316
public static final field SENTRY_TRACE_KEY Lio/opentelemetry/context/ContextKey;
16417
public fun <init> ()V
16518
}
16619

167-
public final class io/sentry/opentelemetry/SentryOtelThreadLocalStorage : io/opentelemetry/context/ContextStorage {
168-
public fun <init> ()V
169-
public fun attach (Lio/opentelemetry/context/Context;)Lio/opentelemetry/context/Scope;
170-
public fun current ()Lio/opentelemetry/context/Context;
171-
}
172-
173-
public final class io/sentry/opentelemetry/SentryWeakSpanStorage {
174-
public static fun getInstance ()Lio/sentry/opentelemetry/SentryWeakSpanStorage;
175-
public fun getSentrySpan (Lio/opentelemetry/api/trace/SpanContext;)Lio/sentry/opentelemetry/OtelSpanWrapper;
176-
public fun storeSentrySpan (Lio/opentelemetry/api/trace/SpanContext;Lio/sentry/opentelemetry/OtelSpanWrapper;)V
177-
}
178-

sentry-opentelemetry/sentry-opentelemetry-core/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dependencies {
2222
compileOnly(projects.sentry)
2323
// TODO implementation?
2424
compileOnly(projects.sentryOpentelemetry.sentryOpentelemetryBootstrap)
25+
compileOnly(projects.sentryOpentelemetry.sentryOpentelemetryExtra)
2526

2627
implementation(Config.Libs.OpenTelemetry.otelSdk)
2728
compileOnly(Config.Libs.OpenTelemetry.otelSemconv)
@@ -34,6 +35,7 @@ dependencies {
3435

3536
// tests
3637
testImplementation(projects.sentryOpentelemetry.sentryOpentelemetryBootstrap)
38+
testImplementation(projects.sentryOpentelemetry.sentryOpentelemetryExtra)
3739
testImplementation(projects.sentryTestSupport)
3840
testImplementation(kotlin(Config.kotlinStdLib))
3941
testImplementation(Config.TestLibs.kotlinTestJunit)

0 commit comments

Comments
 (0)