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: add force option to report screenshots #17853

Merged
merged 6 commits into from
Dec 22, 2021
Merged

feat: add force option to report screenshots #17853

merged 6 commits into from
Dec 22, 2021

Conversation

betodealmeida
Copy link
Member

@betodealmeida betodealmeida commented Dec 22, 2021

SUMMARY

Add a new column force_screenshot to the reports/alerts model. For alerts with charts this is always set to true. For reports and alerts with dashboards this is currently set to false, and is made configurable for reports in #17855.

When the flag is true, when generating a screenshot for the alert/report the cache will be bypassed.

Depends on #17695.

MIGRATION

DB migration adds a new column force_screenshot, set to true for existing alerts with charts, false otherwise.

Results:

Current: 0.34 s
10+: 0.35 s
100+: 0.39 s
1000+: 0.74 s
10000+: 3.58 s
100000+: 32.59 s
1000000+: 453.84 s

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TESTING INSTRUCTIONS

  1. Create a report and a alert.
  2. Run SELECT force_screenshot FROM report_schedule, check that it's true for the alert and false for the report.

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

@betodealmeida betodealmeida requested a review from a team as a code owner December 22, 2021 16:39
@@ -512,6 +513,7 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
const data: any = {
...currentAlert,
type: isReport ? 'Report' : 'Alert',
force_screenshot: contentType === 'chart' && !isReport ? 'true' : 'false',
Copy link
Member Author

Choose a reason for hiding this comment

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

This is made configurable for reports in #17855

@@ -181,7 +175,7 @@ def _get_url(
user_friendly=user_friendly,
dashboard_id_or_slug=self._report_schedule.dashboard_id,
standalone=DashboardStandaloneMode.REPORT.value,
force=force,
# force=force, TODO (betodealmeida) implement this
Copy link
Member Author

Choose a reason for hiding this comment

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

This is currently not supported by the dashboard API (only the chart API), so I thought it would be better to leave it out for now.

@betodealmeida betodealmeida added the risk:db-migration PRs that require a DB migration label Dec 22, 2021
Copy link
Member

@lyndsiWilliams lyndsiWilliams left a comment

Choose a reason for hiding this comment

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

I am not super familiar with the back end part of this code, but it all seems pretty clear and straight-forward. Looks good to me! 😁

@betodealmeida betodealmeida merged commit 2cd8054 into master Dec 22, 2021

id = sa.Column(sa.Integer, primary_key=True)
type = sa.Column(sa.String(50), nullable=False)
force_screenshot = sa.Column(sa.Boolean, default=False)
Copy link
Member

Choose a reason for hiding this comment

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

does this need a chart_id property?

shcoderAlex pushed a commit to casual-precision/superset that referenced this pull request Feb 7, 2022
* Update existing tests

* Add backend test

* feat: add force option to report screenshots

* Add tests

* Rebase fixes

* Do not force screenshot on dashboard alerts
bwang221 pushed a commit to casual-precision/superset that referenced this pull request Feb 10, 2022
* Update existing tests

* Add backend test

* feat: add force option to report screenshots

* Add tests

* Rebase fixes

* Do not force screenshot on dashboard alerts
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.0 labels Mar 13, 2024
@mistercrunch mistercrunch deleted the ch24621b branch March 26, 2024 16:08
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 risk:db-migration PRs that require a DB migration size/L 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants