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

Use a singleton diagnostics logger for Client #6832

Merged
merged 1 commit into from Sep 14, 2022
Merged

Use a singleton diagnostics logger for Client #6832

merged 1 commit into from Sep 14, 2022

Conversation

zanieb
Copy link
Contributor

@zanieb zanieb commented Sep 14, 2022

Each client "creates" a new logger which includes attaching handlers. Since Python loggers are singletons behind the scenes, this results in attaching duplicate handlers to the logger. Messages will then be duplicated per number of clients. Since task runs each have their own client, this can result in many log messages.

To resolve this, we define logger as a class variable instead of instance variable. The logger will be created once at import-time.

Closes #6831

@github-actions github-actions bot added the v1 Related to Prefect 1.x label Sep 14, 2022
Copy link
Contributor

@chrisguidry chrisguidry left a comment

Choose a reason for hiding this comment

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

Great catch!

@zanieb zanieb merged commit 7c20202 into 1.x Sep 14, 2022
@zanieb zanieb deleted the diagnostics branch September 14, 2022 21:33
@johnurbanik
Copy link

Great catch!

Thank you!

@zanieb zanieb mentioned this pull request Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1 Related to Prefect 1.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants