-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 Structured Logging #4055
Add Structured Logging #4055
Conversation
496f54e
to
5c9fd07
Compare
89e478f
to
66cece0
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.
woo! left some questions for anyone who is familiar 😄
@@ -0,0 +1,213 @@ | |||
|
|||
from colorama import Style | |||
import dbt.events.functions as this # don't worry I hate it too. |
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.
Why is this needed?
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.
Maybe it's not needed! But I couldn't get the my functions to set the global variables without it. Without this
it created a new locally scoped variable which is obviously not what I want. Idk why but I have a lot of trouble with Python's variable scoping so there's probably a better way to do this.
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.
yeah I just tried deleting all the this
calls, and flake8 gives me F841 local variable 'format_json' is assigned to but never used
🤷♂️
add event type modeling and fire_event calls
* updated context dir to new structured logging
handle exec info
update log call sites with new event system
graph call sites for structured logging
* first pass adding structured logging
* use __post_init__() instead of fake dataclass member vars
* update config use structured logging * WIP * minor cleanup * fixed merge error * added in ShowException * added todo to remove defaults after dropping 3.6 * removed todo that is obsolete
* convert generic_test to structured logging * convert macros to structured logging * add struc logging to most of manifest.py * add struct logging to models.py * added struct logging to partial.py * finished conversion of manifest * fixing errors * fixed 1 todo and added another * fixed bugs from merge
* add struct logging to base.py * struct logging in run_operation * add struct logging to base * add struct logging to clean * add struct logging to debug * add struct logging to deps * fix errors * add struct logging to run.py * fixed flake error * add struct logging to geneerate * added debug level stack trace * fixed flake error * added struct logging to compile * added struct logging to freshness * cleaned up errors * resolved bug that broke everything * removed accidental import * fixed bug with unused args
scrub secrets in event module
* add struct logging to docs serve * remove merge fluff * struct logging to seed command * converting print to use structured logging * more structured logging print conversion * pulling apart formatting more * added struct logging by disecting printer.py * add struct logging to runnable * add struct logging to task init * fixed formatting * more formatting and moving things around
* add struct logging to base * add struct logging to git * add struct logging to deps * remove blank line * fixed stray merge error
* add struct logging to compilation * add struct logging to tracking * add struct logging to utils * add struct logging to exceptions * fixed some misc errors * updated to send raw ex, removed resulting circ dep
* added struct logging to base * fixed merge wierdness * convert to use single type for integration tests * converted to 3 reusable test types in sep module * tweak message * clean up and making test_types complete for future * fix missed import
* switches on debug level to guard against expensive messages * adds memoization to msg construction
- removed 3 new log call sites and replaced with structured logs - removed 2 unused struc logs
graph call sites for structured logging Co-authored-by: Nathaniel May <[email protected]> Co-authored-by: Emily Rockman <[email protected]>
structured logging powered by the stdlib logger Co-authored-by: Emily Rockman <[email protected]> Co-authored-by: Ian Knox <[email protected]>
3684a5f
to
31acb95
Compare
* apply test fixes * remove presto test
* Env var shim to reenable logbook * Rename to ENABLE_LEGACY_LOGGER
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.
One failing test, test_postgres_debug_with_profiles_separate_from_project_dir
, that only fails on Windows. It's definitely related to changes here, but I don't think it's worth holding off on this PR any longer. @nathaniel-may and I have a hunch that it's more likely a symptom of our testing scaffold than it is representative of an actual issue in dbt-core.
Let's open a new issue to investigate further, and add to the phase 2 to-do list. In the meantime, let's move ahead with this change.
Amazing work @nathaniel-may @iknox-fa @emmyoop, and to everyone who helped along the way :)
resolves #3359
Description
The
structured-logging
branch is a feature branch and small incremental changes should be merged via PR into this branch. Tests need to pass for each merge into this feature branch. There are many integration tests that rely on certain wording of log messages, and it is important that these tests remain intact by converting them to use codes incrementally.Phase 1:
fire_event
#4137Adapter logging interface #4161Structlog #4176Structlog #4176std logger for structured logging #4231Structlog #4176std logger for structured logging #4231Phase 2:
structlog
configs including look and feelChecklist
CHANGELOG.md
and added information about my change