Package org.forgerock.monitoring.http
Class PrometheusHandler
- java.lang.Object
-
- org.forgerock.monitoring.http.PrometheusHandler
-
- All Implemented Interfaces:
org.forgerock.http.Handler
public final class PrometheusHandler extends Object implements org.forgerock.http.Handler
An HTTPHandlerfrom which Prometheus and OpenTelemetry Collector can scrape monitoring information.
-
-
Field Summary
Fields Modifier and Type Field Description static List<String>SUPPORTED_HTTP_METHODSList of HTTP methods supported by a Prometheus Handler.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Promise<org.forgerock.http.protocol.Response,NeverThrowsException>handle(org.forgerock.services.context.Context context, org.forgerock.http.protocol.Request request)static PrometheusHandlerprometheusHandler(String metricPrefix, Supplier<MeterRegistry> meterRegistrySupplier)Returns a new Prometheus Handler configured to use the legacy output format.static PrometheusHandlerprometheusHandler(String metricPrefix, Supplier<MeterRegistry> meterRegistrySupplier, BooleanSupplier compliantOutputFormat)Returns a new Prometheus Handler which can be switched to use different output formats.
-
-
-
Method Detail
-
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- ASupplierof theMetricRegistrywhich 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- ASupplierof theMetricRegistrywhich 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:
handlein interfaceorg.forgerock.http.Handler
-
-