@Override protected void doHandleRequestTagging(@NotNull Span span, @NotNull HttpRequest request) { tagAndNamingStrategy.handleRequestTagging(span, request, tagAndNamingAdapter); }
@Override public void doHandleRequestTagging( @NotNull Span span, @NotNull RequestInfo<?> request ) { tagAndNamingStrategy.handleRequestTagging(span, request, tagAndNamingAdapter); }
@Override public void doHandleRequestTagging( @NotNull Span span, @NotNull RequestInfo<?> request ) { tagAndNamingStrategy.handleRequestTagging(span, request, tagAndNamingAdapter); }
@Override public void doHandleRequestTagging( @NotNull Span span, @NotNull RequestBuilderWrapper request ) { tagAndNamingStrategy.handleRequestTagging(span, request, tagAndNamingAdapter); }
@Override protected void doHandleRequestTagging(@NotNull Span span, @NotNull HttpRequest request) { tagAndNamingStrategy.handleRequestTagging(span, request, tagAndNamingAdapter); }
@Test public void handleRequestTagging_does_nothing_if_delegate_method_throws_exception() { // given doThrow(new RuntimeException("boom")) .when(implSpy).doHandleRequestTagging(any(Span.class), anyObject(), any(HttpTagAndSpanNamingAdapter.class)); // when implSpy.handleRequestTagging(spanMock, requestObjectMock, adapterMock); // then verify(implSpy).doHandleRequestTagging(spanMock, requestObjectMock, adapterMock); verifyNoMoreInteractions(implSpy); verifyZeroInteractions(spanMock, requestObjectMock, adapterMock); }
@Test public void handleRequestTagging_defers_to_doHandleRequestTagging() { // given doNothing().when(implSpy).doHandleRequestTagging( any(Span.class), anyObject(), any(HttpTagAndSpanNamingAdapter.class) ); // when implSpy.handleRequestTagging(spanMock, requestObjectMock, adapterMock); // then verify(implSpy).doHandleRequestTagging(spanMock, requestObjectMock, adapterMock); verifyNoMoreInteractions(implSpy); verifyZeroInteractions(spanMock, requestObjectMock, adapterMock); }
@DataProvider(value = { "SPAN_IS_NULL", "REQUEST_OBJ_IS_NULL", "ADAPTER_IS_NULL", }, splitBy = "\\|") @Test @SuppressWarnings("ConstantConditions") public void handleRequestTagging_does_nothing_in_null_arg_corner_cases(NullArgCornerCaseScenario scenario) { // given Span spanMock = scenario.spanMock; Object requestObjectMock = scenario.requestObjMock; HttpTagAndSpanNamingAdapter<Object, Object> adapterMock = scenario.adapterMock; // when implSpy.handleRequestTagging(spanMock, requestObjectMock, adapterMock); // then verifyZeroInteractions(implSpy); if (spanMock != null) { verifyZeroInteractions(spanMock); } if (requestObjectMock != null) { verifyZeroInteractions(requestObjectMock); } if (adapterMock != null) { verifyZeroInteractions(adapterMock); } }
@Override public void process(HttpRequest request, HttpContext context) { Tracer tracer = Tracer.getInstance(); if (surroundCallsWithSubspan) { // Will start a new trace if necessary, or a subspan if a trace is already in progress. Span spanToClose = tracer.startSpanInCurrentContext( getSubspanSpanName(request, tagAndNamingStrategy, tagAndNamingAdapter), Span.SpanPurpose.CLIENT ); tagAndNamingStrategy.handleRequestTagging(spanToClose, request, tagAndNamingAdapter); // Add the subspan to the HttpContext so that the response interceptor can retrieve and close it. context.setAttribute(SPAN_TO_CLOSE_HTTP_CONTEXT_ATTR_KEY, spanToClose); } propagateTracingHeaders(request, tracer.getCurrentSpan()); }
Throwable errorForTagging = null; try { tagAndNamingStrategy.handleRequestTagging(spanAroundCall, request, tagAndNamingAdapter); response = propagateHeadersAndExecute(route, request, clientContext, execAware); return response;
ClientHttpResponse response = null; try { tagAndNamingStrategy.handleRequestTagging(spanAroundCall, wrapperRequest, tagAndNamingAdapter); response = propagateTracingHeadersAndExecuteRequest(wrapperRequest, body, execution);
ClientHttpResponse response = null; try { tagAndNamingStrategy.handleRequestTagging(spanAroundCall, wrapperRequest, tagAndNamingAdapter); response = propagateTracingHeadersAndExecuteRequest(wrapperRequest, body, execution);
Throwable errorForTagging = null; try { tagAndNamingStrategy.handleRequestTagging(overallRequestSpan, request, tagAndNamingAdapter); filterChain.doFilter(request, response); } catch(Throwable t) {
tagAndNamingStrategy.handleRequestTagging(subspan, wrapperRequest, tagAndNamingAdapter);
tagAndNamingStrategy.handleRequestTagging(subspan, wrapperRequest, tagAndNamingAdapter);