Package io.prometheus.client
Class Collector
java.lang.Object
io.prometheus.client.Collector
- Direct Known Subclasses:
BufferPoolsExports
,CacheMetricsCollector
,ClassLoadingExports
,GarbageCollectorExports
,JettyStatisticsCollector
,MemoryAllocationExports
,MemoryPoolsExports
,QueuedThreadPoolStatisticsCollector
,SimpleCollector
,StandardExports
,ThreadExports
,VersionInfoExports
A collector for a set of metrics.
Normal users should use Gauge
, Counter
, Summary
and Histogram
.
Subclasssing Collector is for advanced uses, such as proxying metrics from another monitoring system. It is it the responsibility of subclasses to ensure they produce valid metrics.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static class
A metric, and all of its samples.static enum
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static void
checkMetricLabelName
(String name) Throw an exception if the metric label name is invalid.protected static void
checkMetricName
(String name) Throw an exception if the metric name is invalid.abstract List
<Collector.MetricFamilySamples> collect()
Return all of the metrics of this Collector.static String
doubleToGoString
(double d) Convert a double to its string representation in Go.<T extends Collector>
Tregister()
Register the Collector with the default registry.<T extends Collector>
Tregister
(CollectorRegistry registry) Register the Collector with the given registry.static String
sanitizeMetricName
(String metricName) Sanitize metric name
-
Field Details
-
NANOSECONDS_PER_SECOND
public static final double NANOSECONDS_PER_SECONDNumber of nanoseconds in a second.- See Also:
-
MILLISECONDS_PER_SECOND
public static final double MILLISECONDS_PER_SECONDNumber of milliseconds in a second.- See Also:
-
METRIC_NAME_RE
-
METRIC_LABEL_NAME_RE
-
RESERVED_METRIC_LABEL_NAME_RE
-
SANITIZE_PREFIX_PATTERN
-
SANITIZE_BODY_PATTERN
-
-
Constructor Details
-
Collector
public Collector()
-
-
Method Details
-
collect
Return all of the metrics of this Collector. -
register
Register the Collector with the default registry. -
register
Register the Collector with the given registry. -
checkMetricName
Throw an exception if the metric name is invalid. -
sanitizeMetricName
Sanitize metric name -
checkMetricLabelName
Throw an exception if the metric label name is invalid. -
doubleToGoString
Convert a double to its string representation in Go.
-