HttpClientParser
, HttpServerParser
public class HttpParser
extends java.lang.Object
Constructor | Description |
---|---|
HttpParser() |
Modifier and Type | Method | Description |
---|---|---|
protected void |
error(java.lang.Integer httpStatus,
java.lang.Throwable error,
SpanCustomizer customizer) |
Override to change what data from the http error are parsed into the span modeling it.
|
protected ErrorParser |
errorParser() |
Override when making custom types.
|
<Req> void |
request(HttpAdapter<Req,?> adapter,
Req req,
SpanCustomizer customizer) |
Override to change what data from the http request are parsed into the span representing it.
|
<Resp> void |
response(HttpAdapter<?,Resp> adapter,
Resp res,
java.lang.Throwable error,
SpanCustomizer customizer) |
Override to change what data from the http response or error are parsed into the span modeling
it.
|
protected <Req> java.lang.String |
spanName(HttpAdapter<Req,?> adapter,
Req req) |
Returns the span name of the request.
|
protected ErrorParser errorParser()
Tracing.errorParser()
{@code class MyHttpClientParser extends HttpClientParser { ErrorParser errorParser; MyHttpClientParser(Tracing tracing) { errorParser = tracing.errorParser(); } protected ErrorParser errorParser() { return errorParser; } --snip-- }
public <Req> void request(HttpAdapter<Req,?> adapter, Req req, SpanCustomizer customizer)
If you only want to change the span name, you can override spanName(HttpAdapter,
Object)
instead.
spanName(HttpAdapter, Object)
protected <Req> java.lang.String spanName(HttpAdapter<Req,?> adapter, Req req)
public <Resp> void response(HttpAdapter<?,Resp> adapter, @Nullable Resp res, @Nullable java.lang.Throwable error, SpanCustomizer customizer)
By default, this tags "http.status_code" when it is not 2xx. If there's an exception or the
status code is neither 2xx nor 3xx, it tags "error". This also overrides the span name based on
the HttpAdapter.methodFromResponse(Object)
and HttpAdapter.route(Object)
where
possible (ex "get /users/:userId").
If routing is supported, and a GET didn't match due to 404, the span name will be "get not_found". If it didn't match due to redirect, the span name will be "get redirected". If routing is not supported, the span name is left alone.
If you only want to change how exceptions are parsed, override error(Integer,
Throwable, SpanCustomizer)
instead.
Note: Either the response or error parameters may be null, but not both.
protected void error(@Nullable java.lang.Integer httpStatus, @Nullable java.lang.Throwable error, SpanCustomizer customizer)
Note: Either the httpStatus or error parameters may be null, but not both
Conventionally associated with the tag key "error"
Copyright © 2018 OpenZipkin. All rights reserved.