Skip to content

BoundedAttributes validation is too strict for logs #4515

Open
@xrmx

Description

@xrmx

Describe your environment

OS: (e.g, Ubuntu)
Python version: (e.g., Python 3.8.10)
SDK version: (e.g., 1.25.0) 1.31.1
API version: (e.g., 1.25.0) 1.31.1

What happened?

When we create LogRecord instances we convert the attributes to instances of BoundedAttributes.
BoundedAttributes validates values to be one of bool, str, bytes, int, float when in log we should support AnyValue as stated by the spec https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-attributes

Steps to Reproduce

Send a dict as attribute value

Expected Result

Dict attribute is serialized

Actual Result

Warning is raised instead Invalid type dict for attribute 'request_header' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types

Additional context

No response

Would you like to implement a fix?

None

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions