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 protected
Response()
-
Method Summary
Modifier and Type Method Description abstract Throwable
error()
The error raised during response processing ornull
if there was none.Request
request()
The request that initiated this response ornull
if unknown.abstract Span.Kind
spanKind()
The remoteSpan.Kind
describing the direction and type of the response.String
toString()
abstract Object
unwrap()
Returns the underlying response object ornull
if there is none.
-
Constructor Details
-
Response
protected Response()
-
-
Method Details
-
spanKind
The remoteSpan.Kind
describing the direction and type of the response. -
request
The request that initiated this response ornull
if unknown.Implementations should return the last wire-level request that caused this response or error.
-
error
The error raised during response processing ornull
if 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 anySpanHandler
to 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 ornull
if 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
-