Class ObservationGrpcServerInterceptor

java.lang.Object
io.micrometer.core.instrument.binder.grpc.ObservationGrpcServerInterceptor
All Implemented Interfaces:
io.grpc.ServerInterceptor

public class ObservationGrpcServerInterceptor extends Object implements io.grpc.ServerInterceptor
A gRPC server interceptor that works with Observation.

Usage:

 Server server = ServerBuilder.forPort(8080)
         .intercept(new ObservationGrpcServerInterceptor(observationRegistry))
         .build();
 server.start()
 
The instrumentation is based on the behavior of Spring Cloud Sleuth and Brave.
Since:
1.10.0
  • Constructor Details

    • ObservationGrpcServerInterceptor

      public ObservationGrpcServerInterceptor(io.micrometer.observation.ObservationRegistry registry)
  • Method Details

    • interceptCall

      public <ReqT, RespT> io.grpc.ServerCall.Listener<ReqT> interceptCall(io.grpc.ServerCall<ReqT,RespT> call, io.grpc.Metadata headers, io.grpc.ServerCallHandler<ReqT,RespT> next)
      Specified by:
      interceptCall in interface io.grpc.ServerInterceptor
    • setCustomConvention

      public void setCustomConvention(@Nullable GrpcServerObservationConvention customConvention)
      Parameters:
      customConvention - a custom convention