Class AttributesBuilder
- java.lang.Object
-
- io.opentelemetry.api.common.AttributesBuilder
-
public class AttributesBuilder extends Object
A builder ofAttributessupporting an arbitrary number of key-value pairs.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Attributesbuild()Create theAttributesfrom this.<T> AttributesBuilderput(AttributeKey<Long> key, int value)Puts aAttributeKeywith associated value into this.<T> AttributesBuilderput(AttributeKey<T> key, T value)Puts aAttributeKeywith associated value into this.AttributesBuilderput(String key, boolean value)Puts a boolean attribute into this.AttributesBuilderput(String key, double value)Puts a double attribute into this.AttributesBuilderput(String key, long value)Puts a long attribute into this.AttributesBuilderput(String key, Boolean... value)Puts a Boolean array attribute into this.AttributesBuilderput(String key, Double... value)Puts a Double array attribute into this.AttributesBuilderput(String key, Long... value)Puts a Long array attribute into this.AttributesBuilderput(String key, String value)Puts a String attribute into this.AttributesBuilderput(String key, String... value)Puts a String array attribute into this.AttributesBuilderputAll(Attributes attributes)Puts all the provided attributes into this Builder.
-
-
-
Method Detail
-
build
public Attributes build()
Create theAttributesfrom this.
-
put
public <T> AttributesBuilder put(AttributeKey<Long> key, int value)
Puts aAttributeKeywith associated value into this.
-
put
public <T> AttributesBuilder put(AttributeKey<T> key, T value)
Puts aAttributeKeywith associated value into this.
-
put
public AttributesBuilder put(String key, String value)
Puts a String attribute into this.Note: It is strongly recommended to use
put(AttributeKey, Object), and pre-allocate your keys, if possible.- Returns:
- this Builder
-
put
public AttributesBuilder put(String key, long value)
Puts a long attribute into this.Note: It is strongly recommended to use
put(AttributeKey, Object), and pre-allocate your keys, if possible.- Returns:
- this Builder
-
put
public AttributesBuilder put(String key, double value)
Puts a double attribute into this.Note: It is strongly recommended to use
put(AttributeKey, Object), and pre-allocate your keys, if possible.- Returns:
- this Builder
-
put
public AttributesBuilder put(String key, boolean value)
Puts a boolean attribute into this.Note: It is strongly recommended to use
put(AttributeKey, Object), and pre-allocate your keys, if possible.- Returns:
- this Builder
-
put
public AttributesBuilder put(String key, String... value)
Puts a String array attribute into this.Note: It is strongly recommended to use
put(AttributeKey, Object), and pre-allocate your keys, if possible.- Returns:
- this Builder
-
put
public AttributesBuilder put(String key, Long... value)
Puts a Long array attribute into this.Note: It is strongly recommended to use
put(AttributeKey, Object), and pre-allocate your keys, if possible.- Returns:
- this Builder
-
put
public AttributesBuilder put(String key, Double... value)
Puts a Double array attribute into this.Note: It is strongly recommended to use
put(AttributeKey, Object), and pre-allocate your keys, if possible.- Returns:
- this Builder
-
put
public AttributesBuilder put(String key, Boolean... value)
Puts a Boolean array attribute into this.Note: It is strongly recommended to use
put(AttributeKey, Object), and pre-allocate your keys, if possible.- Returns:
- this Builder
-
putAll
public AttributesBuilder putAll(Attributes attributes)
Puts all the provided attributes into this Builder.- Returns:
- this Builder
-
-