@Test public void completeSubspanAttachedToCurrentThread_does_nothing_if_called_when_current_thread_span_is_null() { assertThat(Tracer.getInstance().getCurrentSpan()).isNull(); WingtipsSpringWebfluxExchangeFilterFunction.completeSubspanAttachedToCurrentThread( request, responseMock, mock(Throwable.class), tagAndNamingStrategy, tagAndNamingAdapterMock, Pair.of("foo", "bar") ); assertThat(strategyResponseTaggingAndFinalSpanNameMethodCalled.get()).isFalse(); assertThat(spanRecorder.completedSpans).isEmpty(); }
@SafeVarargs protected static void completeSubspanAttachedToCurrentThread( @NotNull ClientRequest request, @Nullable ClientResponse response, @Nullable Throwable error, @NotNull HttpTagAndSpanNamingStrategy<ClientRequest, ClientResponse> tagAndNamingStrategy, @NotNull HttpTagAndSpanNamingAdapter<ClientRequest, ClientResponse> tagAndNamingAdapter, Pair<String, String>... extraCustomTags ) { Span span = Tracer.getInstance().getCurrentSpan(); if (span == null) { return; } if (span.isCompleted()) { return; } try { if (extraCustomTags != null) { for (Pair<String, String> tag : extraCustomTags) { span.putTag(tag.getKey(), tag.getValue()); } } tagAndNamingStrategy.handleResponseTaggingAndFinalSpanName( span, request, response, error, tagAndNamingAdapter ); } finally { span.close(); } }
WingtipsSpringWebfluxExchangeFilterFunction implements ExchangeFilterFunction { @SafeVarargs protected static void completeSubspanAttachedToCurrentThread( @NotNull ClientRequest request, @Nullable ClientResponse response, @Nullable Throwable error, @NotNull HttpTagAndSpanNamingStrategy<ClientRequest, ClientResponse> tagAndNamingStrategy, @NotNull HttpTagAndSpanNamingAdapter<ClientRequest, ClientResponse> tagAndNamingAdapter, Pair<String, String>... extraCustomTags ) { Span span = Tracer.getInstance().getCurrentSpan(); if (span == null) { return; } if (span.isCompleted()) { return; } try { if (extraCustomTags != null) { for (Pair<String, String> tag : extraCustomTags) { span.putTag(tag.getKey(), tag.getValue()); } } tagAndNamingStrategy.handleResponseTaggingAndFinalSpanName( span, request, response, error, tagAndNamingAdapter ); } finally { span.close(); } } }
WingtipsSpringWebfluxExchangeFilterFunction implements ExchangeFilterFunction { @SafeVarargs protected static void completeSubspanAttachedToCurrentThread( @NotNull ClientRequest request, @Nullable ClientResponse response, @Nullable Throwable error, @NotNull HttpTagAndSpanNamingStrategy<ClientRequest, ClientResponse> tagAndNamingStrategy, @NotNull HttpTagAndSpanNamingAdapter<ClientRequest, ClientResponse> tagAndNamingAdapter, Pair<String, String>... extraCustomTags ) { Span span = Tracer.getInstance().getCurrentSpan(); if (span == null) { return; } if (span.isCompleted()) { return; } try { if (extraCustomTags != null) { for (Pair<String, String> tag : extraCustomTags) { span.putTag(tag.getKey(), tag.getValue()); } } tagAndNamingStrategy.handleResponseTaggingAndFinalSpanName( span, request, response, error, tagAndNamingAdapter ); } finally { span.close(); } } WingtipsSpringWebfluxExchangeFilterFunction();  WingtipsSpringWebfluxExchangeFilterFunction(boolean surroundCallsWithSubspan); @SuppressWarnings("ConstantConditions")  WingtipsSpringWebfluxExchangeFilterFunction(
        boolean surroundCallsWithSubspan,
        @NotNull HttpTagAndSpanNamingStrategy<ClientRequest, ClientResponse> tagAndNamingStrategy,
        @NotNull HttpTagAndSpanNamingAdapter<ClientRequest, ClientResponse> tagAndNamingAdapter
    ); }
WingtipsSpringWebfluxExchangeFilterFunction implements ExchangeFilterFunction { @SafeVarargs protected static void completeSubspanAttachedToCurrentThread( @NotNull ClientRequest request, @Nullable ClientResponse response, @Nullable Throwable error, @NotNull HttpTagAndSpanNamingStrategy<ClientRequest, ClientResponse> tagAndNamingStrategy, @NotNull HttpTagAndSpanNamingAdapter<ClientRequest, ClientResponse> tagAndNamingAdapter, Pair<String, String>... extraCustomTags ) { Span span = Tracer.getInstance().getCurrentSpan(); if (span == null) { return; } if (span.isCompleted()) { return; } try { if (extraCustomTags != null) { for (Pair<String, String> tag : extraCustomTags) { span.putTag(tag.getKey(), tag.getValue()); } } tagAndNamingStrategy.handleResponseTaggingAndFinalSpanName( span, request, response, error, tagAndNamingAdapter ); } finally { span.close(); } } WingtipsSpringWebfluxExchangeFilterFunction();  WingtipsSpringWebfluxExchangeFilterFunction(boolean surroundCallsWithSubspan); @SuppressWarnings("ConstantConditions")  WingtipsSpringWebfluxExchangeFilterFunction(
        boolean surroundCallsWithSubspan,
        @NotNull HttpTagAndSpanNamingStrategy<ClientRequest, ClientResponse> tagAndNamingStrategy,
        @NotNull HttpTagAndSpanNamingAdapter<ClientRequest, ClientResponse> tagAndNamingAdapter
    ); @Override @NotNull Mono<ClientResponse> filter(
        @NotNull ClientRequest request, @NotNull ExchangeFunction next
    ); }
WingtipsSpringWebfluxExchangeFilterFunction implements ExchangeFilterFunction { @SafeVarargs protected static void completeSubspanAttachedToCurrentThread( @NotNull ClientRequest request, @Nullable ClientResponse response, @Nullable Throwable error, @NotNull HttpTagAndSpanNamingStrategy<ClientRequest, ClientResponse> tagAndNamingStrategy, @NotNull HttpTagAndSpanNamingAdapter<ClientRequest, ClientResponse> tagAndNamingAdapter, Pair<String, String>... extraCustomTags ) { Span span = Tracer.getInstance().getCurrentSpan(); if (span == null) { return; } if (span.isCompleted()) { return; } try { if (extraCustomTags != null) { for (Pair<String, String> tag : extraCustomTags) { span.putTag(tag.getKey(), tag.getValue()); } } tagAndNamingStrategy.handleResponseTaggingAndFinalSpanName( span, request, response, error, tagAndNamingAdapter ); } finally { span.close(); } } WingtipsSpringWebfluxExchangeFilterFunction();  WingtipsSpringWebfluxExchangeFilterFunction(boolean surroundCallsWithSubspan); @SuppressWarnings("ConstantConditions")  WingtipsSpringWebfluxExchangeFilterFunction(
        boolean surroundCallsWithSubspan,
        @NotNull HttpTagAndSpanNamingStrategy<ClientRequest, ClientResponse> tagAndNamingStrategy,
        @NotNull HttpTagAndSpanNamingAdapter<ClientRequest, ClientResponse> tagAndNamingAdapter
    ); @Override @NotNull Mono<ClientResponse> filter(
        @NotNull ClientRequest request, @NotNull ExchangeFunction next
    ); static final @NotNull WingtipsSpringWebfluxExchangeFilterFunction DEFAULT_IMPL; }