use of org.eclipse.microprofile.metrics.MetricRegistry in project wildfly-swarm by wildfly-swarm.
the class PrometheusExporter method getEntriesForScope.
private void getEntriesForScope(MetricRegistry.Type scope, StringBuilder sb) {
MetricRegistry registry = MetricRegistryFactory.get(scope);
Map<String, Metric> metricMap = registry.getMetrics();
exposeEntries(scope, sb, registry, metricMap);
}
use of org.eclipse.microprofile.metrics.MetricRegistry in project wildfly-swarm by wildfly-swarm.
the class PrometheusExporter method exportOneMetric.
@Override
public StringBuilder exportOneMetric(MetricRegistry.Type scope, String metricName) {
MetricRegistry registry = MetricRegistryFactory.get(scope);
Map<String, Metric> metricMap = registry.getMetrics();
Metric m = metricMap.get(metricName);
Map<String, Metric> outMap = new HashMap<>(1);
outMap.put(metricName, m);
StringBuilder sb = new StringBuilder();
exposeEntries(scope, sb, registry, outMap);
return sb;
}
use of org.eclipse.microprofile.metrics.MetricRegistry in project wildfly-swarm by wildfly-swarm.
the class MetricCdiInjectionExtension method registerMetrics.
void registerMetrics(@Observes AfterDeploymentValidation adv, BeanManager manager) {
// Produce and register custom metrics
MetricRegistry registry = getReference(manager, MetricRegistry.class);
MetricName name = getReference(manager, MetricName.class);
for (Map.Entry<Bean<?>, AnnotatedMember<?>> bean : metrics.entrySet()) {
if (// skip non @Default beans
!bean.getKey().getQualifiers().contains(DEFAULT) || // skip producer methods with injection point metadata
hasInjectionPointMetadata(bean.getValue())) {
continue;
}
String metricName = name.of(bean.getValue());
registry.register(metricName, getReference(manager, bean.getValue().getBaseType(), bean.getKey()));
}
// Let's clear the collected metric producers
metrics.clear();
}
Aggregations