/** * Register a single counter. * * @param name Name of counter. * @param description Description of counter. * @return The counter created. */ private static Counter registerCounter(String name, String description) { return getMetricRegistry().counter(new Metadata(name, name, description, MetricType.COUNTER, MetricUnits.NONE)); }
@Produces @VendorDefined private Counter produceCounter(MetricRegistry registry, InjectionPoint ip) { Metric metric = ip.getAnnotated().getAnnotation(Metric.class); return registry.counter(newMetadata(ip, metric, MetricType.COUNTER)); }
counted.unit(), toTags(counted.tags())); registry.counter(meta); LOGGER.log(Level.FINE, () -> "### Registered counter " + metricName); } else if (annotation instanceof Metered) {
@Produces @Metric(name = "not_registered_metric") Counter notRegisteredMetric(MetricRegistry registry, InjectionPoint ip) { return registry.counter("not_registered_metric"); } }
public void countMe() { Counter counter = metrics.counter("metricTest.test1.count"); counter.inc(); }
@Produces public Counter produceCounter(InjectionPoint injectionPoint) { return applicationRegistry.counter(AnnotationMetadata.buildProducerMetadata(injectionPoint)); }
private Counter counterOf(String name) { Counter counter = registry.getCounters().get(name); if (counter == null) { synchronized (operation) { counter = registry.getCounters().get(name); if (counter == null) { counter = registry.counter(metadataOf(name, MetricType.COUNTER)); } } } return counter; }
void afterDeploymentValidation(@Observes final AfterDeploymentValidation afterDeploymentValidation, final BeanManager beanManager) { registrations.values().stream().filter(m -> m.getTypeRaw() == MetricType.GAUGE) .forEach(registration -> { final Gauge<?> gauge = gaugeFactories.get(registration.getName()).apply(beanManager); applicationRegistry.register(registration, gauge); }); producersRegistrations.forEach(Runnable::run); producersRegistrations.clear(); gaugeFactories.clear(); registrations.clear(); // mainly for tck, to drop if we add real vendor metrics vendorRegistry.counter("startTime").inc(System.currentTimeMillis()); if (!Boolean.getBoolean("geronimo.metrics.base.skip")) { new BaseMetrics(baseRegistry).register(); } }
@Produces @VendorDefined private Counter produceCounter(MetricRegistry registry, InjectionPoint ip) { Metric metric = ip.getAnnotated().getAnnotation(Metric.class); return registry.counter(newMetadata(ip, metric, MetricType.COUNTER)); }
public void badRegisterReusableMixed() { Metadata metadata = new Metadata("badReusableMixed", MetricType.HISTOGRAM); metadata.setReusable(true); Histogram histogram = registry.histogram(metadata); histogram.update(1); // We register a different metric type - that is forbidden // so we expect an exception Metadata metadata2 = new Metadata("badReusableMixed", MetricType.COUNTER); metadata2.setReusable(true); registry.counter(metadata2); }
"Number of active requests on " + instrumentationName, MetricType.METERED, MetricUnits.NONE); this.activeRequests = metricsRegistry.counter(activeRequestsMetadata);
break; case COUNTER: addBean(afterBeanDiscovery, name, Counter.class, new MetricImpl(registration), applicationRegistry.counter(registration)); break; case METERED:
counted.unit(), toTags(counted.tags())); registry.counter(meta); LOGGER.log(Level.FINE, () -> "### Registered counter " + metricName); } else if (annotation instanceof Metered) {