Package brave.http

Interface HttpRequestParser

  • All Known Implementing Classes:
    HttpRequestParser.Default

    public interface HttpRequestParser
    Use this to control the request data recorded for an sampled HTTP client or server span.

    Here's an example that changes the span name and records the HTTP url instead of the path.

    
     httpTracing = httpTracing.toBuilder()
       .clientRequestParser((req, context, span) -> {
         String method = req.method();
         if (method != null) span.name(method);
         HttpTags.URL.tag(req, context, span); // the whole url, not just the path
       }).build();
     

    Note: This type is safe to implement as a lambda, or use as a method reference as it is effectively a FunctionalInterface. It isn't annotated as such because the project has a minimum Java language level 6.

    Since:
    5.10
    See Also:
    HttpResponseParser