@DataProvider(value = { "/some/http/route | /some/spring/pattern | /some/http/route", "/some/http/route | null | /some/http/route", "/some/http/route | | /some/http/route", "/some/http/route | [whitespace] | /some/http/route", "null | /some/spring/pattern | /some/spring/pattern", " | /some/spring/pattern | /some/spring/pattern", "[whitespace] | /some/spring/pattern | /some/spring/pattern", "null | null | null", " | | null", "[whitespace] | [whitespace] | null", }, splitBy = "\\|") @Test public void getRequestUriPathTemplate_works_as_expected( String httpRouteRequestAttr, String springMatchingPatternRequestAttr, String expectedResult ) { if ("[whitespace]".equals(httpRouteRequestAttr)) { httpRouteRequestAttr = " \t\r\n "; } if ("[whitespace]".equals(springMatchingPatternRequestAttr)) { springMatchingPatternRequestAttr = " \t\r\n "; } doReturn(httpRouteRequestAttr).when(requestMock).getAttribute(KnownZipkinTags.HTTP_ROUTE); doReturn(springMatchingPatternRequestAttr) .when(requestMock).getAttribute("org.springframework.web.servlet.HandlerMapping.bestMatchingPattern"); String result = adapterSpy.getRequestUriPathTemplate(requestMock, responseMock); assertThat(result).isEqualTo(expectedResult); }
@Override public @Nullable String getRequestUriPathTemplate( @Nullable HttpServletRequest request, @Nullable HttpServletResponse response ) { return HttpSpanFactory.determineUriPathTemplate(request); }
ServletRequestTagAdapter extends HttpTagAndSpanNamingAdapter<HttpServletRequest, HttpServletResponse> { @Override public @Nullable String getRequestUriPathTemplate( @Nullable HttpServletRequest request, @Nullable HttpServletResponse response ) { return HttpSpanFactory.determineUriPathTemplate(request); } }
ServletRequestTagAdapter extends HttpTagAndSpanNamingAdapter<HttpServletRequest, HttpServletResponse> { @Override public @Nullable String getRequestUriPathTemplate( @Nullable HttpServletRequest request, @Nullable HttpServletResponse response ) { return HttpSpanFactory.determineUriPathTemplate(request); }  }
ServletRequestTagAdapter extends HttpTagAndSpanNamingAdapter<HttpServletRequest, HttpServletResponse> { @Override public @Nullable String getRequestUriPathTemplate( @Nullable HttpServletRequest request, @Nullable HttpServletResponse response ) { return HttpSpanFactory.determineUriPathTemplate(request); }  @SuppressWarnings("unchecked") static ServletRequestTagAdapter getDefaultInstance(); @Override @Nullable String getErrorResponseTagValue(@Nullable HttpServletResponse response); @Override @Nullable String getRequestUrl(@Nullable HttpServletRequest request); @Override @Nullable Integer getResponseHttpStatus(@Nullable HttpServletResponse response); @Override @Nullable String getRequestHttpMethod(@Nullable HttpServletRequest request); @Override @Nullable String getRequestPath(@Nullable HttpServletRequest request); @Override @Nullable String getRequestUriPathTemplate(
        @Nullable HttpServletRequest request,
        @Nullable HttpServletResponse response
    ); @Override @Nullable String getHeaderSingleValue(@Nullable HttpServletRequest request, @NotNull String headerKey); @Override @Nullable List<String> getHeaderMultipleValue(
        @Nullable HttpServletRequest request, @NotNull String headerKey
    ); @Override @Nullable String getSpanHandlerTagValue(
        @Nullable HttpServletRequest request, @Nullable HttpServletResponse response
    ); }
ServletRequestTagAdapter extends HttpTagAndSpanNamingAdapter<HttpServletRequest, HttpServletResponse> { @Override public @Nullable String getRequestUriPathTemplate( @Nullable HttpServletRequest request, @Nullable HttpServletResponse response ) { return HttpSpanFactory.determineUriPathTemplate(request); }  @SuppressWarnings("unchecked") static ServletRequestTagAdapter getDefaultInstance(); @Override @Nullable String getErrorResponseTagValue(@Nullable HttpServletResponse response); @Override @Nullable String getRequestUrl(@Nullable HttpServletRequest request); @Override @Nullable Integer getResponseHttpStatus(@Nullable HttpServletResponse response); @Override @Nullable String getRequestHttpMethod(@Nullable HttpServletRequest request); @Override @Nullable String getRequestPath(@Nullable HttpServletRequest request); @Override @Nullable String getRequestUriPathTemplate(
        @Nullable HttpServletRequest request,
        @Nullable HttpServletResponse response
    ); @Override @Nullable String getHeaderSingleValue(@Nullable HttpServletRequest request, @NotNull String headerKey); @Override @Nullable List<String> getHeaderMultipleValue(
        @Nullable HttpServletRequest request, @NotNull String headerKey
    ); @Override @Nullable String getSpanHandlerTagValue(
        @Nullable HttpServletRequest request, @Nullable HttpServletResponse response
    );  }