Skip to content

Commit

Permalink
Removes obviated nextClientSpan as no longer needed (openzipkin#1002)
Browse files Browse the repository at this point in the history
  • Loading branch information
adriancole committed Oct 2, 2019
1 parent 36943e7 commit d09d28b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import brave.propagation.TraceContext.Injector;
import brave.sampler.Sampler;
import brave.sampler.SamplerFunction;
import brave.sampler.SamplerFunctions;

/**
* This standardizes a way to instrument http clients, particularly in a way that encourages use of
Expand Down Expand Up @@ -99,7 +98,7 @@ public static <Req, Resp> HttpClientHandler<Req, Resp> create(HttpTracing httpTr
*/
public Span handleSend(HttpClientRequest request) {
if (request == null) throw new NullPointerException("request == null");
return handleSend(request, nextClientSpan(request));
return handleSend(request, tracer.nextSpan(httpSampler, request));
}

/**
Expand Down Expand Up @@ -157,7 +156,7 @@ public Span handleSend(HttpClientRequest request, Span span) {

/**
* @since 4.4
* @deprecated since 5.8 use {@link #nextClientSpan(HttpClientRequest)}
* @deprecated since 5.8 use {@link Tracer#nextSpan(SamplerFunction, Object)}
*/
@Deprecated public Span nextSpan(Req request) {
// nextSpan can be called independently when interceptors control lifecycle directly. In these
Expand All @@ -168,19 +167,7 @@ public Span handleSend(HttpClientRequest request, Span span) {
} else {
clientRequest = new HttpClientRequest.FromHttpAdapter<>(adapter, request);
}
return nextClientSpan(clientRequest);
}

/**
* Creates a potentially noop span representing this request. This is used when you need to
* provision a span in a different scope than where the request is executed.
*
* @since 5.8
*/
// Renamed to avoid generics clash when <Req> is HttpClientRequest.
public Span nextClientSpan(HttpClientRequest request) {
if (request == null) throw new NullPointerException("request == null");
return tracer.nextSpan(httpSampler, request);
return tracer.nextSpan(httpSampler, clientRequest);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public class HttpClientHandlerTest {
@Test public void nextSpan_samplerSeesUnwrappedType_oldHandler() {
when(sampler.trySample(defaultRequest)).thenReturn(null);

handler.nextClientSpan(defaultRequest);
handler.nextSpan(defaultRequest);

verify(sampler).trySample(defaultRequest);
}
Expand Down

0 comments on commit d09d28b

Please sign in to comment.