Class PrometheusStatsCollector
- java.lang.Object
-
- io.prometheus.client.Collector
-
- io.opencensus.exporter.stats.prometheus.PrometheusStatsCollector
-
- All Implemented Interfaces:
io.prometheus.client.Collector.Describable
public final class PrometheusStatsCollector extends io.prometheus.client.Collector implements io.prometheus.client.Collector.DescribableOpenCensus MetricsCollectorfor Prometheus.- Since:
- 0.12
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classPrometheusStatsCollector.DescribeMetricExporterprivate static classPrometheusStatsCollector.ExportMetricExporter
-
Field Summary
Fields Modifier and Type Field Description private MetricReadercollectMetricReaderprivate static java.lang.StringDESCRIBE_METRICS_FOR_PROMETHEUSprivate MetricReaderdescribeMetricReaderprivate static java.lang.StringEXPORT_METRICS_TO_PROMETHEUSprivate static java.util.logging.Loggerloggerprivate java.lang.Stringnamespaceprivate static Tracertracer
-
Constructor Summary
Constructors Constructor Description PrometheusStatsCollector(MetricProducerManager metricProducerManager, java.lang.String namespace)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<io.prometheus.client.Collector.MetricFamilySamples>collect()static voidcreateAndRegister()Creates aPrometheusStatsCollectorand registers it to PrometheusCollectorRegistry.defaultRegistry.static voidcreateAndRegister(PrometheusStatsConfiguration configuration)Creates aPrometheusStatsCollectorand registers it to the given PrometheusCollectorRegistryin thePrometheusStatsConfiguration.java.util.List<io.prometheus.client.Collector.MetricFamilySamples>describe()private static java.lang.StringexceptionMessage(java.lang.Throwable e)
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
tracer
private static final Tracer tracer
-
DESCRIBE_METRICS_FOR_PROMETHEUS
private static final java.lang.String DESCRIBE_METRICS_FOR_PROMETHEUS
- See Also:
- Constant Field Values
-
EXPORT_METRICS_TO_PROMETHEUS
private static final java.lang.String EXPORT_METRICS_TO_PROMETHEUS
- See Also:
- Constant Field Values
-
collectMetricReader
private final MetricReader collectMetricReader
-
describeMetricReader
private final MetricReader describeMetricReader
-
namespace
private final java.lang.String namespace
-
-
Constructor Detail
-
PrometheusStatsCollector
PrometheusStatsCollector(MetricProducerManager metricProducerManager, java.lang.String namespace)
-
-
Method Detail
-
createAndRegister
public static void createAndRegister()
Creates aPrometheusStatsCollectorand registers it to PrometheusCollectorRegistry.defaultRegistry.This is equivalent with:
PrometheusStatsCollector.createAndRegister(PrometheusStatsConfiguration.builder().build());- Throws:
java.lang.IllegalArgumentException- if aPrometheusStatsCollectorhas already been created and registered.- Since:
- 0.12
-
createAndRegister
public static void createAndRegister(PrometheusStatsConfiguration configuration)
Creates aPrometheusStatsCollectorand registers it to the given PrometheusCollectorRegistryin thePrometheusStatsConfiguration.If
CollectorRegistryof the configuration is not set, the collector will useCollectorRegistry.defaultRegistry.- Throws:
java.lang.IllegalArgumentException- if aPrometheusStatsCollectorhas already been created and registered.- Since:
- 0.13
-
collect
public java.util.List<io.prometheus.client.Collector.MetricFamilySamples> collect()
- Specified by:
collectin classio.prometheus.client.Collector
-
describe
public java.util.List<io.prometheus.client.Collector.MetricFamilySamples> describe()
- Specified by:
describein interfaceio.prometheus.client.Collector.Describable
-
exceptionMessage
private static java.lang.String exceptionMessage(java.lang.Throwable e)
-
-