Package io.prometheus.client
Class GaugeMetricFamily
- java.lang.Object
-
- io.prometheus.client.Collector.MetricFamilySamples
-
- io.prometheus.client.GaugeMetricFamily
-
public class GaugeMetricFamily extends Collector.MetricFamilySamples
Gauge metric family, for custom collectors and exporters.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; } }
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.prometheus.client.Collector.MetricFamilySamples
Collector.MetricFamilySamples.Sample
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.String>
labelNames
-
Constructor Summary
Constructors Constructor Description GaugeMetricFamily(java.lang.String name, java.lang.String help, double value)
GaugeMetricFamily(java.lang.String name, java.lang.String help, java.util.List<java.lang.String> labelNames)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GaugeMetricFamily
addMetric(java.util.List<java.lang.String> labelValues, double value)
-
-
-
Method Detail
-
addMetric
public GaugeMetricFamily addMetric(java.util.List<java.lang.String> labelValues, double value)
-
-