Class Response
public abstract class Response extends Object
No extensions outside Brave
While this is an abstract type, it should not be subclassed outside the Brave repository. In other words, subtypes are sealed within this source tree.- Since:
- 5.10
- See Also:
Request
-
Constructor Summary
Constructors Modifier Constructor Description protectedResponse() -
Method Summary
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.
-
Constructor Details
-
Response
protected Response()
-
-
Method Details
-
spanKind
The remoteSpan.Kinddescribing the direction and type of the response. -
request
The request that initiated this response ornullif unknown.Implementations should return the last wire-level request that caused this response or error.
-
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
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
-
toString
-