opentelemetry-python
opentelemetry-python copied to clipboard
Add more informative/restrictive typing to `Log` `body` field
Describe your environment
OS: (e.g, Ubuntu) Python version: (e.g., Python 3.8.10) SDK version: (e.g., 1.25.0) API version: (e.g., 1.25.0)
What happened?
From this comment: https://github.com/open-telemetry/opentelemetry-python/pull/4054#discussion_r1715595661
Change the typing of LogRecord to restrict to the data model definition of Any instead of Python's Any type.
Steps to Reproduce
See notes.
Expected Result
See notes.
Actual Result
See notes.
Additional context
No response
Would you like to implement a fix?
None
when #4128 gets merged I would also like to take this up as it is related to it, afaik we just need to make the options take the exporter types, also would like to know if some tests we gonna be writing regarding this ?
@wasup-yash
Yeah we pretty much want to use a Union of these types instead of the Python any. It will definitely be good to add some tests for this (pass in the various valid/invalid types to try to create a LogRecord).
Hi @lzchen can I take this ?
@Ali-Alnosairi
As @xrmx has mentioned, please choose one issue to work on and open a PR accordingly instead of working on multiple different issues.
Hey @lzchen, can I pick this one up?
use a
Unionof these types
I am about to create a union for the Any type , but I wanted to ask where to add it, is it fine to add it here or create new file !
@lzchen would you please help !