Class ObservationGrpcServerInterceptor
java.lang.Object
io.micrometer.core.instrument.binder.grpc.ObservationGrpcServerInterceptor
- All Implemented Interfaces:
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 Summary
ConstructorDescriptionObservationGrpcServerInterceptor
(io.micrometer.observation.ObservationRegistry registry) -
Method Summary
Modifier and TypeMethodDescription<ReqT,
RespT>
io.grpc.ServerCall.Listener<ReqT> interceptCall
(io.grpc.ServerCall<ReqT, RespT> call, io.grpc.Metadata headers, io.grpc.ServerCallHandler<ReqT, RespT> next) void
setCustomConvention
(GrpcServerObservationConvention customConvention) Set a customGrpcServerObservationConvention
.
-
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 interfaceio.grpc.ServerInterceptor
-
setCustomConvention
Set a customGrpcServerObservationConvention
.- Parameters:
customConvention
- a custom convention
-