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

chore: additional logging in alerts and reports #21802

Merged
merged 4 commits into from
Oct 24, 2022
Merged

Conversation

AAfghahi
Copy link
Member

@AAfghahi AAfghahi commented Oct 13, 2022

SUMMARY

This adds more logging for alerts and reports, to better understand downstream exceptions.

Of particular note is that our logs show this messaging often:
image

So we wanted to mark that task as having failed.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Oct 13, 2022

Codecov Report

Merging #21802 (37ee741) into master (df3b5a8) will increase coverage by 0.07%.
The diff coverage is 87.50%.

❗ Current head 37ee741 differs from pull request most recent head 5c1f57e. Consider uploading reports for the commit 5c1f57e to get more accurate results

@@            Coverage Diff             @@
##           master   #21802      +/-   ##
==========================================
+ Coverage   66.85%   66.92%   +0.07%     
==========================================
  Files        1805     1805              
  Lines       69061    70583    +1522     
  Branches     7369     7369              
==========================================
+ Hits        46169    47238    +1069     
- Misses      20995    21448     +453     
  Partials     1897     1897              
Flag Coverage Δ
hive 52.92% <37.50%> (+<0.01%) ⬆️
mysql 78.26% <87.50%> (+0.02%) ⬆️
postgres 78.32% <87.50%> (+0.02%) ⬆️
presto 52.82% <37.50%> (+<0.01%) ⬆️
python 80.96% <87.50%> (-0.49%) ⬇️
sqlite 76.81% <87.50%> (+0.02%) ⬆️
unit 51.41% <0.00%> (+0.35%) ⬆️

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

Impacted Files Coverage Δ
superset/tasks/scheduler.py 82.00% <80.00%> (+16.04%) ⬆️
superset/reports/notifications/email.py 100.00% <100.00%> (ø)
superset/utils/core.py 90.32% <100.00%> (ø)
superset/reports/commands/execute.py 68.24% <0.00%> (-23.74%) ⬇️
superset/reports/filters.py 72.00% <0.00%> (-20.86%) ⬇️
superset/dashboards/dao.py 81.09% <0.00%> (-15.26%) ⬇️
superset/datasets/commands/create.py 85.71% <0.00%> (-14.29%) ⬇️
superset/reports/dao.py 73.26% <0.00%> (-11.42%) ⬇️
superset/reports/api.py 80.00% <0.00%> (-10.23%) ⬇️
superset/security/manager.py 86.56% <0.00%> (-9.19%) ⬇️
... and 8 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@pkdotson pkdotson left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -207,6 +207,8 @@ def send(self) -> None:
dryrun=False,
header_data=content.header_data,
)
logger.info("Report sent to email")
logger.info(
"Report sent to email, notification content is %s", content.header_data
Copy link
Member

Choose a reason for hiding this comment

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

checked HeaderDataType is safe to log.

Copy link
Member Author

Choose a reason for hiding this comment

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

We log it in other places, so I think that it is.

@@ -1020,6 +1021,7 @@ def send_mime_email(
if smtp_user and smtp_password:
smtp.login(smtp_user, smtp_password)
logger.debug("Sent an email to %s", str(e_to))
logger.info("Sent email notification content is %s", mime_msg.as_string())
Copy link
Member

Choose a reason for hiding this comment

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

don't think we should log the mime_msg itself

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, I think this one we can actually delete. Ty

@@ -85,10 +85,12 @@ def execute(report_schedule_id: int, scheduled_dttm: str) -> None:
logger.exception(
"An unexpected occurred while executing the report: %s", task_id
)
execute.update_state(state="FAILURE")
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test to assert this?

except CommandException:
logger.exception(
"A downstream exception occurred while generating" " a report: %s", task_id
)
execute.update_state(state="FAILURE")
Copy link
Member

Choose a reason for hiding this comment

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

can you add a test to assert this?

@AAfghahi AAfghahi force-pushed the arash/logAlertReports branch 2 times, most recently from 1c0a622 to 9399632 Compare October 18, 2022 15:40
@pull-request-size pull-request-size bot added size/M and removed size/S labels Oct 18, 2022
@AAfghahi AAfghahi force-pushed the arash/logAlertReports branch from 9399632 to eee545e Compare October 18, 2022 20:11
@pull-request-size pull-request-size bot added size/S and removed size/M labels Oct 18, 2022
@AAfghahi AAfghahi force-pushed the arash/logAlertReports branch from eee545e to bdd1fdc Compare October 18, 2022 20:13
@AAfghahi AAfghahi force-pushed the arash/logAlertReports branch from bdd1fdc to 31d4f8a Compare October 18, 2022 20:14
@pull-request-size pull-request-size bot added size/M and removed size/S labels Oct 20, 2022
@AAfghahi AAfghahi force-pushed the arash/logAlertReports branch from 37ee741 to f33c698 Compare October 24, 2022 16:41
@AAfghahi AAfghahi force-pushed the arash/logAlertReports branch from f33c698 to 5c1f57e Compare October 24, 2022 16:42
@AAfghahi AAfghahi merged commit 76c865f into master Oct 24, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
@mistercrunch mistercrunch deleted the arash/logAlertReports branch March 26, 2024 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants