@GrpcGlobalServerInterceptor @Order(value=2500) public class MetricCollectingServerInterceptor extends AbstractMetricCollectingInterceptor implements ServerInterceptor
AbstractMetricCollectingInterceptor.MetricSetcounterCustomizer, eagerInitializedCodes, registry, timerCustomizer| Constructor and Description |
|---|
MetricCollectingServerInterceptor(MeterRegistry registry)
Creates a new gRPC server interceptor that will collect metrics into the given
MeterRegistry. |
MetricCollectingServerInterceptor(MeterRegistry registry,
UnaryOperator<Counter.Builder> counterCustomizer,
UnaryOperator<Timer.Builder> timerCustomizer,
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> ServerCall.Listener<Q> |
interceptCall(ServerCall<Q,A> call,
Metadata requestHeaders,
ServerCallHandler<Q,A> next) |
protected Counter |
newRequestCounterFor(MethodDescriptor<?,?> method) |
protected Counter |
newResponseCounterFor(MethodDescriptor<?,?> method) |
protected Function<Status.Code,Timer> |
newTimerFunction(MethodDescriptor<?,?> method) |
void |
preregisterService(BindableService service)
Pre-registers the all methods provided by the given service.
|
void |
preregisterService(ServerServiceDefinition serviceDefinition)
Pre-registers the all methods provided by the given service.
|
asTimerFunction, metricsFor, newMetricsFor, preregisterMethod, preregisterServicepublic MetricCollectingServerInterceptor(MeterRegistry registry)
MeterRegistry.registry - The registry to use.public MetricCollectingServerInterceptor(MeterRegistry registry, UnaryOperator<Counter.Builder> counterCustomizer, UnaryOperator<Timer.Builder> timerCustomizer, 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(BindableService service)
service - The service to initialize the meters for.preregisterService(ServerServiceDefinition)public void preregisterService(ServerServiceDefinition serviceDefinition)
serviceDefinition - The service to initialize the meters for.AbstractMetricCollectingInterceptor.preregisterService(ServiceDescriptor)protected Counter newRequestCounterFor(MethodDescriptor<?,?> method)
newRequestCounterFor in class AbstractMetricCollectingInterceptorprotected Counter newResponseCounterFor(MethodDescriptor<?,?> method)
newResponseCounterFor in class AbstractMetricCollectingInterceptorprotected Function<Status.Code,Timer> newTimerFunction(MethodDescriptor<?,?> method)
newTimerFunction in class AbstractMetricCollectingInterceptorpublic <Q,A> ServerCall.Listener<Q> interceptCall(ServerCall<Q,A> call, Metadata requestHeaders, ServerCallHandler<Q,A> next)
interceptCall in interface ServerInterceptor