Skip to content

Commit 18c3e3b

Browse files
committed
fix(profiler): use span.context() for ProfilerContext check in LockSupport instrumentation
1 parent 46ebbf2 commit 18c3e3b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

dd-java-agent/instrumentation/datadog/profiling/lock-support-profiling/src/main/java/datadog/trace/instrumentation/locksupport/LockSupportProfilingInstrumentation.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ public static final class ParkAdvice {
6868
@Advice.OnMethodEnter(suppress = Throwable.class)
6969
public static long[] before(@Advice.Argument(value = 0, optional = true) Object blocker) {
7070
AgentSpan span = AgentTracer.activeSpan();
71-
if (!(span instanceof ProfilerContext)) {
71+
if (span == null || !(span.context() instanceof ProfilerContext)) {
7272
return null;
7373
}
74-
ProfilerContext ctx = (ProfilerContext) span;
74+
ProfilerContext ctx = (ProfilerContext) span.context();
7575
ProfilingContextIntegration profiling = AgentTracer.get().getProfilingContext();
7676
long startTicks = profiling.getCurrentTicks();
7777
if (startTicks == 0L) {
@@ -107,10 +107,10 @@ public static void before(@Advice.Argument(0) Thread thread) {
107107
return;
108108
}
109109
AgentSpan span = AgentTracer.activeSpan();
110-
if (!(span instanceof ProfilerContext)) {
110+
if (span == null || !(span.context() instanceof ProfilerContext)) {
111111
return;
112112
}
113-
State.UNPARKING_SPAN.put(thread, ((ProfilerContext) span).getSpanId());
113+
State.UNPARKING_SPAN.put(thread, ((ProfilerContext) span.context()).getSpanId());
114114
}
115115
}
116116
}

0 commit comments

Comments
 (0)