Package org.apache.hadoop.metrics2.sink
Class PrometheusMetricsSink
java.lang.Object
org.apache.hadoop.metrics2.sink.PrometheusMetricsSink
- All Implemented Interfaces:
MetricsPlugin,MetricsSink
Metrics sink for prometheus exporter.
Stores the metric data in-memory and return with it on request.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidflush()Flush any buffered metricsvoidinit(org.apache.commons.configuration2.SubsetConfiguration conf) Initialize the pluginprometheusName(String recordName, String metricName) Convert CamelCase based names to lower-case names where the separator is the underscore, to follow prometheus naming conventions.voidputMetrics(MetricsRecord metricsRecord) Put a metrics record in the sinkvoidwriteMetrics(Writer writer)
-
Constructor Details
-
PrometheusMetricsSink
public PrometheusMetricsSink()
-
-
Method Details
-
putMetrics
Description copied from interface:MetricsSinkPut a metrics record in the sink- Specified by:
putMetricsin interfaceMetricsSink- Parameters:
metricsRecord- the record to put
-
prometheusName
Convert CamelCase based names to lower-case names where the separator is the underscore, to follow prometheus naming conventions. This method utilizes a cache to improve performance.Reference:
- Parameters:
metricName- metricName.recordName- recordName.- Returns:
- prometheusName.
-
flush
public void flush()Description copied from interface:MetricsSinkFlush any buffered metrics- Specified by:
flushin interfaceMetricsSink
-
init
public void init(org.apache.commons.configuration2.SubsetConfiguration conf) Description copied from interface:MetricsPluginInitialize the plugin- Specified by:
initin interfaceMetricsPlugin- Parameters:
conf- the configuration object for the plugin
-
writeMetrics
- Throws:
IOException
-