Skip to content

Commit b16632b

Browse files
committed
Kafka Streams: remove span/scope from task
When finishing the span, remove it to allow it to be GC'd and not linger. Don't think it's causing any problems... just more sanitary.
1 parent 429c27c commit b16632b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dd-java-agent/instrumentation/kafka-streams-0.11/src/main/java/datadog/trace/instrumentation/kafka_streams/KafkaStreamTaskInstrumentation.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ public static class StopSpanAdvice {
166166
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
167167
public static void stop(
168168
@Advice.Thrown final Throwable throwable, @Advice.This StreamTask task) {
169-
AgentScope scope = InstrumentationContext.get(StreamTask.class, AgentScope.class).get(task);
169+
AgentScope scope =
170+
InstrumentationContext.get(StreamTask.class, AgentScope.class).remove(task);
170171
if (scope != null) {
171172
AgentSpan span = scope.span();
172173
CONSUMER_DECORATE.onError(span, throwable);

0 commit comments

Comments
 (0)