Add decorator hooks during lifecycle of Publisher
MODIFY
dd-java-agent/instrumentation/spring-webflux/src/main/java8/datadog/trace/instrumentation/springwebflux/client/TracingClientResponseMono.java
dd-java-agent/instrumentation/spring-webflux/src/main/java8/datadog/trace/instrumentation/springwebflux/client/TracingClientResponseMono.java
package datadog.trace.instrumentation.springwebflux.client;
+import static datadog.trace.instrumentation.springwebflux.client.SpringWebfluxHttpClientDecorator.DECORATE;
+
import io.opentracing.Scope;
import io.opentracing.Span;
import io.opentracing.Tracer;
@@ -38,6 +40,7 @@ public class TracingClientResponseMono extends Mono<ClientResponse> {
.asChildOf(parentSpan)
.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT)
.start();
+ DECORATE.afterStart(span);
try (final Scope scope = tracer.scopeManager().activate(span, false)) {
final ClientRequest mutatedRequest =

MODIFY
dd-java-agent/instrumentation/spring-webflux/src/main/java8/datadog/trace/instrumentation/springwebflux/client/TracingClientResponseSubscriber.java
dd-java-agent/instrumentation/spring-webflux/src/main/java8/datadog/trace/instrumentation/springwebflux/client/TracingClientResponseSubscriber.java
@@ -44,6 +44,7 @@ public class TracingClientResponseSubscriber implements CoreSubscriber<ClientRes
@Override
public void cancel() {
DECORATE.onCancel(span);
+ DECORATE.beforeFinish(span);
subscription.cancel();
span.finish();
}
@@ -73,6 +74,7 @@ public class TracingClientResponseSubscriber implements CoreSubscriber<ClientRes
subscriber.onError(throwable);
} finally {
DECORATE.onError(span, throwable);
+ DECORATE.beforeFinish(span);
span.finish();
}
}
@@ -82,6 +84,7 @@ public class TracingClientResponseSubscriber implements CoreSubscriber<ClientRes
try {
subscriber.onComplete();
} finally {
+ DECORATE.beforeFinish(span);
span.finish();
}
}

Add decorator hooks during lifecycle of Publisher