opentelemetry-python icon indicating copy to clipboard operation
opentelemetry-python copied to clipboard

Add more informative/restrictive typing to `Log` `body` field

Open lzchen opened this issue 1 year ago • 2 comments

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

lzchen avatar Aug 15 '24 16:08 lzchen

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 avatar Aug 16 '24 13:08 wasup-yash

@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).

lzchen avatar Aug 16 '24 18:08 lzchen

Hi @lzchen can I take this ?

Ali-Alnosairi avatar Sep 09 '24 22:09 Ali-Alnosairi

@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.

lzchen avatar Sep 10 '24 15:09 lzchen

Hey @lzchen, can I pick this one up?

Krishn1412 avatar Sep 11 '24 05:09 Krishn1412

use a Union of 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 !

Ali-Alnosairi avatar Sep 11 '24 23:09 Ali-Alnosairi