public class GaugeMetricFamily extends Collector.MetricFamilySamples
Most users want a normal Gauge
instead.
Example usage:
class YourCustomCollector extends Collector {
List<MetricFamilySamples> collect() {
List<MetricFamilySamples> mfs = new ArrayList<MetricFamilySamples>();
// With no labels.
mfs.add(new GaugeMetricFamily("my_gauge", "help", 42));
// With labels
GaugeMetricFamily labeledGauge = new GaugeMetricFamily("my_other_gauge", "help", Arrays.asList("labelname"));
labeledGauge.addMetric(Arrays.asList("foo"), 4);
labeledGauge.addMetric(Arrays.asList("bar"), 5);
mfs.add(labeledGauge);
return mfs;
}
}
Collector.MetricFamilySamples.Sample
help, name, samples, type
Constructor and Description |
---|
GaugeMetricFamily(String name,
String help,
double value) |
GaugeMetricFamily(String name,
String help,
List<String> labelNames) |
Modifier and Type | Method and Description |
---|---|
GaugeMetricFamily |
addMetric(List<String> labelValues,
double value) |
equals, hashCode, toString
public GaugeMetricFamily(String name, String help, double value)
public GaugeMetricFamily(String name, String help, List<String> labelNames)
public GaugeMetricFamily addMetric(List<String> labelValues, double value)
Copyright © 2018. All Rights Reserved.