use of fish.payara.microprofile.metrics.cdi.MetricsHelper in project Payara by payara.
the class MetricCDIExtension method registerCustomMetrics.
private void registerCustomMetrics(@Observes AfterDeploymentValidation adv, BeanManager manager) {
MetricsService metricsService = Globals.getDefaultBaseServiceLocator().getService(MetricsService.class);
MetricRegistry registry = metricsService.getOrAddRegistry(metricsService.getApplicationName());
MetricsHelper helper = getReference(manager, MetricsHelper.class);
for (Map.Entry<Producer<?>, AnnotatedMember<?>> entry : metrics.entrySet()) {
AnnotatedMember<?> annotatedMember = entry.getValue();
Producer<?> prod = entry.getKey();
if (hasInjectionPoints(annotatedMember)) {
continue;
}
Metadata metadata = helper.metadataOf(annotatedMember);
registry.register(metadata.getName(), (Metric) prod.produce(manager.createCreationalContext(null)), metadata);
}
metrics.clear();
}
Aggregations