Prometheus Metrics

Helidon WebServer can serve Prometheus metrics.

This document describes how to register Prometheus support with WebServer and how to customize the configuration. For information about using Prometheus, see the Prometheus documentation: https://prometheus.io/docs/introduction/overview/.

Note that Helidon has an in-built metrics implementation. See Helidon Metrics.

Maven Coordinates

To enable Prometheus Metrics add the following dependency to your project’s pom.xml (see Managing Dependencies).

    <dependency>
        <groupId>io.helidon.metrics</groupId>
        <artifactId>helidon-metrics-prometheus</artifactId>
    </dependency>
Copied

Using Prometheus metrics in your application

To enable Prometheus metrics, register it with the web server.

import io.helidon.metrics.prometheus.PrometheusSupport;
//...

Routing.builder()
                .register(PrometheusSupport.create())
                .register("/myapp", new MyService())
                .build();
Copied

This example uses the default CollectorRegistry and exposes an endpoint /metrics. You can use fluent API builder obtained by PrometheusSupport.builder() to configure a different CollectorRegistry or a different path.