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.Describable
OpenCensus Metrics
Collector
for Prometheus.- Since:
- 0.12
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
private static final class
Nested classes/interfaces inherited from class io.prometheus.client.Collector
io.prometheus.client.Collector.Describable, io.prometheus.client.Collector.MetricFamilySamples, io.prometheus.client.Collector.Type
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MetricReader
private static final String
private final MetricReader
private static final String
private static final Logger
private final String
private static final Tracer
Fields inherited from class io.prometheus.client.Collector
MILLISECONDS_PER_SECOND, NANOSECONDS_PER_SECOND
-
Constructor Summary
ConstructorsConstructorDescriptionPrometheusStatsCollector
(MetricProducerManager metricProducerManager, String namespace) -
Method Summary
Modifier and TypeMethodDescriptionList
<io.prometheus.client.Collector.MetricFamilySamples> collect()
static void
Creates aPrometheusStatsCollector
and registers it to PrometheusCollectorRegistry.defaultRegistry
.static void
createAndRegister
(PrometheusStatsConfiguration configuration) Creates aPrometheusStatsCollector
and registers it to the given PrometheusCollectorRegistry
in thePrometheusStatsConfiguration
.List
<io.prometheus.client.Collector.MetricFamilySamples> describe()
private static String
Methods inherited from class io.prometheus.client.Collector
checkMetricLabelName, checkMetricName, collect, doubleToGoString, register, register, sanitizeMetricName
-
Field Details
-
logger
-
tracer
-
DESCRIBE_METRICS_FOR_PROMETHEUS
- See Also:
-
EXPORT_METRICS_TO_PROMETHEUS
- See Also:
-
collectMetricReader
-
describeMetricReader
-
namespace
-
-
Constructor Details
-
PrometheusStatsCollector
PrometheusStatsCollector(MetricProducerManager metricProducerManager, String namespace)
-
-
Method Details
-
createAndRegister
public static void createAndRegister()Creates aPrometheusStatsCollector
and registers it to PrometheusCollectorRegistry.defaultRegistry
.This is equivalent with:
PrometheusStatsCollector.createAndRegister(PrometheusStatsConfiguration.builder().build());
- Throws:
IllegalArgumentException
- if aPrometheusStatsCollector
has already been created and registered.- Since:
- 0.12
-
createAndRegister
Creates aPrometheusStatsCollector
and registers it to the given PrometheusCollectorRegistry
in thePrometheusStatsConfiguration
.If
CollectorRegistry
of the configuration is not set, the collector will useCollectorRegistry.defaultRegistry
.- Throws:
IllegalArgumentException
- if aPrometheusStatsCollector
has already been created and registered.- Since:
- 0.13
-
collect
- Specified by:
collect
in classio.prometheus.client.Collector
-
describe
- Specified by:
describe
in interfaceio.prometheus.client.Collector.Describable
-
exceptionMessage
-