opentelemetry.attributes

class opentelemetry.attributes.BoundedAttributes(maxlen=None, attributes=None, immutable=True, max_value_len=None, extended_attributes=False)[source]

Bases: MutableMapping[str, str | bool | int | float | bytes | Sequence[AnyValue] | Mapping[str, AnyValue] | None]

A dict with a fixed max capacity which cleans and potentially drops values to ensure they are valid attribute values.

Parameters:

When the dict is full and a new element is added, the oldest element is dropped. Attributes are made to be immutable when set in this container. So passing a mutable list as an attribute value, and then mutating it after will not change it’s value in this container.

copy()[source]
Return type:

MutableMapping[str, str | bool | int | float | bytes | Sequence[str | bool | int | float | bytes | Sequence[AnyValue] | Mapping[str, AnyValue] | None] | Mapping[str, str | bool | int | float | bytes | Sequence[AnyValue] | Mapping[str, AnyValue] | None] | None]