You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Otel python api should support AnyValue instead of AnyAttributeValue, according to the proto definition for span attributes' value, (see KeyValue reference here)
What happened?
The trace proto definition defines span attributes to be of kind KeyValue.
The standard attribute definition SHOULD be used to represent attributes in data modeling unless there is a strong justification to diverge.
It also calls out logs as one example where "Any" is actually the allowed attribute type, but span uses standard attributes, so IMHO opentelemetry-python behavior is correct, allowing map values would make it non-conforming.
(There were also many discussions about allowing map values, nested attributes, ... in the past in the spec if you want to research why this is the case)
Summary
Otel python api should support AnyValue instead of AnyAttributeValue, according to the proto definition for span attributes' value, (see KeyValue reference here)
What happened?
The trace proto definition defines span attributes to be of kind
KeyValue
.KayValues
supports Value of kindAnyValue
BUT,
Opentelemetry-python defines span attributes' values as types.AttributeValue, which is doesn't support
AnyValue
(this is the how it is defined)The value of trace attributes should be of kind AnyValue, and not AttributeValue
This is causing the unit tests to fail in this PR open-telemetry/opentelemetry-python-contrib#3170
Steps to Reproduce
Run the unit tests in this PR open-telemetry/opentelemetry-python-contrib#3170
The PR adds map as attributes, which is supported by the proto definition of spans but not by python implementation of it https://github.com/open-telemetry/opentelemetry-python/blob/main/opentelemetry-api/src/opentelemetry/trace/span.py#L82
Expected Result
Opentelemetry python should adhere to trace proto definition as described here
So, that it can support map values as valid value in attribute values of a span, currently it doesn't support that.
Ideally https://github.com/open-telemetry/opentelemetry-python/blob/main/opentelemetry-api/src/opentelemetry/util/types.py#L21 should be used here instead of https://github.com/open-telemetry/opentelemetry-python/blob/main/opentelemetry-api/src/opentelemetry/util/types.py#L32
Actual Result
AnyValue is not sported in span attributes, and hence map values are not supported in span attributes.
Additional context
No response
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: