Class MetricCollectingService<I extends Request,​O extends Response>

  • Type Parameters:
    I - the Request type
    O - the Response type
    All Implemented Interfaces:
    Unwrappable, Service<I,​O>

    public final class MetricCollectingService<I extends Request,​O extends Response>
    extends SimpleDecoratingService<I,​O>
    Decorates a Service to collect metrics into MeterRegistry.

    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.