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:
maxlen (
int|None) – The maximum number of attributes to store, use None for no limit.attributes (
Mapping[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] |None) – The initial attributes to store.immutable (
bool) – Defaults to true. Whether to allow adding/removing of attributes after the initialisation of the instance.max_value_len (
int|None) – The maximum length of string values, use None for no limit.extended_attributes (
bool) – Deprecated. Kept for backwards compatibility. Extended attributes are now always used for attributes everywhere.
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.