///////////////////////////////////////////////////////////////////////////////

    Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

///////////////////////////////////////////////////////////////////////////////

= Prometheus Metrics
:description: Helidon Prometheus metrics
:keywords: helidon, metrics, prometheus

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 <<metrics/01_metrics.adoc,Helidon Metrics>>.

== Prerequisites

Declare the following dependency in your project:

[source,xml,subs="verbatim,attributes"]
----
    <dependency>
        <groupId>io.helidon.metrics</groupId>
        <artifactId>helidon-metrics-prometheus</artifactId>
    </dependency>
----

== Using Prometheus metrics in your application
To enable Prometheus metrics, register it with the web server.

[source,java]
----
import io.helidon.metrics.prometheus.PrometheusSupport;
//...

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

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.
