Class Attributes.Builder
- java.lang.Object
-
- io.opentelemetry.api.common.Attributes.Builder
-
- Enclosing class:
- Attributes
public static class Attributes.Builder extends Object
Enables the creation of anAttributes
instance with an arbitrary number of key-value pairs.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Attributes
build()
Create theAttributes
from this.<T> Attributes.Builder
put(AttributeKey<Long> key, int value)
Puts aAttributeKey
with associated value into this.<T> Attributes.Builder
put(AttributeKey<T> key, T value)
Puts aAttributeKey
with associated value into this.Attributes.Builder
put(String key, boolean value)
Puts a boolean attribute into this.Attributes.Builder
put(String key, double value)
Puts a double attribute into this.Attributes.Builder
put(String key, long value)
Puts a long attribute into this.Attributes.Builder
put(String key, Boolean... value)
Puts a Boolean array attribute into this.Attributes.Builder
put(String key, Double... value)
Puts a Double array attribute into this.Attributes.Builder
put(String key, Long... value)
Puts a Long array attribute into this.Attributes.Builder
put(String key, String value)
Puts a String attribute into this.Attributes.Builder
put(String key, String... value)
Puts a String array attribute into this.Attributes.Builder
putAll(Attributes attributes)
Puts all the provided attributes into this Builder.
-
-
-
Method Detail
-
build
public Attributes build()
Create theAttributes
from this.
-
put
public <T> Attributes.Builder put(AttributeKey<Long> key, int value)
Puts aAttributeKey
with associated value into this.
-
put
public <T> Attributes.Builder put(AttributeKey<T> key, T value)
Puts aAttributeKey
with associated value into this.
-
put
public Attributes.Builder 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 Attributes.Builder 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 Attributes.Builder 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 Attributes.Builder 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 Attributes.Builder 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 Attributes.Builder 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 Attributes.Builder 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 Attributes.Builder 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 Attributes.Builder putAll(Attributes attributes)
Puts all the provided attributes into this Builder.- Returns:
- this Builder
-
-