https://github.com/bootique/bootique-metrics
Provides Dropwizard Metrics integration with Bootique
https://github.com/bootique/bootique-metrics
Last synced: about 1 year ago
JSON representation
Provides Dropwizard Metrics integration with Bootique
- Host: GitHub
- URL: https://github.com/bootique/bootique-metrics
- Owner: bootique
- License: apache-2.0
- Created: 2016-01-19T15:41:45.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2025-04-19T13:22:50.000Z (about 1 year ago)
- Last Synced: 2025-04-19T18:03:31.604Z (about 1 year ago)
- Language: Java
- Homepage: http://bootique.io
- Size: 379 KB
- Stars: 5
- Watchers: 9
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/bootique/bootique-metrics/actions/workflows/maven.yml)
[](https://search.maven.org/artifact/io.bootique.metrics/bootique-metrics/)
# bootique-metrics
Provides [Dropwizard Metrics](http://metrics.dropwizard.io/) integration module for [Bootique](http://bootique.io).
See usage example [bootique-metrics-demo](https://github.com/bootique-examples/bootique-metrics-demo).
## Quick Start:
Add the Metrics module to your Bootique app:
```xml
io.bootique.metrics
bootique-metrics
compile
```
Inject [MetricRegistry](http://metrics.dropwizard.io/3.1.0/apidocs/com/codahale/metrics/MetricRegistry.html) anywhere
in your code where you need to create [Meters](http://metrics.dropwizard.io/3.1.0/getting-started/#meters),
[Gauges](http://metrics.dropwizard.io/3.1.0/getting-started/#gauges),
[Counters](http://metrics.dropwizard.io/3.1.0/getting-started/#counters),
[Histograms](http://metrics.dropwizard.io/3.1.0/getting-started/#histograms),
[Timers](http://metrics.dropwizard.io/3.1.0/getting-started/#timers), etc. E.g.:
```java
@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();
}
}
```