- java.lang.Object
-
- com.linecorp.armeria.common.util.AbstractUnwrappable<Service<T_I,T_O>>
-
- com.linecorp.armeria.server.DecoratingService<I,O,I,O>
-
- com.linecorp.armeria.server.SimpleDecoratingService<I,O>
-
- com.linecorp.armeria.server.metric.MetricCollectingService<I,O>
-
- All Implemented Interfaces:
Unwrappable
,Service<I,O>
public final class MetricCollectingService<I extends Request,O extends Response> extends SimpleDecoratingService<I,O>
Decorates aService
to collect metrics intoMeterRegistry
.Example:
serverBuilder.service( "/service", THttpService.of(handler) .decorate(MetricCollectingService.newDecorator( MeterIdPrefixFunction.ofDefault("myService"))));
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <I extends Request,O extends Response>
Function<Service<I,O>,MetricCollectingService<I,O>>newDecorator(MeterIdPrefixFunction meterIdPrefixFunction)
Returns a newService
decorator that tracks request stats usingMeterRegistry
.O
serve(ServiceRequestContext ctx, I req)
Serves an incomingRequest
.-
Methods inherited from class com.linecorp.armeria.server.DecoratingService
serviceAdded, shouldCachePath
-
Methods inherited from class com.linecorp.armeria.common.util.AbstractUnwrappable
as, delegate, toString
-
-
-
-
Method Detail
-
newDecorator
public static <I extends Request,O extends Response> Function<Service<I,O>,MetricCollectingService<I,O>> newDecorator(MeterIdPrefixFunction meterIdPrefixFunction)
Returns a newService
decorator that tracks request stats usingMeterRegistry
.
-
-