Package brave.http

Class HttpResponse

    • Method Detail

      • request

        @Nullable
        public HttpRequest request()
        The request that initiated this HTTP response or null 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().

        Overrides:
        request in class Response
        Since:
        5.10
      • method

        @Nullable
        public String method()
        Returns the HTTP method of the request that caused this response or null if unreadable.

        Note: This value may be present even when request() is null, but implementations should implement request() 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 or null if unreadable.

        Note: This value may be present even when request() is null, but implementations should implement request() 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, unless Tracing.Builder.clock(Clock) uses the same implementation.

        Since:
        5.10
        See Also:
        HttpRequest.startTimestamp(), Span.finish(long), Tracing.clock(TraceContext)