-
Notifications
You must be signed in to change notification settings - Fork 652
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: introduce LogAttributes type #4342
base: main
Are you sure you want to change the base?
Conversation
@@ -273,7 +273,7 @@ def get_logger( | |||
instrumenting_library_version: str = "", | |||
logger_provider: Optional[LoggerProvider] = None, | |||
schema_url: Optional[str] = None, | |||
attributes: Optional[Attributes] = None, | |||
attributes: LogAttributes = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason not to have them as Optional
like other params?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are, it's just that it's not repeated :)
LogAttributes = Optional[Mapping[str, "AnyValue"]]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but that's not really common. This usually leads to a wrong type inside the function, because you usually want different logic between None
(default), and the actual type.
@@ -273,7 +273,7 @@ def get_logger( | |||
instrumenting_library_version: str = "", | |||
logger_provider: Optional[LoggerProvider] = None, | |||
schema_url: Optional[str] = None, | |||
attributes: Optional[Attributes] = None, | |||
attributes: LogAttributes = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but that's not really common. This usually leads to a wrong type inside the function, because you usually want different logic between None
(default), and the actual type.
Logs attribute accepts AnyValue as AttributeValue add a type to describe that and start using it.
66ec409
to
57a6fb3
Compare
@@ -56,3 +56,5 @@ | |||
], | |||
..., | |||
] | |||
|
|||
LogAttributes = Mapping[str, "AnyValue"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the last discussions in Spec and Log SIG, calling the LogAttributes
may be problematic since we may eventually support complex attributes on events and spans. So we should consider calling them something signal-agnostic (ComplexAttributes
, ExtendedAttributes
, etc).
I'd suggest to hold this PR back for a bit - I'll bring it up on the spec call after the holidays and let's try to pick a consistent name across different languages.
Description
Logs attribute accepts AnyValue as AttributeValue add a type to describe that and start using it.
Fixes #4315
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Contrib Repo Change?
Checklist: