use of org.eclipse.microprofile.metrics.annotation.Counted in project wildfly-swarm by wildfly-swarm.
the class MetricsInterceptor method registerMetrics.
private <E extends Member & AnnotatedElement> void registerMetrics(Class<?> bean, E element) {
MetricResolver.Of<Counted> counted = resolver.counted(bean, element);
if (counted.isPresent()) {
Counted t = counted.metricAnnotation();
Metadata metadata = getMetadata(counted.metricName(), t.unit(), t.description(), t.displayName(), MetricType.COUNTER, t.tags());
registry.counter(metadata);
}
MetricResolver.Of<Metered> metered = resolver.metered(bean, element);
if (metered.isPresent()) {
Metered t = metered.metricAnnotation();
Metadata metadata = getMetadata(metered.metricName(), t.unit(), t.description(), t.displayName(), MetricType.METERED, t.tags());
registry.meter(metadata);
}
MetricResolver.Of<Timed> timed = resolver.timed(bean, element);
if (timed.isPresent()) {
Timed t = timed.metricAnnotation();
Metadata metadata = getMetadata(timed.metricName(), t.unit(), t.description(), t.displayName(), MetricType.TIMER, t.tags());
registry.timer(metadata);
}
}
Aggregations