Dropwizard bundle and reporter for Prometheus
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);
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.