Provides Dropwizard Metrics integration module for Bootique. See usage example bootique-metrics-demo.
Add the Metrics module to your Bootique app:
<dependency>
<groupId>io.bootique.metrics</groupId>
<artifactId>bootique-metrics</artifactId>
<scope>compile</scope>
</dependency>
Inject MetricRegistry anywhere in your code where you need to create Meters, Gauges, Counters, Histograms, Timers, etc. E.g.:
@Inject
public MyObject(MetricRegistry metrics) {
this.timer = metrics.timer(MetricRegistry.name(RequestTimer.class, "work-timer"));
}
...
public void doWork() {
Timer.Context context = this.timer.time();
try {
// do work
} finally {
long timeNanos = context.stop();
}
}