Skip to content

dhatim/dropwizard-prometheus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.