public abstract class Collector extends Object
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.
Modifier and Type | Class and Description |
---|---|
static interface |
Collector.Describable |
static class |
Collector.MetricFamilySamples
A metric, and all of its samples.
|
static class |
Collector.Type |
Modifier and Type | Field and Description |
---|---|
static double |
MILLISECONDS_PER_SECOND
Number of milliseconds in a second.
|
static double |
NANOSECONDS_PER_SECOND
Number of nanoseconds in a second.
|
Constructor and Description |
---|
Collector() |
Modifier and Type | Method and Description |
---|---|
protected 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> |
register()
Register the Collector with the default registry.
|
<T extends Collector> |
register(CollectorRegistry registry)
Register the Collector with the given registry.
|
static String |
sanitizeMetricName(String metricName)
Sanitize metric name
|
public static final double NANOSECONDS_PER_SECOND
public static final double MILLISECONDS_PER_SECOND
public Collector()
public abstract List<Collector.MetricFamilySamples> collect()
public <T extends Collector> T register()
public <T extends Collector> T register(CollectorRegistry registry)
protected static void checkMetricName(String name)
public static String sanitizeMetricName(String metricName)
protected static void checkMetricLabelName(String name)
public static String doubleToGoString(double d)
Copyright © 2018. All Rights Reserved.