-
Notifications
You must be signed in to change notification settings - Fork 644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logs API and SDK: logs attributes are allowed to have AnyValue values #4315
Comments
We already have AnyValue here
IIUC, we should just use that in place of |
we can't change I'm not an expert in Python API design and there could be much nicer ways to achieve it, but I'd create a |
👍 I'm just proposing to change it for the Logging API only and leave other signals with the existing
Since |
I believe we would replace |
I think it's also important to allow standard I.e. I should be able to write attributes = Attributes(...)
counter.add(1, attributes=attributes)
logger.emit(LogRecord(..., attributes=attributes) if PS: please ignore my concern if pythonic implicit type conversions make it irrelevant. In any case, I suggest to write a test that uses standard attributes on a log record and make sure it works and does not raise type-checker errors |
Ah yes that's the case, attributes = {"foo": "bar"}
counter.add(1, attributes=attributes)
logger.emit(LogRecord(..., attributes=attributes) should work fine |
We should probably still do this no? |
Did a PR to check this, it's in draft because I don't want this in the next release. |
Spec requires log API to support
any
in attribute types https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md#field-attributesLogRecord
uses the sameAttributes
type as other signals and does not supportany
attribute valueopentelemetry-python/opentelemetry-api/src/opentelemetry/util/types.py
Lines 18 to 27 in f639606
The recommendation is to:
Attributes
- see Attributes "hell" opentelemetry-specification#4201 for the contextAs long as p2 can be done incrementally, the lack of it should not block logs API/SDK stability.
It might, however block stability of logging handler bridge which should be able to create anyvalue attributes.
Part of open-telemetry/community#1751
The text was updated successfully, but these errors were encountered: