Class MetricCollectingServiceBuilder
java.lang.Object
com.linecorp.armeria.common.metric.AbstractMetricCollectingBuilder
com.linecorp.armeria.server.metric.MetricCollectingServiceBuilder
Builds a
MetricCollectingService
instance.-
Method Summary
Modifier and TypeMethodDescriptionbuild
(HttpService delegate) Returns a newly-createdMetricCollectingService
decoratingHttpService
based on the properties of this builder.Function<? super HttpService,
MetricCollectingService> Returns a newly-createdMetricCollectingService
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 MetricCollectingServiceBuilder 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-createdMetricCollectingService
decoratingHttpService
based on the properties of this builder. -
newDecorator
Returns a newly-createdMetricCollectingService
decorator based on the properties of this builder and appliesMeterIdPrefixFunction
.
-