Package brave.rpc

Class RpcResponse

    • Constructor Detail

      • RpcResponse

        public RpcResponse()
    • Method Detail

      • request

        @Nullable
        public RpcRequest request()
        The request that initiated this RPC response or null if unknown.
        Overrides:
        request in class brave.Response
        Since:
        5.12
      • errorCode

        @Nullable
        public abstract String errorCode()
        Returns the shortest human readable error code name. Ex. {code io.grpc.Status.Code.name()} may return "CANCELLED".

        Conventionally, this is used as the "error" tag and optionally tagged separately as "rpc.error_code".

        Notes

        This is not a success code. On success, return null. Do not return "OK" or similar as it will interfere with error interpretation.

        When only a boolean value is available, this should return empty string ("") on true and null on false.

        When an error code has both a numeric and text label, return the text.

        Since:
        5.12
      • 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.12
        See Also:
        RpcRequest.startTimestamp(), Span.finish(long), Tracing.clock(TraceContext)