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.Builder
builder()
int
boolean
Test if these labels contain a specific label name.boolean
Get 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) int
hashCode()
boolean
hasSameNames
(Labels other) boolean
hasSameValues
(Labels other) boolean
isEmpty()
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 Labels
Create a new Labels instance.static Labels
Create a new Labels instance.static Labels
Create a new Labels instance.int
size()
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.length
must 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:
compareTo
in interfaceComparable<Labels>
-
toString
-
equals
-
hashCode
-
builder
-