@GrpcGlobalClientInterceptor @Order(value=2500) public class MetricCollectingClientInterceptor extends net.devh.boot.grpc.common.metric.AbstractMetricCollectingInterceptor implements ClientInterceptor
Constructor and Description |
---|
MetricCollectingClientInterceptor(MeterRegistry registry)
Creates a new gRPC client interceptor that will collect metrics into the given
MeterRegistry . |
MetricCollectingClientInterceptor(MeterRegistry registry,
UnaryOperator<Counter.Builder> counterCustomizer,
UnaryOperator<Timer.Builder> timerCustomizer,
Status.Code... eagerInitializedCodes)
Creates a new gRPC client 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> ClientCall<Q,A> |
interceptCall(MethodDescriptor<Q,A> methodDescriptor,
CallOptions callOptions,
Channel channel) |
protected Counter |
newRequestCounterFor(MethodDescriptor<?,?> method) |
protected Counter |
newResponseCounterFor(MethodDescriptor<?,?> method) |
protected Function<Status.Code,Timer> |
newTimerFunction(MethodDescriptor<?,?> method) |
@Autowired public MetricCollectingClientInterceptor(MeterRegistry registry)
MeterRegistry
.registry
- The registry to use.public MetricCollectingClientInterceptor(MeterRegistry registry, UnaryOperator<Counter.Builder> counterCustomizer, UnaryOperator<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.protected Counter newRequestCounterFor(MethodDescriptor<?,?> method)
newRequestCounterFor
in class net.devh.boot.grpc.common.metric.AbstractMetricCollectingInterceptor
protected Counter newResponseCounterFor(MethodDescriptor<?,?> method)
newResponseCounterFor
in class net.devh.boot.grpc.common.metric.AbstractMetricCollectingInterceptor
protected Function<Status.Code,Timer> newTimerFunction(MethodDescriptor<?,?> method)
newTimerFunction
in class net.devh.boot.grpc.common.metric.AbstractMetricCollectingInterceptor
public <Q,A> ClientCall<Q,A> interceptCall(MethodDescriptor<Q,A> methodDescriptor, CallOptions callOptions, Channel channel)
interceptCall
in interface ClientInterceptor