Class Response
- java.lang.Object
-
- brave.Response
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Response()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods 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.
-
-
-
Method Detail
-
spanKind
public abstract Span.Kind spanKind()
The remoteSpan.Kind
describing the direction and type of the response.
-
request
@Nullable public Request 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
@Nullable public abstract Throwable 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
@Nullable public abstract Object 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
-
-