Skip to content

Commit ebd23a2

Browse files
committed
fix(profiler): use span.context() for ProfilerContext check in QueueTime tracker
1 parent 5c5b320 commit ebd23a2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

dd-java-agent/agent-profiling/profiling-ddprof/src/main/java/com/datadog/profiling/ddprof/DatadogProfilingIntegration.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,10 @@ public EndpointTracker onRootSpanStarted(AgentSpan rootSpan) {
166166
public Timing start(TimerType type) {
167167
if (IS_PROFILING_QUEUEING_TIME_ENABLED && type == TimerType.QUEUEING) {
168168
AgentSpan span = AgentTracer.activeSpan();
169-
long submittingSpanId =
170-
(span instanceof ProfilerContext) ? ((ProfilerContext) span).getSpanId() : 0L;
169+
long submittingSpanId = 0L;
170+
if (span != null && span.context() instanceof ProfilerContext) {
171+
submittingSpanId = ((ProfilerContext) span.context()).getSpanId();
172+
}
171173
return DDPROF.newQueueTimeTracker(submittingSpanId);
172174
}
173175
return Timing.NoOp.INSTANCE;

0 commit comments

Comments
 (0)