-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for Python log filters (#19526)
We can change our python logger by adding handlers and formatters: https://docs.dagster.io/concepts/logging/python-logging#configuring-python-log-handlers- However, due to the [schema check](https://github.com/dagster-io/dagster/blob/626fedef2922c423ba7131441a5196f5fab0764e/python_modules/dagster/dagster/_core/instance/config.py#L177) we can't add filters. They are part of the [default python config dict](https://docs.python.org/3/library/logging.config.html) and are applied to handlers. They are used to have filter logic to discard certain log records, or [add contextual information to the log record](https://docs.python.org/3/howto/logging-cookbook.html). The latter is what I'd like to do. The workaround is to just do this in a formatter - however this isn't the correct python way of doing it. As dagster is just [passing this as a dict to a dummy logger](https://github.com/dagster-io/dagster/blob/626fedef2922c423ba7131441a5196f5fab0764e/python_modules/dagster/dagster/_core/instance/__init__.py#L2324) - allowing for a filter value for the schema should be fine. (It works fine too if you skip the schema check by using DagsterInstance.ephemeral() ) I've added filters as a possible value to the schema - and changed documentation to reflect this. Some tests will be added [here](https://github.com/dagster-io/dagster/blob/626fedef2922c423ba7131441a5196f5fab0764e/python_modules/dagster/dagster_tests/logging_tests/test_logging.py#L429) to test this filters change and also test formatters.
- Loading branch information
Showing
4 changed files
with
152 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fb7faab
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.
Deploy preview for dagster-docs ready!
✅ Preview
https://dagster-docs-lb66dhxko-elementl.vercel.app
https://master.dagster.dagster-docs.io
Built with commit fb7faab.
This pull request is being automatically deployed with vercel-action