Package io.opentelemetry.api.common
Class Labels
- java.lang.Object
-
- io.opentelemetry.api.common.Labels
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Labels.Builder
Enables the creation of anLabels
instance with an arbitrary number of key-value pairs.
-
Constructor Summary
Constructors Constructor Description Labels()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static Labels.Builder
builder()
Creates a newLabels.Builder
instance for creating arbitraryLabels
.static Labels
empty()
Returns aLabels
instance with no attributes.abstract void
forEach(BiConsumer<String,String> consumer)
V
get(K key)
boolean
isEmpty()
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.int
size()
Labels.Builder
toBuilder()
Create aLabels.Builder
pre-populated with the contents of this Labels instance.String
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 Labels.Builder toBuilder()
Create aLabels.Builder
pre-populated with the contents of this Labels instance.
-
builder
public static Labels.Builder builder()
Creates a newLabels.Builder
instance for creating arbitraryLabels
.
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
get
@Nullable public V get(K key)
-
-