Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 1.65 KB

README.md

File metadata and controls

31 lines (21 loc) · 1.65 KB

Dropwizard Prometheus module

Build Status Maven Central Javadocs

Dropwizard bundle and reporter for Prometheus

Reporting to Prometheus Pushgateway

This module provides PrometheusReporter, which allows your application to constantly stream metric values to a Prometheus Pushway server:

final Pushgateway pushgateway = new Pushgateway("localhost", 9091));
final PrometheusReporter reporter = PrometheusReporter.forRegistry(registry)
                                              .prefixedWith("web1.example.com")
                                              .filter(MetricFilter.ALL)
                                              .build(pushgateway);
reporter.start(1, TimeUnit.MINUTES);

Prometheus servlet

You can also use PrometheusBundle, which starts a new admin servlet exposing metric values to a Prometheus server.

@Override
public void initialize(Bootstrap<DsnConfiguration> bootstrap) {
    bootstrap.addBundle(new PrometheusBundle());
}

After the Dropwizard application server start, a new endpoint /prometheus-metrics will be accessible with admin endpoint.