Package org.forgerock.monitoring.http
Class PrometheusHandler
java.lang.Object
org.forgerock.monitoring.http.PrometheusHandler
- All Implemented Interfaces:
org.forgerock.http.Handler
An HTTP
Handler
from which Prometheus and
OpenTelemetry Collector can scrape monitoring information.-
Field Summary
Modifier and TypeFieldDescriptionList of HTTP methods supported by a Prometheus Handler. -
Method Summary
Modifier and TypeMethodDescriptionPromise<org.forgerock.http.protocol.Response,
NeverThrowsException> handle
(org.forgerock.services.context.Context context, org.forgerock.http.protocol.Request request) static PrometheusHandler
prometheusHandler
(String metricPrefix, Supplier<MeterRegistry> meterRegistrySupplier) Returns a new Prometheus Handler configured to use the legacy output format.static PrometheusHandler
prometheusHandler
(String metricPrefix, Supplier<MeterRegistry> meterRegistrySupplier, BooleanSupplier compliantOutputFormat) Returns a new Prometheus Handler which can be switched to use different output formats.
-
Field Details
-
SUPPORTED_HTTP_METHODS
List of HTTP methods supported by a Prometheus Handler.
-
-
Method Details
-
prometheusHandler
public static PrometheusHandler prometheusHandler(String metricPrefix, Supplier<MeterRegistry> meterRegistrySupplier) Returns a new Prometheus Handler configured to use the legacy output format. Note: this method is deprecated. Callers should useprometheusHandler(String, Supplier, BooleanSupplier)
instead- Parameters:
metricPrefix
- The prefix that will be prepended before each metric. Ideally this will be the product specific prefix.meterRegistrySupplier
- ASupplier
of theMetricRegistry
which will be used to collect metrics to include in HTTP response sent by thisPrometheusHandler
.- Returns:
- a new
PrometheusHandler
-
prometheusHandler
public static PrometheusHandler prometheusHandler(String metricPrefix, Supplier<MeterRegistry> meterRegistrySupplier, BooleanSupplier compliantOutputFormat) Returns a new Prometheus Handler which can be switched to use different output formats.- Parameters:
metricPrefix
- The prefix that will be prepended before each metric. Ideally this will be the product specific prefix.meterRegistrySupplier
- ASupplier
of theMetricRegistry
which will be used to collect metrics to include in HTTP response sent by thisPrometheusHandler
.compliantOutputFormat
- Returns a boolean used to switch the prometheus handler output format from compliant (iftrue
) to legacy (iffalse
)- Returns:
- a new
PrometheusHandler
-
handle
public Promise<org.forgerock.http.protocol.Response,NeverThrowsException> handle(org.forgerock.services.context.Context context, org.forgerock.http.protocol.Request request) - Specified by:
handle
in interfaceorg.forgerock.http.Handler
-