use of org.eclipse.microprofile.metrics.Timer in project wildfly-swarm by wildfly-swarm.
the class TimedInterceptor method timedCallable.
private <E extends Member & AnnotatedElement> Object timedCallable(InvocationContext context, E element) throws Exception {
String name = resolver.timed(bean.getBeanClass(), element).metricName();
Timer timer = (Timer) registry.getMetrics().get(name);
if (timer == null) {
throw new IllegalStateException("No timer with name [" + name + "] found in registry [" + registry + "]");
}
Timer.Context time = timer.time();
try {
return context.proceed();
} finally {
time.stop();
}
}
Aggregations