Package brave.http
Interface HttpResponseParser
- All Known Implementing Classes:
HttpResponseParser.Default
public interface HttpResponseParser
Use this to control the response data recorded for an
sampled
HTTP client or server span.
Here's an example that adds all HTTP status codes, not just the error ones.
httpTracing = httpTracing.toBuilder()
.clientResponseParser((response, context, span) -> {
HttpResponseParser.DEFAULT.parse(response, context, span);
int statusCode = response != null ? response.statusCode() : 0;
if (statusCode > 0) span.tag("http.status_code", String.valueOf(statusCode));
}).build();
- See Also:
HttpRequestParser
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classHttpResponseParser.DefaultThe default data policy sets the span name to the HTTP route when available, and sets the and adds the "http.status_code" and "error" tags. -
Field Summary
Fields Modifier and Type Field Description static HttpResponseParserDEFAULT -
Method Summary
Modifier and Type Method Description voidparse(HttpResponse response, TraceContext context, SpanCustomizer span)Implement to choose what data from the http response are parsed into the span representing it.
-
Field Details
-
Method Details
-
parse
Implement to choose what data from the http response are parsed into the span representing it.Note: This is called after
Span.error(Throwable), which means any "error" tag set here will overwrite what the error parser set.- See Also:
HttpResponseParser.Default
-