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
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
HttpRequestParser.Default
The default data policy sets the span name to the HTTP method and adds the "http.method" and "http.path" tags. -
Field Summary
Fields Modifier and Type Field Description static HttpRequestParser
DEFAULT
-
Method Summary
Modifier and Type Method Description void
parse(HttpRequest request, TraceContext context, SpanCustomizer span)
Implement to choose what data from the http request are parsed into the span representing it.
-
Field Details
-
Method Details
-
parse
Implement to choose what data from the http request are parsed into the span representing it.- See Also:
HttpRequestParser.Default
-