Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bootique/bootique-metrics
Provides Dropwizard Metrics integration with Bootique
https://github.com/bootique/bootique-metrics
Last synced: about 2 months 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 (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-04-29T22:59:10.000Z (8 months ago)
- Last Synced: 2024-10-01T09:15:31.904Z (3 months ago)
- Language: Java
- Homepage: http://bootique.io
- Size: 369 KB
- Stars: 5
- Watchers: 10
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![build test deploy](https://github.com/bootique/bootique-metrics/actions/workflows/maven.yml/badge.svg)](https://github.com/bootique/bootique-metrics/actions/workflows/maven.yml)
[![Maven Central](https://img.shields.io/maven-central/v/io.bootique.metrics/bootique-metrics.svg?colorB=brightgreen)](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();
}
}
```