Package io.prometheus.client
Class Collector.MetricFamilySamples
java.lang.Object
io.prometheus.client.Collector.MetricFamilySamples
- Direct Known Subclasses:
CounterMetricFamily,GaugeMetricFamily,SummaryMetricFamily
- Enclosing class:
Collector
A metric, and all of its samples.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA single Sample, with a unique name and set of labels. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMetricFamilySamples(String name, Collector.Type type, String help, List<Collector.MetricFamilySamples.Sample> samples) MetricFamilySamples(String name, String unit, Collector.Type type, String help, List<Collector.MetricFamilySamples.Sample> samples) -
Method Summary
-
Field Details
-
name
-
unit
-
type
-
help
-
samples
-
-
Constructor Details
-
MetricFamilySamples
public MetricFamilySamples(String name, Collector.Type type, String help, List<Collector.MetricFamilySamples.Sample> samples) -
MetricFamilySamples
public MetricFamilySamples(String name, String unit, Collector.Type type, String help, List<Collector.MetricFamilySamples.Sample> samples)
-
-
Method Details
-
filter
- Parameters:
sampleNameFilter- may benullindicating that the result contains the complete list of samples.- Returns:
- A new MetricFamilySamples containing only the Samples matching the
sampleNameFilter, ornullif no Sample matches.
-
getNames
List of names that are reserved for Samples in these MetricsFamilySamples.This is used in two places:
- To check potential name collisions in
CollectorRegistry.register(Collector). - To check if a collector may contain metrics matching the metric name filter
in
Collector.collect(Predicate).
getNames()always includes the name without suffix, even though some metrics types (like Counter) will not have a Sample with that name. The reason is that the name without suffix is used in the metadata comments (# TYPE,# UNIT,# HELP), and as this name must be unique we include the name without suffix here as well. - To check potential name collisions in
-
equals
-
hashCode
public int hashCode() -
toString
-