java.lang.Object
io.helidon.grpc.metrics.GrpcMetrics
- All Implemented Interfaces:
io.grpc.ServerInterceptor,MethodDescriptor.Configurer,ServiceDescriptor.Configurer
@Priority(1002)
public class GrpcMetrics
extends Object
implements io.grpc.ServerInterceptor, ServiceDescriptor.Configurer, MethodDescriptor.Configurer
A
ServerInterceptor that enables capturing of gRPC call metrics.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceImplemented by classes that can create a metric name. -
Method Summary
Modifier and TypeMethodDescriptionstatic GrpcMetricsA static factory method to create aGrpcMetricsinstance to time gRPC method calls.voidconfigure(MethodDescriptor.Rules rules) Apply extra configuration to aMethodDescriptor.Rules.voidconfigure(ServiceDescriptor.Rules rules) Apply extra configuration to aServiceDescriptor.Rules.static GrpcMetricscounted()A static factory method to create aGrpcMetricsinstance to count gRPC method calls.description(String description) Set the description to apply to the metric.displayName(String displayName) Set the display name to apply to the metric.booleaninthashCode()static GrpcMetricsA static factory method to create aGrpcMetricsinstance to create a histogram of gRPC method calls.<ReqT,RespT>
io.grpc.ServerCall.Listener<ReqT>interceptCall(io.grpc.ServerCall<ReqT, RespT> call, io.grpc.Metadata headers, io.grpc.ServerCallHandler<ReqT, RespT> next) static GrpcMetricsmetered()A static factory method to create aGrpcMetricsinstance to meter gRPC method calls.Obtain theMetricType.nameFunction(GrpcMetrics.NamingFunction function) Set theGrpcMetrics.NamingFunctionto use to generate the metric name.static GrpcMetricsA static factory method to create aGrpcMetricsinstance to time gRPC method calls.Set the tags to apply to the metric.static GrpcMetricstimed()A static factory method to create aGrpcMetricsinstance to time gRPC method calls.Set the units to apply to the metric.
-
Method Details
-
configure
Description copied from interface:MethodDescriptor.ConfigurerApply extra configuration to aMethodDescriptor.Rules.- Specified by:
configurein interfaceMethodDescriptor.Configurer- Parameters:
rules- theMethodDescriptor.Rulesto configure
-
configure
Description copied from interface:ServiceDescriptor.ConfigurerApply extra configuration to aServiceDescriptor.Rules.- Specified by:
configurein interfaceServiceDescriptor.Configurer- Parameters:
rules- theServiceDescriptor.Rulesto configure
-
tags
Set the tags to apply to the metric.- Parameters:
tags- the tags to apply to the metric- Returns:
- a
GrpcMetricsinterceptor - See Also:
-
description
Set the description to apply to the metric.- Parameters:
description- the description to apply to the metric- Returns:
- a
GrpcMetricsinterceptor - See Also:
-
displayName
Set the display name to apply to the metric.- Parameters:
displayName- the display name to apply to the metric- Returns:
- a
GrpcMetricsinterceptor - See Also:
-
units
Set the units to apply to the metric.- Parameters:
units- the units to apply to the metric- Returns:
- a
GrpcMetricsinterceptor - See Also:
-
metricType
Obtain theMetricType.- Returns:
- the
MetricType
-
nameFunction
Set theGrpcMetrics.NamingFunctionto use to generate the metric name.The default name will be the
<service-name>.<method-name>.- Parameters:
function- the function to use to create the metric name- Returns:
- a
GrpcMetricsinterceptor
-
counted
A static factory method to create aGrpcMetricsinstance to count gRPC method calls.- Returns:
- a
GrpcMetricsinstance to capture call counts
-
metered
A static factory method to create aGrpcMetricsinstance to meter gRPC method calls.- Returns:
- a
GrpcMetricsinstance to meter gRPC calls
-
histogram
A static factory method to create aGrpcMetricsinstance to create a histogram of gRPC method calls.- Returns:
- a
GrpcMetricsinstance to create a histogram of gRPC method calls
-
timed
A static factory method to create aGrpcMetricsinstance to time gRPC method calls.- Returns:
- a
GrpcMetricsinstance to time gRPC method calls
-
concurrentGauge
A static factory method to create aGrpcMetricsinstance to time gRPC method calls.- Returns:
- a
GrpcMetricsinstance to time gRPC method calls
-
simplyTimed
A static factory method to create aGrpcMetricsinstance to time gRPC method calls.- Returns:
- a
GrpcMetricsinstance to time gRPC method calls
-
interceptCall
public <ReqT,RespT> io.grpc.ServerCall.Listener<ReqT> interceptCall(io.grpc.ServerCall<ReqT, RespT> call, io.grpc.Metadata headers, io.grpc.ServerCallHandler<ReqT, RespT> next) - Specified by:
interceptCallin interfaceio.grpc.ServerInterceptor
-
equals
-
hashCode
public int hashCode()
-