File tree Expand file tree Collapse file tree 4 files changed +6
-17
lines changed
instrumentation/spring-webflux-5.0/src
java8/io/opentelemetry/auto/instrumentation/springwebflux
java/io/opentelemetry/auto/instrumentation/springwebflux/client Expand file tree Collapse file tree 4 files changed +6
-17
lines changed Original file line number Diff line number Diff line change 2222import static net .bytebuddy .matcher .ElementMatchers .isPublic ;
2323import static net .bytebuddy .matcher .ElementMatchers .named ;
2424
25+ import com .google .auto .service .AutoService ;
2526import io .opentelemetry .auto .tooling .Instrumenter ;
2627import java .util .Map ;
2728import net .bytebuddy .description .method .MethodDescription ;
2829import net .bytebuddy .description .type .TypeDescription ;
2930import net .bytebuddy .matcher .ElementMatcher ;
3031
31- // FIXME this instrumentation is not currently reliable, see DefaultWebClientAdvice
32- // @AutoService(Instrumenter.class)
32+ @ AutoService (Instrumenter .class )
3333public class WebClientFilterInstrumentation extends Instrumenter .Default {
3434
3535 public WebClientFilterInstrumentation () {
Original file line number Diff line number Diff line change 1818import static io .opentelemetry .auto .instrumentation .springwebflux .client .HttpHeadersInjectAdapter .SETTER ;
1919import static io .opentelemetry .auto .instrumentation .springwebflux .client .SpringWebfluxHttpClientDecorator .DECORATE ;
2020import static io .opentelemetry .auto .instrumentation .springwebflux .client .SpringWebfluxHttpClientDecorator .TRACER ;
21+ import static io .opentelemetry .trace .Span .Kind .CLIENT ;
2122
2223import io .grpc .Context ;
2324import io .opentelemetry .OpenTelemetry ;
@@ -38,13 +39,13 @@ public static void addFilter(final List<ExchangeFilterFunction> exchangeFilterFu
3839
3940 @ Override
4041 public Mono <ClientResponse > filter (final ClientRequest request , final ExchangeFunction next ) {
41- final Span span = TRACER .spanBuilder ("http.request" ).startSpan ();
42+ final Span span =
43+ TRACER .spanBuilder (DECORATE .spanNameForRequest (request )).setSpanKind (CLIENT ).startSpan ();
4244 DECORATE .afterStart (span );
4345
4446 try (final Scope scope = TRACER .withSpan (span )) {
4547 final ClientRequest mutatedRequest =
4648 ClientRequest .from (request )
47- .attribute (Span .class .getName (), span )
4849 .headers (
4950 httpHeaders ->
5051 OpenTelemetry .getPropagators ()
Original file line number Diff line number Diff line change 2727import lombok .extern .slf4j .Slf4j ;
2828import org .reactivestreams .Publisher ;
2929import org .reactivestreams .Subscription ;
30- import org .springframework .web .reactive .function .client .ClientRequest ;
3130import org .springframework .web .reactive .function .server .ServerRequest ;
3231import org .springframework .web .server .ServerWebExchange ;
3332import reactor .core .CoreSubscriber ;
@@ -85,13 +84,6 @@ public static void finishSpanIfPresent(
8584 }
8685 }
8786
88- public static void finishSpanIfPresent (
89- final ClientRequest clientRequest , final Throwable throwable ) {
90- if (clientRequest != null ) {
91- finishSpanIfPresentInAttributes (clientRequest .attributes (), throwable );
92- }
93- }
94-
9587 private static void finishSpanIfPresentInAttributes (
9688 final Map <String , Object > attributes , final Throwable throwable ) {
9789
Original file line number Diff line number Diff line change @@ -22,14 +22,10 @@ import io.opentelemetry.auto.test.base.HttpClientTest
2222import org.springframework.http.HttpMethod
2323import org.springframework.web.reactive.function.client.ClientResponse
2424import org.springframework.web.reactive.function.client.WebClient
25- import spock.lang.Ignore
2625import spock.lang.Timeout
2726
2827import static io.opentelemetry.trace.Span.Kind.CLIENT
2928
30- // FIXME this instrumentation is not currently reliable and so is currently disabled
31- // see DefaultWebClientInstrumentation and DefaultWebClientAdvice
32- @Ignore
3329@Timeout (5 )
3430class SpringWebfluxHttpClientTest extends HttpClientTest {
3531
@@ -54,7 +50,7 @@ class SpringWebfluxHttpClientTest extends HttpClientTest {
5450 if (! exception) {
5551 trace. span(index + 1 ) {
5652 childOf(trace. span(index))
57- operationName " netty.client.request "
53+ operationName " HTTP $m ethod "
5854 spanKind CLIENT
5955 errored exception != null
6056 tags {
You can’t perform that action at this time.
0 commit comments