Class MetricCollectingRpcClientBuilder
java.lang.Object
com.linecorp.armeria.common.metric.AbstractMetricCollectingBuilder
com.linecorp.armeria.client.metric.MetricCollectingRpcClientBuilder
Builds a
MetricCollectingRpcClient
instance.-
Method Summary
Modifier and TypeMethodDescriptionReturns a newly-createdMetricCollectingRpcClient
decoratingRpcClient
based on the properties of this builder.Function<? super RpcClient,
MetricCollectingRpcClient> Returns a newly-createdMetricCollectingRpcClient
decorator based on the properties of this builder and appliesMeterIdPrefixFunction
.successFunction
(BiPredicate<? super RequestContext, ? super RequestLog> successFunction) Defines a customBiPredicate
to allow custom definition of successful responses.Methods inherited from class com.linecorp.armeria.common.metric.AbstractMetricCollectingBuilder
meterIdPrefixFunction, successFunction
-
Method Details
-
successFunction
public MetricCollectingRpcClientBuilder successFunction(BiPredicate<? super RequestContext, ? super RequestLog> successFunction) Description copied from class:AbstractMetricCollectingBuilder
Defines a customBiPredicate
to allow custom definition of successful responses. In other words, specify which responses should incrementmetrics.success()
and which -metrics.failure()
.Example:
MetricCollectingService .builder(MeterIdPrefixFunction.ofDefault("hello")) .successFunction((context, log) -> { final int statusCode = log.responseHeaders().status().code(); return (statusCode >= 200 && statusCode < 400) || statusCode == 404; }) .newDecorator();
- Overrides:
successFunction
in classAbstractMetricCollectingBuilder
-
build
Returns a newly-createdMetricCollectingRpcClient
decoratingRpcClient
based on the properties of this builder. -
newDecorator
Returns a newly-createdMetricCollectingRpcClient
decorator based on the properties of this builder and appliesMeterIdPrefixFunction
.
-