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

Set uvicorn server log level #217

Merged
merged 4 commits into from
Mar 15, 2021
Merged

Set uvicorn server log level #217

merged 4 commits into from
Mar 15, 2021

Conversation

peterroelants
Copy link
Contributor

@peterroelants peterroelants commented Mar 15, 2021

Summary

Set graphql uvicorn server log level based on Prefect config.

Solves #216

Importance

Allows the user to control the access logs of the Prefect GraphQL service (which can become quite large on the default DEBUG level).

Checklist

This PR:

  • adds new tests (N/A)
  • adds a change file in the changes/ directory (if appropriate)

Set graphql uvicorn server log level based on Prefect config.
Copy link
Contributor

@zanieb zanieb left a comment

Choose a reason for hiding this comment

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

This seems like a really reasonable fix to me, just some minor nits.

I think it is worth noting that:

  • We can disable access logs to Uvicorn without changing the log level, this might be good to add to the config as server.logging.log_access = false and pass to Uvicorn
  • We probably will increase the healthcheck interval because it's pretty fast

Thanks so much for contributing!

src/prefect_server/services/graphql/server.py Outdated Show resolved Hide resolved
src/prefect_server/services/graphql/server.py Outdated Show resolved Hide resolved
@peterroelants
Copy link
Contributor Author

peterroelants commented Mar 15, 2021

@madkinsz Thank you for the quick review and the repr f-string suggestion, I didn't know about that.

I added a server.logging.log_access logging level as you suggested. However, I'm unsure if it should be at logging.log_access, or if it would be better to provide a graphql.logging.log_access config field. Do you have any opinion on this?

In the case of graphql.logging.log_access we might also want to change the logging level change to influence graphql.logging.level?

@zanieb
Copy link
Contributor

zanieb commented Mar 15, 2021

@madkinsz Thank you for the quick review and the repr f-string suggestion, I didn't know about that.

You're welcome :) Also, I left this as is before because I didn't think it was a big deal, but when using the config it's nice to use the attribute (.) access pattern e.g. prefect_server.configuration.config.server.logging.level instead of item access. They're equivalent but staying consistent with the rest of the repo makes it easier to search for usage of config values in the code.

I added a server.logging.log_access logging level as you suggested. However, I'm unsure if it should be at logging.log_access, or if it would be better to provide a graphql.logging.log_access config field. Do you have any opinion on this?

Great point! This would fit better under [services.graphql]. Perhaps we should name it services.graphql.disable_access_logs = True to match the Uvicorn name.

In the case of graphql.logging.log_access we might also want to change the logging level change to influence graphql.logging.level?

I think the rename suggested above will make it clear that you're just disabling it regardless of log level (as in Uvicorn). I don't think we should mutate another config value based on it.

@peterroelants
Copy link
Contributor Author

when using the config it's nice to use the attribute (.) access pattern e.g. prefect_server.configuration.config.server.logging.level instead of item access. They're equivalent but staying consistent with the rest of the repo makes it easier to search for usage of config values in the code.

I see now you are using box. I updated the access pattern as you suggested.

Great point! This would fit better under [services.graphql]. Perhaps we should name it services.graphql.disable_access_logs = True to match the Uvicorn name.

Good suggestion, I updated the code with this.

Copy link
Contributor

@zanieb zanieb left a comment

Choose a reason for hiding this comment

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

Thanks again!

@zanieb zanieb merged commit 7aab4da into PrefectHQ:master Mar 15, 2021
@peterroelants peterroelants deleted the patch-1 branch March 25, 2021 17:37
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.

2 participants