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
Modifier and TypeClassDescriptionstatic interface
Implemented by classes that can create a metric name. -
Method Summary
Modifier and TypeMethodDescriptionstatic GrpcMetrics
A static factory method to create aGrpcMetrics
instance to time gRPC method calls.void
configure
(MethodDescriptor.Rules rules) Apply extra configuration to aMethodDescriptor.Rules
.void
configure
(ServiceDescriptor.Rules rules) Apply extra configuration to aServiceDescriptor.Rules
.static GrpcMetrics
counted()
A static factory method to create aGrpcMetrics
instance 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.boolean
int
hashCode()
static GrpcMetrics
A static factory method to create aGrpcMetrics
instance 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 GrpcMetrics
metered()
A static factory method to create aGrpcMetrics
instance to meter gRPC method calls.Obtain theMetricType
.nameFunction
(GrpcMetrics.NamingFunction function) Set theGrpcMetrics.NamingFunction
to use to generate the metric name.static GrpcMetrics
A static factory method to create aGrpcMetrics
instance to time gRPC method calls.Set the tags to apply to the metric.static GrpcMetrics
timed()
A static factory method to create aGrpcMetrics
instance to time gRPC method calls.Set the units to apply to the metric.
-
Method Details
-
configure
Description copied from interface:MethodDescriptor.Configurer
Apply extra configuration to aMethodDescriptor.Rules
.- Specified by:
configure
in interfaceMethodDescriptor.Configurer
- Parameters:
rules
- theMethodDescriptor.Rules
to configure
-
configure
Description copied from interface:ServiceDescriptor.Configurer
Apply extra configuration to aServiceDescriptor.Rules
.- Specified by:
configure
in interfaceServiceDescriptor.Configurer
- Parameters:
rules
- theServiceDescriptor.Rules
to configure
-
tags
Set the tags to apply to the metric.- Parameters:
tags
- the tags to apply to the metric- Returns:
- a
GrpcMetrics
interceptor - See Also:
-
description
Set the description to apply to the metric.- Parameters:
description
- the description to apply to the metric- Returns:
- a
GrpcMetrics
interceptor - See Also:
-
displayName
Set the display name to apply to the metric.- Parameters:
displayName
- the display name to apply to the metric- Returns:
- a
GrpcMetrics
interceptor - See Also:
-
units
Set the units to apply to the metric.- Parameters:
units
- the units to apply to the metric- Returns:
- a
GrpcMetrics
interceptor - See Also:
-
metricType
Obtain theMetricType
.- Returns:
- the
MetricType
-
nameFunction
Set theGrpcMetrics.NamingFunction
to 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
GrpcMetrics
interceptor
-
counted
A static factory method to create aGrpcMetrics
instance to count gRPC method calls.- Returns:
- a
GrpcMetrics
instance to capture call counts
-
metered
A static factory method to create aGrpcMetrics
instance to meter gRPC method calls.- Returns:
- a
GrpcMetrics
instance to meter gRPC calls
-
histogram
A static factory method to create aGrpcMetrics
instance to create a histogram of gRPC method calls.- Returns:
- a
GrpcMetrics
instance to create a histogram of gRPC method calls
-
timed
A static factory method to create aGrpcMetrics
instance to time gRPC method calls.- Returns:
- a
GrpcMetrics
instance to time gRPC method calls
-
concurrentGauge
A static factory method to create aGrpcMetrics
instance to time gRPC method calls.- Returns:
- a
GrpcMetrics
instance to time gRPC method calls
-
simplyTimed
A static factory method to create aGrpcMetrics
instance to time gRPC method calls.- Returns:
- a
GrpcMetrics
instance 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:
interceptCall
in interfaceio.grpc.ServerInterceptor
-
equals
-
hashCode
public int hashCode()
-