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