@Test public void generateSafeSpanName_adapter_args_works_as_expected_if_passed_null_adapter() { Object requestMock = mock(Object.class); Object responseMock = mock(Object.class); String result = HttpRequestTracingUtils.generateSafeSpanName(requestMock, responseMock, null); assertThat(result).isEqualTo("UNKNOWN_HTTP_METHOD"); verifyZeroInteractions(requestMock, responseMock); }
@SuppressWarnings("ConstantConditions") public static @NotNull <REQ, RES> String generateSafeSpanName( @Nullable REQ request, @Nullable RES response, @NotNull HttpTagAndSpanNamingAdapter<REQ, RES> adapter ) { String httpMethod = (adapter == null) ? null : adapter.getRequestHttpMethod(request); String pathTemplate = (adapter == null) ? null : adapter.getRequestUriPathTemplate(request, response); Integer responseStatusCode = (adapter == null) ? null : adapter.getResponseHttpStatus(response); return generateSafeSpanName(httpMethod, pathTemplate, responseStatusCode); }
HttpRequestTracingUtils { @SuppressWarnings("ConstantConditions") public static @NotNull <REQ, RES> String generateSafeSpanName( @Nullable REQ request, @Nullable RES response, @NotNull HttpTagAndSpanNamingAdapter<REQ, RES> adapter ) { String httpMethod = (adapter == null) ? null : adapter.getRequestHttpMethod(request); String pathTemplate = (adapter == null) ? null : adapter.getRequestUriPathTemplate(request, response); Integer responseStatusCode = (adapter == null) ? null : adapter.getResponseHttpStatus(response); return generateSafeSpanName(httpMethod, pathTemplate, responseStatusCode); } }
HttpRequestTracingUtils { @SuppressWarnings("ConstantConditions") public static @NotNull <REQ, RES> String generateSafeSpanName( @Nullable REQ request, @Nullable RES response, @NotNull HttpTagAndSpanNamingAdapter<REQ, RES> adapter ) { String httpMethod = (adapter == null) ? null : adapter.getRequestHttpMethod(request); String pathTemplate = (adapter == null) ? null : adapter.getRequestUriPathTemplate(request, response); Integer responseStatusCode = (adapter == null) ? null : adapter.getResponseHttpStatus(response); return generateSafeSpanName(httpMethod, pathTemplate, responseStatusCode); } private  HttpRequestTracingUtils(); }
HttpRequestTracingUtils { @SuppressWarnings("ConstantConditions") public static @NotNull <REQ, RES> String generateSafeSpanName( @Nullable REQ request, @Nullable RES response, @NotNull HttpTagAndSpanNamingAdapter<REQ, RES> adapter ) { String httpMethod = (adapter == null) ? null : adapter.getRequestHttpMethod(request); String pathTemplate = (adapter == null) ? null : adapter.getRequestUriPathTemplate(request, response); Integer responseStatusCode = (adapter == null) ? null : adapter.getResponseHttpStatus(response); return generateSafeSpanName(httpMethod, pathTemplate, responseStatusCode); } private  HttpRequestTracingUtils(); static Span fromRequestWithHeaders(RequestWithHeaders request, List<String> userIdHeaderKeys); static boolean hasInvalidSpanIdBecauseCallerDidNotSendOne(Span span); static boolean hasInvalidParentIdBecauseCallerDidNotSendSpanId(Span span); static String getUserIdFromRequestWithHeaders(RequestWithHeaders request, List<String> userIdHeaderKeys); static void propagateTracingHeaders(HttpObjectForPropagation httpObjectForPropagation, Span span); static String convertSampleableBooleanToExpectedB3Value(boolean sampleable); @SuppressWarnings("ConstantConditions") static @NotNull String generateSafeSpanName(
        @Nullable REQ request,
        @Nullable RES response,
        @NotNull HttpTagAndSpanNamingAdapter<REQ, RES> adapter
    ); static @NotNull String generateSafeSpanName(
        @Nullable String requestHttpMethod,
        @Nullable String pathTemplate,
        @Nullable Integer responseStatusCode
    ); static @NotNull String getFallbackSpanNameForHttpRequest(
        @Nullable String prefix,
        @Nullable String httpMethod
    ); }
HttpRequestTracingUtils { @SuppressWarnings("ConstantConditions") public static @NotNull <REQ, RES> String generateSafeSpanName( @Nullable REQ request, @Nullable RES response, @NotNull HttpTagAndSpanNamingAdapter<REQ, RES> adapter ) { String httpMethod = (adapter == null) ? null : adapter.getRequestHttpMethod(request); String pathTemplate = (adapter == null) ? null : adapter.getRequestUriPathTemplate(request, response); Integer responseStatusCode = (adapter == null) ? null : adapter.getResponseHttpStatus(response); return generateSafeSpanName(httpMethod, pathTemplate, responseStatusCode); } private  HttpRequestTracingUtils(); static Span fromRequestWithHeaders(RequestWithHeaders request, List<String> userIdHeaderKeys); static boolean hasInvalidSpanIdBecauseCallerDidNotSendOne(Span span); static boolean hasInvalidParentIdBecauseCallerDidNotSendSpanId(Span span); static String getUserIdFromRequestWithHeaders(RequestWithHeaders request, List<String> userIdHeaderKeys); static void propagateTracingHeaders(HttpObjectForPropagation httpObjectForPropagation, Span span); static String convertSampleableBooleanToExpectedB3Value(boolean sampleable); @SuppressWarnings("ConstantConditions") static @NotNull String generateSafeSpanName(
        @Nullable REQ request,
        @Nullable RES response,
        @NotNull HttpTagAndSpanNamingAdapter<REQ, RES> adapter
    ); static @NotNull String generateSafeSpanName(
        @Nullable String requestHttpMethod,
        @Nullable String pathTemplate,
        @Nullable Integer responseStatusCode
    ); static @NotNull String getFallbackSpanNameForHttpRequest(
        @Nullable String prefix,
        @Nullable String httpMethod
    ); static final String UNSPECIFIED_SPAN_NAME; static final String SPAN_FROM_HEADERS_WHERE_CALLER_DID_NOT_SEND_SPAN_ID_TAG_KEY; static final String CHILD_OF_SPAN_FROM_HEADERS_WHERE_CALLER_DID_NOT_SEND_SPAN_ID_TAG_KEY; }