Class PrometheusMetricsProvider
- java.lang.Object
-
- org.apache.bookkeeper.stats.prometheus.PrometheusMetricsProvider
-
- All Implemented Interfaces:
StatsProvider
public class PrometheusMetricsProvider extends java.lang.Object implements StatsProvider
A Prometheus basedStatsProvider
implementation.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.concurrent.ConcurrentMap<ScopeContext,LongAdderCounter>
counters
static java.lang.String
DEFAULT_PROMETHEUS_STATS_HTTP_ADDR
static boolean
DEFAULT_PROMETHEUS_STATS_HTTP_ENABLE
static int
DEFAULT_PROMETHEUS_STATS_HTTP_PORT
static int
DEFAULT_PROMETHEUS_STATS_LATENCY_ROLLOVER_SECONDS
(package private) java.util.concurrent.ConcurrentMap<ScopeContext,SimpleGauge<? extends java.lang.Number>>
gauges
(package private) java.util.concurrent.ConcurrentMap<ScopeContext,DataSketchesOpStatsLogger>
opStats
static java.lang.String
PROMETHEUS_STATS_HTTP_ADDRESS
static java.lang.String
PROMETHEUS_STATS_HTTP_ENABLE
static java.lang.String
PROMETHEUS_STATS_HTTP_PORT
static java.lang.String
PROMETHEUS_STATS_LATENCY_ROLLOVER_SECONDS
(package private) io.prometheus.client.CollectorRegistry
registry
(package private) org.eclipse.jetty.server.Server
server
(package private) java.util.concurrent.ConcurrentMap<ScopeContext,ThreadScopedLongAdderCounter>
threadScopedCounters
(package private) java.util.concurrent.ConcurrentMap<ScopeContext,ThreadScopedDataSketchesStatsLogger>
threadScopedOpStats
-
Constructor Summary
Constructors Constructor Description PrometheusMetricsProvider()
PrometheusMetricsProvider(io.prometheus.client.CollectorRegistry registry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StatsLogger
getStatsLogger(java.lang.String scope)
Return the stats logger to a given scope.java.lang.String
getStatsName(java.lang.String... statsComponents)
Return the fully qualified stats name comprised of given statsComponents.(package private) void
rotateLatencyCollection()
void
start(org.apache.commons.configuration.Configuration conf)
Initialize the stats provider by loading the given configuration conf.void
stop()
Close the stats provider.void
writeAllMetrics(java.io.Writer writer)
-
-
-
Field Detail
-
PROMETHEUS_STATS_HTTP_ENABLE
public static final java.lang.String PROMETHEUS_STATS_HTTP_ENABLE
- See Also:
- Constant Field Values
-
DEFAULT_PROMETHEUS_STATS_HTTP_ENABLE
public static final boolean DEFAULT_PROMETHEUS_STATS_HTTP_ENABLE
- See Also:
- Constant Field Values
-
PROMETHEUS_STATS_HTTP_ADDRESS
public static final java.lang.String PROMETHEUS_STATS_HTTP_ADDRESS
- See Also:
- Constant Field Values
-
DEFAULT_PROMETHEUS_STATS_HTTP_ADDR
public static final java.lang.String DEFAULT_PROMETHEUS_STATS_HTTP_ADDR
- See Also:
- Constant Field Values
-
PROMETHEUS_STATS_HTTP_PORT
public static final java.lang.String PROMETHEUS_STATS_HTTP_PORT
- See Also:
- Constant Field Values
-
DEFAULT_PROMETHEUS_STATS_HTTP_PORT
public static final int DEFAULT_PROMETHEUS_STATS_HTTP_PORT
- See Also:
- Constant Field Values
-
PROMETHEUS_STATS_LATENCY_ROLLOVER_SECONDS
public static final java.lang.String PROMETHEUS_STATS_LATENCY_ROLLOVER_SECONDS
- See Also:
- Constant Field Values
-
DEFAULT_PROMETHEUS_STATS_LATENCY_ROLLOVER_SECONDS
public static final int DEFAULT_PROMETHEUS_STATS_LATENCY_ROLLOVER_SECONDS
- See Also:
- Constant Field Values
-
registry
final io.prometheus.client.CollectorRegistry registry
-
server
org.eclipse.jetty.server.Server server
-
counters
final java.util.concurrent.ConcurrentMap<ScopeContext,LongAdderCounter> counters
-
gauges
final java.util.concurrent.ConcurrentMap<ScopeContext,SimpleGauge<? extends java.lang.Number>> gauges
-
opStats
final java.util.concurrent.ConcurrentMap<ScopeContext,DataSketchesOpStatsLogger> opStats
-
threadScopedOpStats
final java.util.concurrent.ConcurrentMap<ScopeContext,ThreadScopedDataSketchesStatsLogger> threadScopedOpStats
-
threadScopedCounters
final java.util.concurrent.ConcurrentMap<ScopeContext,ThreadScopedLongAdderCounter> threadScopedCounters
-
-
Method Detail
-
start
public void start(org.apache.commons.configuration.Configuration conf)
Description copied from interface:StatsProvider
Initialize the stats provider by loading the given configuration conf.- Specified by:
start
in interfaceStatsProvider
- Parameters:
conf
- Configuration to configure the stats provider.
-
stop
public void stop()
Description copied from interface:StatsProvider
Close the stats provider.- Specified by:
stop
in interfaceStatsProvider
-
getStatsLogger
public StatsLogger getStatsLogger(java.lang.String scope)
Description copied from interface:StatsProvider
Return the stats logger to a given scope.- Specified by:
getStatsLogger
in interfaceStatsProvider
- Parameters:
scope
- Scope for the given stats- Returns:
- stats logger for the given scope
-
writeAllMetrics
public void writeAllMetrics(java.io.Writer writer) throws java.io.IOException
- Specified by:
writeAllMetrics
in interfaceStatsProvider
- Throws:
java.io.IOException
-
getStatsName
public java.lang.String getStatsName(java.lang.String... statsComponents)
Description copied from interface:StatsProvider
Return the fully qualified stats name comprised of given statsComponents.- Specified by:
getStatsName
in interfaceStatsProvider
- Parameters:
statsComponents
- stats components to comprise the fully qualified stats name- Returns:
- the fully qualified stats name
-
rotateLatencyCollection
void rotateLatencyCollection()
-
-