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 LabelsBuilderbuilder()Creates a newLabelsBuilderinstance for creating arbitraryLabels.static Labelsempty()Returns aLabelsinstance with no attributes.abstract voidforEach(BiConsumer<String,String> consumer)static Labelsof(String[] keyValueLabelPairs)static Labelsof(String key, String value)Returns aLabelsinstance with a single key-value pair.static Labelsof(String key1, String value1, String key2, String value2)Returns aLabelsinstance with two key-value pairs.static Labelsof(String key1, String value1, String key2, String value2, String key3, String value3)Returns aLabelsinstance with three key-value pairs.static Labelsof(String key1, String value1, String key2, String value2, String key3, String value3, String key4, String value4)Returns aLabelsinstance with four key-value pairs.static Labelsof(String key1, String value1, String key2, String value2, String key3, String value3, String key4, String value4, String key5, String value5)Returns aLabelsinstance with five key-value pairs.LabelsBuildertoBuilder()Create aLabelsBuilderpre-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 aLabelsinstance with a single key-value pair.
-
of
public static Labels of(String key1, String value1, String key2, String value2)
Returns aLabelsinstance 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 aLabelsinstance 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 aLabelsinstance 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 aLabelsinstance with five key-value pairs. Order of the keys is not preserved. Duplicate keys will be removed.
-
toBuilder
public LabelsBuilder toBuilder()
Create aLabelsBuilderpre-populated with the contents of this Labels instance.
-
builder
public static LabelsBuilder builder()
Creates a newLabelsBuilderinstance for creating arbitraryLabels.
-
-