Class HttpResponse
- java.lang.Object
-
- brave.Response
-
- brave.http.HttpResponse
-
- Direct Known Subclasses:
HttpClientResponse
,HttpServerResponse
public abstract class HttpResponse extends Response
Abstract response type used for parsing and sampling of http clients and servers.- Since:
- 5.10
- See Also:
HttpClientResponse
,HttpServerResponse
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description long
finishTimestamp()
The timestamp in epoch microseconds of the end of this request or zero to take this implicitly from the current clock.String
method()
Returns the HTTP method of the request that caused this response ornull
if unreadable.HttpRequest
request()
The request that initiated this HTTP response ornull
if unknown.String
route()
Returns the HTTP route of the request that caused this response ornull
if unreadable.abstract int
statusCode()
The HTTP status code or zero if unreadable.
-
-
-
Method Detail
-
request
@Nullable public HttpRequest request()
The request that initiated this HTTP response ornull
if unknown.Implementations should return the last wire-level request that caused this response or error. HTTP properties like path and headers might be different, due to redirects or authentication. Some properties might not be visible until response processing, notably
route()
.
-
method
@Nullable public String method()
Returns the HTTP method of the request that caused this response ornull
if unreadable.Note: This value may be present even when
request()
isnull
, but implementations should implementrequest()
when possible.- Since:
- 5.10
- See Also:
HttpRequest.method()
-
route
@Nullable public String route()
Returns the HTTP route of the request that caused this response ornull
if unreadable.Note: This value may be present even when
request()
isnull
, but implementations should implementrequest()
when possible.- Since:
- 5.10
- See Also:
HttpRequest.route()
-
statusCode
public abstract int statusCode()
The HTTP status code or zero if unreadable.Conventionally associated with the key "http.status_code"
- Since:
- 5.10
-
finishTimestamp
public long finishTimestamp()
The timestamp in epoch microseconds of the end of this request or zero to take this implicitly from the current clock. Defaults to zero.This is helpful in two scenarios: late parsing and avoiding redundant timestamp overhead. For example, you can asynchronously handle span completion without losing precision of the actual end.
Note: Overriding has the same problems as using
Span.finish(long)
. For example, it can result in negative duration if the clock used is allowed to correct backwards. It can also result in misalignments in the trace, unlessTracing.Builder.clock(Clock)
uses the same implementation.- Since:
- 5.10
- See Also:
HttpRequest.startTimestamp()
,Span.finish(long)
,Tracing.clock(TraceContext)
-
-