- 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
AServerInterceptorthat enables capturing of gRPC call metrics.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceGrpcMetrics.NamingFunctionImplemented by classes that can create a metric name.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GrpcMetricsconcurrentGauge()A 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.GrpcMetricsdescription(String description)Set the description to apply to the metric.GrpcMetricsdisplayName(String displayName)Set the display name to apply to the metric.booleanequals(Object o)inthashCode()static GrpcMetricshistogram()A 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.MetricTypemetricType()Obtain theMetricType.GrpcMetricsnameFunction(GrpcMetrics.NamingFunction function)Set theGrpcMetrics.NamingFunctionto use to generate the metric name.GrpcMetricsreusable(boolean reusable)Set the reusability of the metric.static GrpcMetricssimplyTimed()A static factory method to create aGrpcMetricsinstance to time gRPC method calls.GrpcMetricstags(Map<String,String> tags)Set the tags to apply to the metric.static GrpcMetricstimed()A static factory method to create aGrpcMetricsinstance to time gRPC method calls.GrpcMetricsunits(String units)Set the units to apply to the metric.
-
-
-
Method Detail
-
configure
public void configure(MethodDescriptor.Rules rules)
Description copied from interface:MethodDescriptor.ConfigurerApply extra configuration to aMethodDescriptor.Rules.- Specified by:
configurein interfaceMethodDescriptor.Configurer- Parameters:
rules- theMethodDescriptor.Rulesto configure
-
configure
public void configure(ServiceDescriptor.Rules rules)
Description copied from interface:ServiceDescriptor.ConfigurerApply extra configuration to aServiceDescriptor.Rules.- Specified by:
configurein interfaceServiceDescriptor.Configurer- Parameters:
rules- theServiceDescriptor.Rulesto configure
-
tags
public GrpcMetrics tags(Map<String,String> tags)
Set the tags to apply to the metric.- Parameters:
tags- the tags to apply to the metric- Returns:
- a
GrpcMetricsinterceptor - See Also:
Metadata
-
description
public GrpcMetrics description(String description)
Set the description to apply to the metric.- Parameters:
description- the description to apply to the metric- Returns:
- a
GrpcMetricsinterceptor - See Also:
Metadata
-
displayName
public GrpcMetrics displayName(String 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:
Metadata
-
units
public GrpcMetrics units(String units)
Set the units to apply to the metric.- Parameters:
units- the units to apply to the metric- Returns:
- a
GrpcMetricsinterceptor - See Also:
Metadata
-
reusable
public GrpcMetrics reusable(boolean reusable)
Set the reusability of the metric.- Parameters:
reusable-trueif this metric may be reused- Returns:
- a
GrpcMetricsinterceptor - See Also:
Metadata
-
metricType
public MetricType metricType()
Obtain theMetricType.- Returns:
- the
MetricType
-
nameFunction
public GrpcMetrics nameFunction(GrpcMetrics.NamingFunction function)
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
public static GrpcMetrics counted()
A static factory method to create aGrpcMetricsinstance to count gRPC method calls.- Returns:
- a
GrpcMetricsinstance to capture call counts
-
metered
public static GrpcMetrics metered()
A static factory method to create aGrpcMetricsinstance to meter gRPC method calls.- Returns:
- a
GrpcMetricsinstance to meter gRPC calls
-
histogram
public static GrpcMetrics 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
public static GrpcMetrics timed()
A static factory method to create aGrpcMetricsinstance to time gRPC method calls.- Returns:
- a
GrpcMetricsinstance to time gRPC method calls
-
concurrentGauge
public static GrpcMetrics concurrentGauge()
A static factory method to create aGrpcMetricsinstance to time gRPC method calls.- Returns:
- a
GrpcMetricsinstance to time gRPC method calls
-
simplyTimed
public static GrpcMetrics 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
-
-