Class MetricCollectingRpcClient
java.lang.Object
com.linecorp.armeria.common.util.AbstractUnwrappable<Client<T_I,T_O>>
com.linecorp.armeria.client.DecoratingClient<I,O,I,O>
com.linecorp.armeria.client.SimpleDecoratingClient<I,O>
com.linecorp.armeria.client.metric.MetricCollectingRpcClient
- All Implemented Interfaces:
Client<RpcRequest,RpcResponse>
,RpcClient
,Unwrappable
public final class MetricCollectingRpcClient extends SimpleDecoratingClient<I,O> implements RpcClient
Decorates an
RpcClient
to collect metrics into MeterRegistry
.
Example:
MyService.Iface client =
Clients.builder(uri)
.rpcDecorator(MetricCollectingRpcClient.newDecorator(MeterIdPrefixFunction.ofDefault("myClient")))
.build(MyService.Iface.class);
It is generally recommended not to use a class or package name as a metric name, because otherwise seemingly harmless refactoring such as rename may break metric collection.
-
Method Summary
Modifier and Type Method Description RpcResponse
execute(ClientRequestContext ctx, RpcRequest req)
static Function<? super RpcClient,MetricCollectingRpcClient>
newDecorator(MeterIdPrefixFunction meterIdPrefixFunction)
Returns anRpcClient
decorator that tracks request stats usingMeterRegistry
.Methods inherited from class com.linecorp.armeria.common.util.AbstractUnwrappable
as, toString, unwrap
-
Method Details
-
newDecorator
public static Function<? super RpcClient,MetricCollectingRpcClient> newDecorator(MeterIdPrefixFunction meterIdPrefixFunction)Returns anRpcClient
decorator that tracks request stats usingMeterRegistry
. -
execute
Description copied from interface:Client
-