Package brave.rpc

Interface RpcRequestParser

All Known Implementing Classes:
RpcRequestParser.Default

public interface RpcRequestParser
Use this to control the request data recorded for an sampled RPC client or server span.

Here's an example that adds default tags, and if Apache Dubbo, Java arguments:


 rpcTracing = rpcTracingBuilder
   .clientRequestParser((req, context, span) -> {
      RpcRequestParser.DEFAULT.parse(req, context, span);
      if (req instanceof DubboRequest) {
        tagArguments(((DubboRequest) req).invocation().getArguments());
      }
   }).build();
 

Note: This type is safe to implement as a lambda, or use as a method reference as it is effectively a FunctionalInterface. It isn't annotated as such because the project has a minimum Java language level 6.

Since:
5.12
See Also:
RpcResponseParser
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Interface Description
    static class  RpcRequestParser.Default
    The default data policy sets the span name to ${rpc.service}/${rpc.method} or only the method or service.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static RpcRequestParser DEFAULT  
  • Method Summary

    Modifier and Type Method Description
    void parse​(RpcRequest request, TraceContext context, SpanCustomizer span)
    Implement to choose what data from the RPC request are parsed into the span representing it.