-
Notifications
You must be signed in to change notification settings - Fork 8
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
add log10_tags context manager and with_tags decorator #299
Conversation
1a48640
to
01cb17c
Compare
537a482
to
0338113
Compare
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.
Nice!! % comments
log10/load.py
Outdated
yield | ||
|
||
|
||
def with_tags(tags: list[str]): |
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.
I'd also add prefix to the with_tags
func like with_log10_tags
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.
added
log10/load.py
Outdated
tags_var = contextvars.ContextVar("tags", default=[]) | ||
extra_tags_var = contextvars.ContextVar("extra_tags", default=[]) |
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.
do we still need this extra_tags_var
?
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.
removed extra_tags_var
log10/load.py
Outdated
return None | ||
|
||
if not isinstance(tags, list): | ||
logger.error("tags must be a list") |
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.
would it make sense to have it as warning instead? Can you also add the message something like we're going to skip recording tags but still send the logs?
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.
updated the message.
log10/load.py
Outdated
validated_tags = [] | ||
for tag in tags: | ||
if not isinstance(tag, str): | ||
logger.warning(f"All tags must be strings, found {tag} of type {type(tag)}") |
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.
same here for the message
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.
updated the message.
log10/load.py
Outdated
# is this tags_var for log10_session? | ||
# first how does this tags_var get set and passed around? what's the option to set it by users |
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.
do we still need this comment?
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.
removed
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.
Since the change behavior of nested session tags - swing this by the broader team for input
- validate tags are list of strings, and skip a tag if it's not string
- rename with_tags to with_log10_tags - update logger warning message for invalid tags
e3b014a
to
07b6b26
Compare
No description provided.