Skip to content
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

Merged
merged 5 commits into from
Oct 1, 2024

Conversation

wenzhe-log10
Copy link
Collaborator

No description provided.

log10/load.py Outdated Show resolved Hide resolved
@wenzhe-log10 wenzhe-log10 changed the title add add_tags context manager and with_tags decorator add log10_tags context manager and with_tags decorator Sep 19, 2024
@wenzhe-log10 wenzhe-log10 marked this pull request as ready for review September 20, 2024 16:33
Copy link
Collaborator

@kxtran kxtran left a 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]):
Copy link
Collaborator

@kxtran kxtran Sep 23, 2024

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

Copy link
Collaborator Author

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=[])
Copy link
Collaborator

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?

Copy link
Collaborator Author

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")
Copy link
Collaborator

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?

Copy link
Collaborator Author

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)}")
Copy link
Collaborator

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

Copy link
Collaborator Author

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
Comment on lines 116 to 117
# 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
Copy link
Collaborator

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Copy link
Contributor

@nqn nqn left a 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

@wenzhe-log10 wenzhe-log10 force-pushed the wenzhe/eng-1148-set-default-tags branch from e3b014a to 07b6b26 Compare October 1, 2024 22:20
@wenzhe-log10 wenzhe-log10 merged commit 72e5f18 into main Oct 1, 2024
3 checks passed
@wenzhe-log10 wenzhe-log10 deleted the wenzhe/eng-1148-set-default-tags branch October 1, 2024 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants