Class MetricCollectingClient
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.MetricCollectingClient
- All Implemented Interfaces:
Client<HttpRequest,
,HttpResponse> HttpClient
,Unwrappable
Decorates an
HttpClient
to collect metrics into MeterRegistry
.
Example:
WebClient client = WebClient
.builder(uri)
.decorator(MetricCollectingClient.newDecorator(MeterIdPrefixFunction.ofDefault("myClient")))
.build();
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 TypeMethodDescriptionbuilder
(MeterIdPrefixFunction meterIdPrefixFunction) Returns a newMetricCollectingClientBuilder
instance.final HttpResponse
execute
(ClientRequestContext ctx, HttpRequest req) static Function<? super HttpClient,
MetricCollectingClient> newDecorator
(MeterIdPrefixFunction meterIdPrefixFunction) Returns anHttpClient
decorator that tracks request stats usingMeterRegistry
.Methods inherited from class com.linecorp.armeria.common.util.AbstractUnwrappable
as, toString, unwrap, unwrapAll
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.linecorp.armeria.client.HttpClient
execute
Methods inherited from interface com.linecorp.armeria.common.util.Unwrappable
equalsIgnoreWrapper, unwrapAll
-
Method Details
-
newDecorator
public static Function<? super HttpClient,MetricCollectingClient> newDecorator(MeterIdPrefixFunction meterIdPrefixFunction) Returns anHttpClient
decorator that tracks request stats usingMeterRegistry
. -
builder
Returns a newMetricCollectingClientBuilder
instance. -
execute
Description copied from interface:Client
-