Class Labels
Object
Labels
- All Implemented Interfaces:
Comparable<Labels>, Iterable<Label>
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionCreate a new Labels instance containing the labels of this and the label passed as name and value.static Labels.Builderbuilder()intbooleanTest if these labels contain a specific label name.booleanGet the label value for a given label name.getName(int i) getPrometheusName(int i) LikegetName(int), but dots are replaced with underscores.getValue(int i) inthashCode()booleanhasSameNames(Labels other) booleanhasSameValues(Labels other) booleanisEmpty()iterator()Create a new Labels instance containing the labels of this and the labels of other.Create a new Labels instance containing the labels of this and the labels passed as names and values.static LabelsCreate a new Labels instance.static LabelsCreate a new Labels instance.static LabelsCreate a new Labels instance.intsize()stream()toString()This must not be used in Prometheus exposition formats because names may contain dots.Methods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
EMPTY
-
-
Method Details
-
isEmpty
-
of
Create a new Labels instance. You can either create Labels with one of the staticLabels.of(...)methods, or you can use thebuilder().- Parameters:
keyValuePairs- as in{name1, value1, name2, value2}. Length must be even.PrometheusNaming.isValidLabelName(String)must be true for each name. UsePrometheusNaming.sanitizeLabelName(String)to convert arbitrary strings to valid label names. Label names must be unique (no duplicate label names).
-
of
Create a new Labels instance. You can either create Labels with one of the staticLabels.of(...)methods, or you can use thebuilder().- Parameters:
names- label names.PrometheusNaming.isValidLabelName(String)must be true for each name. UsePrometheusNaming.sanitizeLabelName(String)to convert arbitrary strings to valid label names. Label names must be unique (no duplicate label names).values- label values.names.size()must be equal tovalues.size().
-
of
Create a new Labels instance. You can either create Labels with one of the staticLabels.of(...)methods, or you can use thebuilder().- Parameters:
names- label names.PrometheusNaming.isValidLabelName(String)must be true for each name. UsePrometheusNaming.sanitizeLabelName(String)to convert arbitrary strings to valid label names. Label names must be unique (no duplicate label names).values- label values.names.lengthmust be equal tovalues.length.
-
contains
-
get
-
iterator
-
stream
-
size
-
getName
-
getPrometheusName
LikegetName(int), but dots are replaced with underscores.This is used by Prometheus exposition formats.
-
getValue
-
merge
-
merge
-
add
-
hasSameNames
-
hasSameValues
-
compareTo
- Specified by:
compareToin interfaceComparable<Labels>
-
toString
-
equals
-
hashCode
-
builder
-