RequestTracingFilter implements Filter { protected String getInitialSpanName( HttpServletRequest request, HttpTagAndSpanNamingStrategy<HttpServletRequest, ?> namingStrategy, HttpTagAndSpanNamingAdapter<HttpServletRequest, ?> adapter ) { String spanNameFromStrategy = namingStrategy.getInitialSpanName(request, adapter); if (StringUtils.isNotBlank(spanNameFromStrategy)) { return spanNameFromStrategy; } return HttpSpanFactory.getSpanName(request); }  @Override @SuppressWarnings("RedundantThrows") void init(FilterConfig filterConfig); @Override void destroy(); @Override void doFilter(ServletRequest request,
                         ServletResponse response,
                         FilterChain filterChain); static final String FILTER_HAS_ALREADY_EXECUTED_ATTRIBUTE; @Deprecated
    static final String ERROR_REQUEST_URI_ATTRIBUTE; static final String USER_ID_HEADER_KEYS_LIST_INIT_PARAM_NAME; static final String TAG_AND_SPAN_NAMING_STRATEGY_INIT_PARAM_NAME; static final String TAG_AND_SPAN_NAMING_ADAPTER_INIT_PARAM_NAME; }
@DataProvider(value = { "someStrategyName | GET | /some/http/route | someStrategyName", "null | GET | /some/http/route | GET /some/http/route", " | GET | /some/http/route | GET /some/http/route", "[whitespace] | GET | /some/http/route | GET /some/http/route", "null | null | /some/http/route | UNKNOWN_HTTP_METHOD /some/http/route", "null | null | null | UNKNOWN_HTTP_METHOD" }, splitBy = "\\|") @Test public void getInitialSpanName_works_as_expected( String strategyResult, String httpMethod, String httpRoute, String expectedResult ) { RequestTracingFilter filter = getBasicFilter(); if ("[whitespace]".equals(strategyResult)) { strategyResult = " \t\r\n "; } initialSpanNameFromStrategy.set(strategyResult); doReturn(httpMethod).when(requestMock).getMethod(); doReturn(httpRoute).when(requestMock).getAttribute(KnownZipkinTags.HTTP_ROUTE); String result = filter.getInitialSpanName(requestMock, tagAndNamingStrategy, tagAndNamingAdapterMock); assertThat(result).isEqualTo(expectedResult); assertThat(strategyInitialSpanNameMethodCalled.get()).isTrue(); strategyInitialSpanNameArgs.get().verifyArgs(requestMock, tagAndNamingAdapterMock); }