@GrpcGlobalClientInterceptor public class MetricCollectingClientInterceptor extends net.devh.boot.grpc.common.metric.AbstractMetricCollectingInterceptor implements io.grpc.ClientInterceptor
Constructor and Description |
---|
MetricCollectingClientInterceptor(io.micrometer.core.instrument.MeterRegistry registry)
Creates a new gRPC client interceptor that will collect metrics into the given
MeterRegistry . |
MetricCollectingClientInterceptor(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 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> io.grpc.ClientCall<Q,A> |
interceptCall(io.grpc.MethodDescriptor<Q,A> methodDescriptor,
io.grpc.CallOptions callOptions,
io.grpc.Channel channel) |
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) |
@Autowired public MetricCollectingClientInterceptor(io.micrometer.core.instrument.MeterRegistry registry)
MeterRegistry
.registry
- The registry to use.public MetricCollectingClientInterceptor(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 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 io.micrometer.core.instrument.Counter newRequestCounterFor(io.grpc.MethodDescriptor<?,?> method)
newRequestCounterFor
in class net.devh.boot.grpc.common.metric.AbstractMetricCollectingInterceptor
protected io.micrometer.core.instrument.Counter newResponseCounterFor(io.grpc.MethodDescriptor<?,?> method)
newResponseCounterFor
in class net.devh.boot.grpc.common.metric.AbstractMetricCollectingInterceptor
protected 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.AbstractMetricCollectingInterceptor
public <Q,A> io.grpc.ClientCall<Q,A> interceptCall(io.grpc.MethodDescriptor<Q,A> methodDescriptor, io.grpc.CallOptions callOptions, io.grpc.Channel channel)
interceptCall
in interface io.grpc.ClientInterceptor