Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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();
}
}
```