Add async propagation flags for kafka consumer.

This commit is contained in:
Tyler Benson 2019-12-18 10:40:54 -08:00
parent b3f15ca133
commit 7095ea3426
2 changed files with 3 additions and 1 deletions

View File

@ -59,6 +59,7 @@ public class TracingIterator implements Iterator<ConsumerRecord> {
decorator.afterStart(span);
decorator.onConsume(span, next);
currentScope = activateSpan(span, true);
currentScope.setAsyncPropagation(true);
}
} catch (final Exception e) {
log.debug("Error during decoration", e);

View File

@ -81,7 +81,7 @@ public class KafkaStreamsProcessorInstrumentation {
CONSUMER_DECORATE.afterStart(span);
CONSUMER_DECORATE.onConsume(span, record);
activateSpan(span, true);
activateSpan(span, true).setAsyncPropagation(true);
}
}
}
@ -119,6 +119,7 @@ public class KafkaStreamsProcessorInstrumentation {
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
public static void stopSpan(@Advice.Thrown final Throwable throwable) {
// This is dangerous... we assume the span/scope is the one we expect, but it may not be.
final AgentSpan span = activeSpan();
if (span != null) {
CONSUMER_DECORATE.onError(span, throwable);