@GrpcGlobalServerInterceptor @Order(value=2500) public class MetricCollectingServerInterceptor extends AbstractMetricCollectingInterceptor implements ServerInterceptor
AbstractMetricCollectingInterceptor.MetricSet
counterCustomizer, eagerInitializedCodes, registry, timerCustomizer
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,
UnaryOperator<io.micrometer.core.instrument.Counter.Builder> counterCustomizer,
UnaryOperator<io.micrometer.core.instrument.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 Counter s and Timer s. |
Modifier and Type | Method and Description |
---|---|
<Q,A> ServerCall.Listener<Q> |
interceptCall(ServerCall<Q,A> call,
Metadata requestHeaders,
ServerCallHandler<Q,A> next) |
protected io.micrometer.core.instrument.Counter |
newRequestCounterFor(MethodDescriptor<?,?> method) |
protected io.micrometer.core.instrument.Counter |
newResponseCounterFor(MethodDescriptor<?,?> method) |
protected Function<Status.Code,io.micrometer.core.instrument.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, preregisterService
public MetricCollectingServerInterceptor(io.micrometer.core.instrument.MeterRegistry registry)
MeterRegistry
.registry
- The registry to use.public MetricCollectingServerInterceptor(io.micrometer.core.instrument.MeterRegistry registry, UnaryOperator<io.micrometer.core.instrument.Counter.Builder> counterCustomizer, UnaryOperator<io.micrometer.core.instrument.Timer.Builder> timerCustomizer, Status.Code... eagerInitializedCodes)
MeterRegistry
and uses the
given customizer to configure the Counter
s and Timer
s.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 io.micrometer.core.instrument.Counter newRequestCounterFor(MethodDescriptor<?,?> method)
newRequestCounterFor
in class AbstractMetricCollectingInterceptor
protected io.micrometer.core.instrument.Counter newResponseCounterFor(MethodDescriptor<?,?> method)
newResponseCounterFor
in class AbstractMetricCollectingInterceptor
protected Function<Status.Code,io.micrometer.core.instrument.Timer> newTimerFunction(MethodDescriptor<?,?> method)
newTimerFunction
in class AbstractMetricCollectingInterceptor
public <Q,A> ServerCall.Listener<Q> interceptCall(ServerCall<Q,A> call, Metadata requestHeaders, ServerCallHandler<Q,A> next)
interceptCall
in interface ServerInterceptor