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

Remove Print and use event system #10131

Merged
merged 5 commits into from May 21, 2024
Merged

Remove Print and use event system #10131

merged 5 commits into from May 21, 2024

Conversation

ChenyuLInx
Copy link
Contributor

@ChenyuLInx ChenyuLInx commented May 10, 2024

resolves #8756
Need dbt-labs/dbt-common#130

Problem

We want to have some event that

would still output to stdout when --quiet is specified,
without the timestamps in front
This PR does so by creating a specific event in dbt-common and implemented logic to have this event always passed to logger as 'error' level.

Solution

Switch to use the PrintEvent

Currently only downside is the original ListCmdOut event is being swapped to PrintEvent when log format is json.
info.code and info.name are changed.
@benmosher do you know if IDE rely on this somehow?

{"data": {"msg": "unit_test:jaffle_shop.test_does_location_opened_at_trunc_to_date"}, "info": {"category": "", "code": "Z052", "extra": {}, "invocation_id": "3b07892c-d070-4a64-8c45-781ee7c91616", "level": "info", "msg": "unit_test:jaffle_shop.test_does_location_opened_at_trunc_to_date", "name": "PrintEvent", "pid": 83408, "thread": "MainThread", "ts": "2024-05-16T21:49:13.211707Z"}}

previously it was

{"data": {"msg": "unit_test:jaffle_shop.test_does_location_opened_at_trunc_to_date"}, "info": {"category": "", "code": "Z049", "extra": {}, "invocation_id": "ab9df060-122b-4995-be78-93e451ce239f", "level": "info", "msg": "unit_test:jaffle_shop.test_does_location_opened_at_trunc_to_date", "name": "ListCmdOut", "pid": 93939, "thread": "MainThread", "ts": "2024-05-16T22:00:10.053990Z"}

TODO

  • quiet behavior
  • do we need custom behavior on this event(we can't now)

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX
  • This PR includes type annotations for new and modified functions

@ChenyuLInx ChenyuLInx requested a review from a team as a code owner May 10, 2024 22:53
@cla-bot cla-bot bot added the cla:yes label May 10, 2024
Copy link
Contributor

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@ChenyuLInx ChenyuLInx changed the title first-iter Remove Print and use event system May 10, 2024
@benmosher
Copy link
Contributor

@ChenyuLInx to my knowledge, we only use ts and msg. but tag @naomiwritescode for more 👀 + 🧠

Copy link

codecov bot commented May 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.63%. Comparing base (ad61200) to head (2cf8ffc).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10131      +/-   ##
==========================================
+ Coverage   88.58%   88.63%   +0.04%     
==========================================
  Files         180      180              
  Lines       22436    22435       -1     
==========================================
+ Hits        19876    19885       +9     
+ Misses       2560     2550      -10     
Flag Coverage Δ
integration 86.10% <100.00%> (+0.15%) ⬆️
unit 63.18% <80.00%> (+0.18%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ChenyuLInx ChenyuLInx merged commit eb71ad9 into main May 21, 2024
63 checks passed
@ChenyuLInx ChenyuLInx deleted the cl/remove_print branch May 21, 2024 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-3175] Convert print call sites to logging events
3 participants