Interface RpcAttributesGetter<REQUEST,RESPONSE>


public interface RpcAttributesGetter<REQUEST,RESPONSE>
An interface for getting RPC attributes.

Instrumentation authors will create implementations of this interface for their specific library/framework. It will be used by the RpcClientAttributesExtractor or RpcServerAttributesExtractor to obtain the various RPC attributes in a type-generic way.

  • Method Details

    • getRpcSystemName

      default String getRpcSystemName(REQUEST request)
      Returns the stable semconv system name for the RPC framework (e.g. "grpc", "java_rmi", "dotnet_wcf").
      See Also:
    • getSystem

      @Deprecated String getSystem(REQUEST request)
      Deprecated.
      Use getRpcSystemName(REQUEST). To be removed in 3.0.
    • getService

      @Nullable String getService(REQUEST request)
    • getMethod

      @Deprecated @Nullable String getMethod(REQUEST request)
      Deprecated.
      Use getRpcMethod(REQUEST) for stable semconv.
    • getRequestSize

      @Nullable default Long getRequestSize(REQUEST request)
    • getResponseSize

      @Nullable default Long getResponseSize(REQUEST request)
    • getRpcMethod

      @Nullable default String getRpcMethod(REQUEST request)
      Returns the fully-qualified RPC method name for stable semconv.
      Parameters:
      request - the request object
      Returns:
      the fully-qualified RPC method name (e.g., "my.Service/Method"), or null if service or method is unavailable
    • getRpcMethodOriginal

      @Nullable default String getRpcMethodOriginal(REQUEST request)
      Returns the original method name when the method reported via getRpcMethod(REQUEST) is set to _OTHER because the method is not recognized by the RPC framework.
    • getErrorType

      @Nullable default String getErrorType(REQUEST request, @Nullable RESPONSE response, @Nullable Throwable error)
      Returns a description of a class of error the operation ended with.

      This method should return null if there was no error.

      If this method returns null, the exception class name will be used as error type if one was thrown.

      The cardinality of the error type should be low. The instrumentations implementing this method are recommended to document the custom values they support.

      Examples: CANCELLED, UNKNOWN, -32602