{
"version" : "3.0.0",
"gauges" : {
"jmsQueue" : {
"value" : 2
}},
"counters" : { },
"histograms" : { },
"meters" : { },
"timers" : { }
}
17:28:15,392 INFO [metrics-reporter-demo] (metrics-logger-reporter-28-thread-1) type=COUNTER, name=Transaction.approved.count, count=1
17:28:15,392 INFO [metrics-reporter-demo] (metrics-logger-reporter-28-thread-1) type=HISTOGRAM, name=approved, count=1, min=1, max=1, mean=1.0, stddev=0.0, median=1.0, p75=1.0, p95=1.0, p98=1.0, p99=1.0, p999=1.0
17:28:58,840 INFO [metrics-reporter-demo] (metrics-logger-reporter-1-thread-1) type=GAUGE, name=jmsQueue, value=2
I'm not sure if my assumption is right, but if I hit the webpage or invoke the MetricsServlet again, the metrics / JSON output should be updated?
I used the a simple Java EE 6 - EAR running under JBoss EAP 6.4.0
My servlet uses a singleton bean
@WebListener
public class DemoMetricsServletContextListener extends MetricsServlet.ContextListener {
@Inject
private DemoMetrics metrics;
@Override
protected MetricRegistry getMetricRegistry() {
return metrics.getRegistry();
}
}
All other metrics uses this singleton bean to register against the MetricsRegistry
@Startup
@Singleton(description = "contains the single metrics registry")
public class DemoMetrics {
private final MetricRegistry registry;
public DemoMetrics() {
registry = new MetricRegistry();
try {
setupJmxGauges();
setupJvmGauges();
} catch (MalformedObjectNameException e) {
LOGGER.error("error in setup JMX metrics", e);
}
final Slf4jReporter reporter = Slf4jReporter.forRegistry(registry).outputTo(LoggerFactory.getLogger("metrics-reporter-demo")).convertRatesTo(TimeUnit.SECONDS).build();
reporter.start(1, TimeUnit.MINUTES);
}
//..
}
Any pointers or confirmation might be helpful.
--
You received this message because you are subscribed to a topic in the Google Groups "metrics-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/metrics-user/k0mNFHk1saM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to metrics-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.