Search in sources :

Example 1 with Counter

use of io.prometheus.client.Counter in project microservices by pwillhan.

the class CounterInterceptor method invoke.

@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
    Counted counted = invocation.getStaticPart().getAnnotation(Counted.class);
    String name = counted.name();
    Counter counter = registered.computeIfAbsent(name, s -> Counter.build().name(name).help(counted.help()).register());
    try {
        return invocation.proceed();
    } finally {
        counter.inc();
    }
}
Also used : Counter(io.prometheus.client.Counter)

Aggregations

Counter (io.prometheus.client.Counter)1