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();
}
}
Aggregations