Package brave.http

Class HttpClientHandler<Req,​Resp>

java.lang.Object
brave.http.HttpClientHandler<Req,​Resp>
Type Parameters:
Req - the native http request type of the client.
Resp - the native http response type of the client.

public final class HttpClientHandler<Req,​Resp>
extends Object
This standardizes a way to instrument http clients, particularly in a way that encourages use of portable customizations via HttpClientParser.

This is an example of synchronous instrumentation:


 Span span = handler.handleSend(request);
 Throwable error = null;
 try (Tracer.SpanInScope ws = tracer.withSpanInScope(span)) {
   // any downstream code can see Tracer.currentSpan() or use Tracer.currentSpanCustomizer()
   response = invoke(request);
 } catch (RuntimeException | Error e) {
   error = e;
   throw e;
 } finally {
   handler.handleReceive(response, error, span);
 }
 
Since:
4.3