@GrpcGlobalServerInterceptor public class MetricCollectingServerInterceptor extends net.devh.boot.grpc.common.metric.AbstractMetricCollectingInterceptor implements io.grpc.ServerInterceptor
| Constructor and Description |
|---|
MetricCollectingServerInterceptor(io.micrometer.core.instrument.MeterRegistry registry)
Creates a new gRPC server interceptor that will collect metrics into the given
MeterRegistry. |
MetricCollectingServerInterceptor(io.micrometer.core.instrument.MeterRegistry registry,
java.util.function.UnaryOperator<io.micrometer.core.instrument.Counter.Builder> counterCustomizer,
java.util.function.UnaryOperator<io.micrometer.core.instrument.Timer.Builder> timerCustomizer,
io.grpc.Status.Code... eagerInitializedCodes)
Creates a new gRPC server interceptor that will collect metrics into the given
MeterRegistry and uses the
given customizer to configure the Counters and Timers. |
| Modifier and Type | Method and Description |
|---|---|
<Q,A> io.grpc.ServerCall.Listener<Q> |
interceptCall(io.grpc.ServerCall<Q,A> call,
io.grpc.Metadata requestHeaders,
io.grpc.ServerCallHandler<Q,A> next) |
protected io.micrometer.core.instrument.Counter |
newRequestCounterFor(io.grpc.MethodDescriptor<?,?> method) |
protected io.micrometer.core.instrument.Counter |
newResponseCounterFor(io.grpc.MethodDescriptor<?,?> method) |
protected java.util.function.Function<io.grpc.Status.Code,io.micrometer.core.instrument.Timer> |
newTimerFunction(io.grpc.MethodDescriptor<?,?> method) |
void |
preregisterService(io.grpc.BindableService service)
Pre-registers the all methods provided by the given service.
|
void |
preregisterService(io.grpc.ServerServiceDefinition serviceDefinition)
Pre-registers the all methods provided by the given service.
|
public MetricCollectingServerInterceptor(io.micrometer.core.instrument.MeterRegistry registry)
MeterRegistry.registry - The registry to use.public MetricCollectingServerInterceptor(io.micrometer.core.instrument.MeterRegistry registry,
java.util.function.UnaryOperator<io.micrometer.core.instrument.Counter.Builder> counterCustomizer,
java.util.function.UnaryOperator<io.micrometer.core.instrument.Timer.Builder> timerCustomizer,
io.grpc.Status.Code... eagerInitializedCodes)
MeterRegistry and uses the
given customizer to configure the Counters and Timers.registry - The registry to use.counterCustomizer - The unary function that can be used to customize the created counters.timerCustomizer - The unary function that can be used to customize the created timers.eagerInitializedCodes - The status codes that should be eager initialized.public void preregisterService(io.grpc.BindableService service)
service - The service to initialize the meters for.preregisterService(ServerServiceDefinition)public void preregisterService(io.grpc.ServerServiceDefinition serviceDefinition)
serviceDefinition - The service to initialize the meters for.AbstractMetricCollectingInterceptor.preregisterService(ServiceDescriptor)protected io.micrometer.core.instrument.Counter newRequestCounterFor(io.grpc.MethodDescriptor<?,?> method)
newRequestCounterFor in class net.devh.boot.grpc.common.metric.AbstractMetricCollectingInterceptorprotected io.micrometer.core.instrument.Counter newResponseCounterFor(io.grpc.MethodDescriptor<?,?> method)
newResponseCounterFor in class net.devh.boot.grpc.common.metric.AbstractMetricCollectingInterceptorprotected java.util.function.Function<io.grpc.Status.Code,io.micrometer.core.instrument.Timer> newTimerFunction(io.grpc.MethodDescriptor<?,?> method)
newTimerFunction in class net.devh.boot.grpc.common.metric.AbstractMetricCollectingInterceptorpublic <Q,A> io.grpc.ServerCall.Listener<Q> interceptCall(io.grpc.ServerCall<Q,A> call,
io.grpc.Metadata requestHeaders,
io.grpc.ServerCallHandler<Q,A> next)
interceptCall in interface io.grpc.ServerInterceptor