Class Response
- java.lang.Object
-
- brave.Response
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedResponse()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Throwableerror()The error raised during response processing ornullif there was none.Requestrequest()The request that initiated this response ornullif unknown.abstract Span.KindspanKind()The remoteSpan.Kinddescribing the direction and type of the response.StringtoString()abstract Objectunwrap()Returns the underlying response object ornullif there is none.
-
-
-
Method Detail
-
spanKind
public abstract Span.Kind spanKind()
The remoteSpan.Kinddescribing the direction and type of the response.
-
request
@Nullable public Request request()
The request that initiated this response ornullif unknown.Implementations should return the last wire-level request that caused this response or error.
-
error
@Nullable public abstract Throwable error()
The error raised during response processing ornullif there was none.Lack of throwable,
null, does not mean success. For example, in HTTP, there could be a 409 status code with no corresponding Java exception.Handling errors
Handlers invokeSpan.error(Throwable)prior to passing control to user-defined response parsers. This allows anySpanHandlerto see the raw error viaMutableSpan.error(), in case of export to a non-Zipkin backend such as metrics.User-defined parsers can take any error here into consideration when deriving a
"error" tag. For example, if they prefer defaults, they do nothing. If they have a better error tag value than what would be derived from theThrowable, they can overwrite it.
-
unwrap
@Nullable public abstract Object unwrap()
Returns the underlying response object ornullif there is none. Here are some response objects:org.apache.http.HttpResponse,org.apache.dubbo.rpc.Result,org.apache.kafka.clients.producer.RecordMetadata.Note: Some implementations are composed of multiple types, such as a response and matched route of the server. Moreover, an implementation may change the type returned due to refactoring. Unless you control the implementation, cast carefully (ex using
instanceof) instead of presuming a specific type will always be returned.- Since:
- 5.10
-
-