Top Description Methods
io.opentelemetry.api.common

public Interface AttributesBuilder

Known Direct Implementers
io.opentelemetry.api.common.ArrayBackedAttributesBuilder
Static Imports
io.opentelemetry.api.common.ArrayBackedAttributesBuilder.toList, .AttributeKey.booleanArrayKey, .AttributeKey.booleanKey, .AttributeKey.doubleArrayKey, .AttributeKey.doubleKey, .AttributeKey.longArrayKey, .AttributeKey.longKey, .AttributeKey.stringArrayKey, .AttributeKey.stringKey

A builder of Attributes supporting an arbitrary number of key-value pairs.

Method Summary

Modifier and TypeMethod and Description
public Attributes
build()

Create the Attributes from this.

public <T> AttributesBuilder
put(AttributeKey<Long> key, int value)

Puts a AttributeKey with associated value into this.

public <T> AttributesBuilder
put(AttributeKey<T> key, T value)

Puts a AttributeKey with associated value into this.

public default AttributesBuilder

Returns:

this Builder
put
(String key, String value)

Puts a String attribute into this.

public default AttributesBuilder

Returns:

this Builder
put
(String key, long value)

Puts a long attribute into this.

public default AttributesBuilder

Returns:

this Builder
put
(String key, double value)

Puts a double attribute into this.

public default AttributesBuilder

Returns:

this Builder
put
(String key, boolean value)

Puts a boolean attribute into this.

public default AttributesBuilder

Returns:

this Builder
put
(String key, String... value)

Puts a String array attribute into this.

public default <T> AttributesBuilder

Returns:

this Builder
put
(AttributeKey<List<T>> key, T... value)

Puts a List attribute into this.

public default AttributesBuilder

Returns:

this Builder
put
(String key, long... value)

Puts a Long array attribute into this.

public default AttributesBuilder

Returns:

this Builder
put
(String key, double... value)

Puts a Double array attribute into this.

public default AttributesBuilder

Returns:

this Builder
put
(String key, boolean... value)

Puts a Boolean array attribute into this.

public AttributesBuilder

Returns:

this Builder
putAll
(Attributes attributes)

Puts all the provided attributes into this Builder.

public default <T> AttributesBuilder

Returns:

this Builder
remove
(AttributeKey<T> key)

Remove all attributes where AttributeKey#getKey() and AttributeKey#getType() match the key.

public default AttributesBuilder

Returns:

this Builder
removeIf
(Predicate<AttributeKey<?>> filter)

Remove all attributes that satisfy the given predicate.

Method Detail

buildback to summary
public Attributes build()

Create the Attributes from this.

putback to summary
public <T> AttributesBuilder put(AttributeKey<Long> key, int value)

Puts a AttributeKey with associated value into this.

The type parameter is unused.

putback to summary
public <T> AttributesBuilder put(AttributeKey<T> key, T value)

Puts a AttributeKey with associated value into this.

putback to summary
public default 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:AttributesBuilder

this Builder

putback to summary
public default 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:AttributesBuilder

this Builder

putback to summary
public default 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:AttributesBuilder

this Builder

putback to summary
public default 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:AttributesBuilder

this Builder

putback to summary
public default 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:AttributesBuilder

this Builder

putback to summary
public default <T> AttributesBuilder put(AttributeKey<List<T>> key, T... value)

Puts a List attribute into this.

Returns:AttributesBuilder

this Builder

Annotations
@SuppressWarnings:unchecked
putback to summary
public default 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:AttributesBuilder

this Builder

putback to summary
public default 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:AttributesBuilder

this Builder

putback to summary
public default 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:AttributesBuilder

this Builder

putAllback to summary
public AttributesBuilder putAll(Attributes attributes)

Puts all the provided attributes into this Builder.

Returns:AttributesBuilder

this Builder

removeback to summary
public default <T> AttributesBuilder remove(AttributeKey<T> key)

Remove all attributes where AttributeKey#getKey() and AttributeKey#getType() match the key.

Returns:AttributesBuilder

this Builder

removeIfback to summary
public default AttributesBuilder removeIf(Predicate<AttributeKey<?>> filter)

Remove all attributes that satisfy the given predicate. Errors or runtime exceptions thrown by the predicate are relayed to the caller.

Returns:AttributesBuilder

this Builder