SpringWebfluxClientRequestZipkinTagStrategy extends ZipkinHttpTagStrategy<ClientRequest, ClientResponse> { @Override protected void doHandleRequestTagging( @NotNull Span span, @NotNull ClientRequest request, @NotNull HttpTagAndSpanNamingAdapter<ClientRequest, ?> adapter ) { super.doHandleRequestTagging(span, request, adapter); putTagIfValueIsNotBlank(span, SPRING_LOG_ID_TAG_KEY, request.logPrefix().trim()); }  static SpringWebfluxClientRequestZipkinTagStrategy getDefaultInstance(); static final String SPRING_LOG_ID_TAG_KEY; }
@UseDataProvider("logPrefixScenarioDataProvider") @Test public void doHandleRequestTagging_adds_expected_zipkin_tags_and_spring_log_prefix_tag( LogPrefixScenario scenario ) { SpringWebfluxClientRequestZipkinTagStrategy impl = new SpringWebfluxClientRequestZipkinTagStrategy(); Span span = Span.newBuilder("fooSpan", SpanPurpose.CLIENT).build(); ClientRequest requestMock = mock(ClientRequest.class); @SuppressWarnings("unchecked") HttpTagAndSpanNamingAdapter<ClientRequest, ?> adapterMock = mock(HttpTagAndSpanNamingAdapter.class); String httpMethod = UUID.randomUUID().toString(); String path = UUID.randomUUID().toString(); String url = UUID.randomUUID().toString(); String pathTemplate = UUID.randomUUID().toString(); doReturn(httpMethod).when(adapterMock).getRequestHttpMethod(requestMock); doReturn(path).when(adapterMock).getRequestPath(requestMock); doReturn(url).when(adapterMock).getRequestUrl(requestMock); doReturn(pathTemplate).when(adapterMock).getRequestUriPathTemplate(requestMock, null); doReturn(scenario.logPrefix).when(requestMock).logPrefix(); impl.doHandleRequestTagging(span, requestMock, adapterMock); assertThat(span.getTags().get(KnownZipkinTags.HTTP_METHOD)).isEqualTo(httpMethod); assertThat(span.getTags().get(KnownZipkinTags.HTTP_PATH)).isEqualTo(path); assertThat(span.getTags().get(KnownZipkinTags.HTTP_URL)).isEqualTo(url); assertThat(span.getTags().get(KnownZipkinTags.HTTP_ROUTE)).isEqualTo(pathTemplate); assertThat(span.getTags().get(SPRING_LOG_ID_TAG_KEY)).isEqualTo(scenario.expectedTagValue); }