Package brave.http

Class HttpServerHandler<Req,​Resp>

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

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

This is an example of synchronous instrumentation:


 Span span = handler.handleReceive(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.handleSend(response, error, span);
 }
 
Since:
4.3