Package brave.grpc

Class GrpcParser

java.lang.Object
brave.grpc.GrpcParser
Direct Known Subclasses:
GrpcClientParser, GrpcServerParser

public class GrpcParser
extends Object
  • Constructor Details

  • Method Details

    • errorParser

      protected ErrorParser errorParser()
      Override when making custom types. Typically, you'll use Tracing.errorParser()
      {@code
       class MyGrpcParser extends GrpcParser {
         ErrorParser errorParser;
      
         MyGrpcParser(Tracing tracing) {
           errorParser = tracing.errorParser();
         }
      
         protected ErrorParser errorParser() {
           return errorParser;
         }
       --snip--
       }
    • spanName

      protected <ReqT,​ RespT> String spanName​(io.grpc.MethodDescriptor<ReqT,​RespT> methodDescriptor)
      Returns the span name of the request. Defaults to the full grpc method name.
    • onMessageSent

      protected <M> void onMessageSent​(M message, SpanCustomizer span)
      Override to customize the span based on a message sent to the peer.
    • onMessageReceived

      protected <M> void onMessageReceived​(M message, SpanCustomizer span)
      Override to customize the span based on the message received from the peer.
    • onClose

      protected void onClose​(io.grpc.Status status, io.grpc.Metadata trailers, SpanCustomizer span)
      Override to change what data from the status or trailers are parsed into the span modeling it. By default, this tags "grpc.status_code" and "error" when it is not OK.