public class CollectorRegistry extends Object
The majority of users should use the defaultRegistry
, rather than instantiating their own.
Creating a registry other than the default is primarily useful for unittests, or pushing a subset of metrics to the Pushgateway from batch jobs.
Modifier and Type | Field and Description |
---|---|
static CollectorRegistry |
defaultRegistry
The default registry.
|
Constructor and Description |
---|
CollectorRegistry() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Unregister all Collectors.
|
Double |
getSampleValue(String name)
Returns the given value, or null if it doesn't exist.
|
Double |
getSampleValue(String name,
String[] labelNames,
String[] labelValues)
Returns the given value, or null if it doesn't exist.
|
Enumeration<Collector.MetricFamilySamples> |
metricFamilySamples()
Enumeration of metrics of all registered collectors.
|
void |
register(Collector m)
Register a Collector.
|
void |
unregister(Collector m)
Unregister a Collector.
|
public static final CollectorRegistry defaultRegistry
public CollectorRegistry()
public void register(Collector m)
A collector can be registered to multiple CollectorRegistries.
public void unregister(Collector m)
public void clear()
public Enumeration<Collector.MetricFamilySamples> metricFamilySamples()
public Double getSampleValue(String name)
This is inefficient, and intended only for use in unittests.
public Double getSampleValue(String name, String[] labelNames, String[] labelValues)
This is inefficient, and intended only for use in unittests.
Copyright © 2016. All rights reserved.