Package io.opentelemetry.api.common
Class Labels
- java.lang.Object
-
- io.opentelemetry.api.internal.ImmutableKeyValuePairs<String,String>
-
- io.opentelemetry.api.common.Labels
-
@Immutable public abstract class Labels extends ImmutableKeyValuePairs<String,String>
An immutable container for labels, which are pairs ofString
.
-
-
Constructor Summary
Constructors Constructor Description Labels()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static LabelsBuilder
builder()
Creates a newLabelsBuilder
instance for creating arbitraryLabels
.static Labels
empty()
Returns aLabels
instance with no attributes.abstract void
forEach(BiConsumer<String,String> consumer)
static Labels
of(String[] keyValueLabelPairs)
static Labels
of(String key, String value)
Returns aLabels
instance with a single key-value pair.static Labels
of(String key1, String value1, String key2, String value2)
Returns aLabels
instance with two key-value pairs.static Labels
of(String key1, String value1, String key2, String value2, String key3, String value3)
Returns aLabels
instance with three key-value pairs.static Labels
of(String key1, String value1, String key2, String value2, String key3, String value3, String key4, String value4)
Returns aLabels
instance with four key-value pairs.static Labels
of(String key1, String value1, String key2, String value2, String key3, String value3, String key4, String value4, String key5, String value5)
Returns aLabels
instance with five key-value pairs.LabelsBuilder
toBuilder()
Create aLabelsBuilder
pre-populated with the contents of this Labels instance.-
Methods inherited from class io.opentelemetry.api.internal.ImmutableKeyValuePairs
data, get, isEmpty, size, sortAndFilter, toString
-
-
-
-
Method Detail
-
forEach
public abstract void forEach(BiConsumer<String,String> consumer)
-
of
public static Labels of(String key, String value)
Returns aLabels
instance with a single key-value pair.
-
of
public static Labels of(String key1, String value1, String key2, String value2)
Returns aLabels
instance with two key-value pairs. Order of the keys is not preserved. Duplicate keys will be removed.
-
of
public static Labels of(String key1, String value1, String key2, String value2, String key3, String value3)
Returns aLabels
instance with three key-value pairs. Order of the keys is not preserved. Duplicate keys will be removed.
-
of
public static Labels of(String key1, String value1, String key2, String value2, String key3, String value3, String key4, String value4)
Returns aLabels
instance with four key-value pairs. Order of the keys is not preserved. Duplicate keys will be removed.
-
of
public static Labels of(String key1, String value1, String key2, String value2, String key3, String value3, String key4, String value4, String key5, String value5)
Returns aLabels
instance with five key-value pairs. Order of the keys is not preserved. Duplicate keys will be removed.
-
toBuilder
public LabelsBuilder toBuilder()
Create aLabelsBuilder
pre-populated with the contents of this Labels instance.
-
builder
public static LabelsBuilder builder()
Creates a newLabelsBuilder
instance for creating arbitraryLabels
.
-
-