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 classLabels.BuilderEnables the creation of anLabelsinstance 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.Builderbuilder()Creates a newLabels.Builderinstance for creating arbitraryLabels.static Labelsempty()Returns aLabelsinstance with no attributes.abstract voidforEach(BiConsumer<String,String> consumer)Vget(K key)booleanisEmpty()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.intsize()Labels.BuildertoBuilder()Create aLabels.Builderpre-populated with the contents of this Labels instance.StringtoString()
-
-
-
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 Labels.Builder toBuilder()
Create aLabels.Builderpre-populated with the contents of this Labels instance.
-
builder
public static Labels.Builder builder()
Creates a newLabels.Builderinstance for creating arbitraryLabels.
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
get
@Nullable public V get(K key)
-
-