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

feat(alert/report): add ALERTS_ATTACH_REPORTS feature flags + feature #13894

Merged

Conversation

lilykuang
Copy link
Member

@lilykuang lilykuang commented Mar 31, 2021

SUMMARY

Add a feature flag to control dashboard and chart for disabling the screenshot for emails + slack
when ALERTS_ATTACH_REPORTS = True (behaves as it does now):

  • type: alert: emails+slack of chart and dashboard include screenshot + url
  • type: report: emails+slack of chart and dashboard include screenshot + url
    when ALERTS_ATTACH_REPORTS = False:
  • type: alert: system DOES NOT generate screenshot; emails+slack of chart and dashboard include url only
  • type: report: emails+slack of chart and dashboard include screenshot + url

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TEST PLAN

ADDITIONAL INFORMATION

  • Has associated issue:
  • 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

cc: @samtfm

Copy link
Member

@dpgaspar dpgaspar left a comment

Choose a reason for hiding this comment

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

quick pass

@@ -359,6 +359,7 @@ def _try_json_readsha( # pylint: disable=unused-argument
"OMNIBAR": False,
"DASHBOARD_RBAC": False,
"ENABLE_EXPLORE_DRAG_AND_DROP": False,
"ALERTS_ATTACH_REPORTS": True,
Copy link
Member

Choose a reason for hiding this comment

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

nit: would be nice to have a small explanation here

Copy link
Member

Choose a reason for hiding this comment

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

another nit, does it make sense for this to be a feature flag? I mean ALERT_REPORTS is a feature flag, with lot's of other configuration options that live outside the feature flag dict. Also it may be more clear to call this flag ALERTS_ATTACH_SCREENSHOT

@pull-request-size pull-request-size bot added size/L and removed size/M labels Mar 31, 2021
@@ -750,6 +750,10 @@ def test_email_dashboard_report_fails(
)
@patch("superset.reports.notifications.email.send_email_smtp")
@patch("superset.utils.screenshots.ChartScreenshot.get_screenshot")
@patch.dict(
"superset.extensions.feature_flag_manager._feature_flags",
ALERTS_ATTACH_REPORTS=True,
Copy link
Member

Choose a reason for hiding this comment

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

Let's add some tests for the inverse so we have confidence that everything works as expected with the feature flag disabled as well.

@codecov
Copy link

codecov bot commented Mar 31, 2021

Codecov Report

Merging #13894 (88d075d) into master (11dd249) will decrease coverage by 0.51%.
The diff coverage is 97.29%.

❗ Current head 88d075d differs from pull request most recent head 91d1b90. Consider uploading reports for the commit 91d1b90 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13894      +/-   ##
==========================================
- Coverage   77.53%   77.01%   -0.52%     
==========================================
  Files         935      938       +3     
  Lines       47319    47727     +408     
  Branches     5907     6039     +132     
==========================================
+ Hits        36689    36758      +69     
- Misses      10486    10826     +340     
+ Partials      144      143       -1     
Flag Coverage Δ
cypress 56.08% <100.00%> (+0.05%) ⬆️
hive ?
mysql 80.57% <95.23%> (+<0.01%) ⬆️
postgres 80.60% <95.23%> (+<0.01%) ⬆️
presto ?
python 80.69% <95.23%> (-0.42%) ⬇️
sqlite 80.16% <95.23%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...frontend/src/components/DatabaseSelector/index.tsx 92.70% <ø> (+1.04%) ⬆️
...et-frontend/src/components/TableSelector/index.tsx 84.92% <ø> (ø)
...src/dashboard/components/dnd/handleScroll/index.ts 73.33% <ø> (ø)
...d/src/explore/components/DatasourcePanel/index.tsx 87.93% <ø> (ø)
...rc/explore/components/DisplayQueryButton/index.jsx 100.00% <ø> (ø)
...re/components/controls/DatasourceControl/index.jsx 86.84% <ø> (ø)
...controls/DndColumnSelectControl/DndSelectLabel.tsx 35.00% <ø> (ø)
...trols/DndColumnSelectControl/components/Option.tsx 50.00% <ø> (ø)
...ents/controls/FilterControl/AdhocFilterControl.jsx 60.00% <ø> (ø)
...Control/AdhocFilterEditPopoverSimpleTabContent.jsx 74.83% <ø> (ø)
... and 49 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 11dd249...91d1b90. Read the comment docs.

@samtfm samtfm mentioned this pull request Mar 31, 2021
8 tasks
Copy link
Member

@dpgaspar dpgaspar left a comment

Choose a reason for hiding this comment

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

Looks good, just a small comment

@@ -359,6 +359,7 @@ def _try_json_readsha( # pylint: disable=unused-argument
"OMNIBAR": False,
"DASHBOARD_RBAC": False,
"ENABLE_EXPLORE_DRAG_AND_DROP": False,
"ALERTS_ATTACH_REPORTS": True,
Copy link
Member

Choose a reason for hiding this comment

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

another nit, does it make sense for this to be a feature flag? I mean ALERT_REPORTS is a feature flag, with lot's of other configuration options that live outside the feature flag dict. Also it may be more clear to call this flag ALERTS_ATTACH_SCREENSHOT

@willbarrett
Copy link
Member

@dpgaspar we're actually adding a CSV attachment type, so "SCREENSHOT" is soon to be an inaccurate term, hence the "REPORT" language. Not perfect either way I suppose. The additional feature flag was a simple way to accomplish the task - I'm also not sure if this will continue being an option or not at this point, and I think we may have a little more flexibility with feature flags at release time than configuration.

@willbarrett willbarrett merged commit 7621010 into apache:master Apr 1, 2021
henryyeh pushed a commit to preset-io/superset that referenced this pull request Apr 1, 2021
…apache#13894)

* Add a feature flag ALERTS_ATTACH_REPORTS

* update test

* update feature flag

* add comment for feature flag

* add unit tests for alerts with attachments disabled

* fix lint

Co-authored-by: samtfm <sam@preset.io>
(cherry picked from commit 7621010)
amitmiran137 added a commit that referenced this pull request Apr 2, 2021
* master: (26 commits)
  chore: bump to new superset-ui version (#13932)
  fix: do not run containers as root by default in Helm chart (#13917)
  feat(explore): adhoc column formatting for Table chart (#13758)
  fix(sqla-query): order by aggregations in Presto and Hive (#13739)
  feat(alert/report): add ALERTS_ATTACH_REPORTS feature flags + feature (#13894)
  test: Fixes PropertiesModal_spec (#13548)
  fix: Pin Prophet dependency after breaking changes (#13852)
  test: Adds tests to dnd controls (#13650)
  test: Adds tests to the AnnotationLayer component (#13748)
  test: Refactor and enhance tests for the Explore DatasourcePanel Component (#13799)
  Add tests (#13778)
  test: DisplayQueryButton (#13750)
  Fixing condition around left margin for dashboard layout. Fixes #13863 (#13905)
  Revert "fix: select table overlay (#13694)" (#13901)
  test: Adds tests to the OptionControls component (#13729)
  test: DatasourceControl (#13605)
  tests for function handleScroll (#13896)
  test: Adds tests to the CustomFrame component (#13675)
  test: Adds tests to the AdvancedFrame component (#13664)
  test: DataTableControl (#13668)
  ...
@lilykuang lilykuang deleted the lily/alert-link-only-feature-flag branch April 2, 2021 16:24
henryyeh pushed a commit to preset-io/superset that referenced this pull request Apr 6, 2021
…apache#13894)

* Add a feature flag ALERTS_ATTACH_REPORTS

* update test

* update feature flag

* add comment for feature flag

* add unit tests for alerts with attachments disabled

* fix lint

Co-authored-by: samtfm <sam@preset.io>
(cherry picked from commit 7621010)
lyndsiWilliams pushed a commit to preset-io/superset that referenced this pull request Apr 7, 2021
…apache#13894)

* Add a feature flag ALERTS_ATTACH_REPORTS

* update test

* update feature flag

* add comment for feature flag

* add unit tests for alerts with attachments disabled

* fix lint

Co-authored-by: samtfm <sam@preset.io>
allanco91 pushed a commit to allanco91/superset that referenced this pull request May 21, 2021
…apache#13894)

* Add a feature flag ALERTS_ATTACH_REPORTS

* update test

* update feature flag

* add comment for feature flag

* add unit tests for alerts with attachments disabled

* fix lint

Co-authored-by: samtfm <sam@preset.io>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.0 labels Mar 12, 2024
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 preset-io size/L 🚢 1.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants