WingtipsSpringUtil { public static RestTemplate createTracingEnabledRestTemplate() { return createTracingEnabledRestTemplate(true); } protected  WingtipsSpringUtil(); static RestTemplate createTracingEnabledRestTemplate(); static RestTemplate createTracingEnabledRestTemplate(boolean surroundCallsWithSubspan); static RestTemplate createTracingEnabledRestTemplate(
        boolean surroundCallsWithSubspan,
        HttpTagAndSpanNamingStrategy<HttpRequest, ClientHttpResponse> tagAndNamingStrategy,
        HttpTagAndSpanNamingAdapter<HttpRequest, ClientHttpResponse> tagAndNamingAdapter
    ); static AsyncRestTemplate createTracingEnabledAsyncRestTemplate(); static AsyncRestTemplate createTracingEnabledAsyncRestTemplate(boolean surroundCallsWithSubspan); static AsyncRestTemplate createTracingEnabledAsyncRestTemplate(
        boolean surroundCallsWithSubspan,
        HttpTagAndSpanNamingStrategy<HttpRequest, ClientHttpResponse> tagAndNamingStrategy,
        HttpTagAndSpanNamingAdapter<HttpRequest, ClientHttpResponse> tagAndNamingAdapter
    ); static void propagateTracingHeaders(HttpMessage httpMessage, Span span); static String getRequestMethodAsString(HttpMethod method); static SuccessCallback<T> successCallbackWithTracing(SuccessCallback<T> successCallback); static SuccessCallback<T> successCallbackWithTracing(
        SuccessCallback<T> successCallback,
        Pair<Deque<Span>, Map<String, String>> threadInfoToLink
    ); static SuccessCallback<T> successCallbackWithTracing(
        SuccessCallback<T> successCallback,
        Deque<Span> spanStackToLink,
        Map<String, String> mdcContextMapToLink
    ); static FailureCallback failureCallbackWithTracing(FailureCallback failureCallback); static FailureCallback failureCallbackWithTracing(FailureCallback failureCallback,
                                                             Pair<Deque<Span>, Map<String, String>> threadInfoToLink); static FailureCallback failureCallbackWithTracing(FailureCallback failureCallback,
                                                             Deque<Span> spanStackToLink,
                                                             Map<String, String> mdcContextMapToLink); static ListenableFutureCallback<T> listenableFutureCallbackWithTracing(
        ListenableFutureCallback<T> listenableFutureCallback
    ); static ListenableFutureCallback<T> listenableFutureCallbackWithTracing(
        ListenableFutureCallback<T> listenableFutureCallback,
        Pair<Deque<Span>, Map<String, String>> threadInfoToLink
    ); static ListenableFutureCallback<T> listenableFutureCallbackWithTracing(
        ListenableFutureCallback<T> listenableFutureCallback,
        Deque<Span> spanStackToLink,
        Map<String, String> mdcContextMapToLink
    );  }
@Test public void createTracingEnabledRestTemplate_no_args_returns_RestTemplate_with_wingtips_interceptor_added_with_expected_fields() { RestTemplate result = WingtipsSpringUtil.createTracingEnabledRestTemplate(); assertThat(result.getInterceptors()).hasSize(1); assertThat(result.getInterceptors().get(0)).isInstanceOf(WingtipsClientHttpRequestInterceptor.class); verifyInterceptorFieldValues( result.getInterceptors().get(0), true, ZipkinHttpTagStrategy.getDefaultInstance(), SpringHttpClientTagAdapter.getDefaultInstance() ); }
@DataProvider(value = { "true", "false" }) @Test public void createTracingEnabledRestTemplate_single_arg_returns_RestTemplate_with_wingtips_interceptor_added_with_expected_fields( boolean subspanOptionOn ) { RestTemplate result = WingtipsSpringUtil.createTracingEnabledRestTemplate(subspanOptionOn); assertThat(result.getInterceptors()).hasSize(1); assertThat(result.getInterceptors().get(0)).isInstanceOf(WingtipsClientHttpRequestInterceptor.class); verifyInterceptorFieldValues( result.getInterceptors().get(0), subspanOptionOn, ZipkinHttpTagStrategy.getDefaultInstance(), SpringHttpClientTagAdapter.getDefaultInstance() ); }
@DataProvider(value = { "true", "false" }) @Test public void createTracingEnabledRestTemplate_with_tag_and_span_naming_args_returns_RestTemplate_with_wingtips_interceptor_added_with_expected_fields( boolean subspanOptionOn ) { RestTemplate result = WingtipsSpringUtil.createTracingEnabledRestTemplate( subspanOptionOn, tagStrategyMock, tagAdapterMock ); assertThat(result.getInterceptors()).hasSize(1); assertThat(result.getInterceptors().get(0)).isInstanceOf(WingtipsClientHttpRequestInterceptor.class); verifyInterceptorFieldValues( result.getInterceptors().get(0), subspanOptionOn, tagStrategyMock, tagAdapterMock ); }
@DataProvider(value = { "NULL_STRATEGY_ARG", "NULL_ADAPTER_ARG" }) @Test public void createTracingEnabledRestTemplate_with_tag_and_span_naming_args_throws_IllegalArgumentException_if_passed_null_args( NullConstructorArgsScenario scenario ) { Throwable ex = catchThrowable( () -> WingtipsSpringUtil.createTracingEnabledRestTemplate(true, scenario.strategy, scenario.adapter) ); assertThat(ex) .isInstanceOf(IllegalArgumentException.class) .hasMessage(scenario.expectedExceptionMessage); }