-
Notifications
You must be signed in to change notification settings - Fork 14k
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
Conversation
94392a1
to
a1ef4fd
Compare
ad52455
to
ec2c200
Compare
@@ -512,6 +513,7 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({ | |||
const data: any = { | |||
...currentAlert, | |||
type: isReport ? 'Report' : 'Alert', | |||
force_screenshot: contentType === 'chart' && !isReport ? 'true' : 'false', |
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.
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 |
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.
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.
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.
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! 😁
|
||
id = sa.Column(sa.Integer, primary_key=True) | ||
type = sa.Column(sa.String(50), nullable=False) | ||
force_screenshot = sa.Column(sa.Boolean, default=False) |
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.
does this need a chart_id property?
* Update existing tests * Add backend test * feat: add force option to report screenshots * Add tests * Rebase fixes * Do not force screenshot on dashboard alerts
* Update existing tests * Add backend test * feat: add force option to report screenshots * Add tests * Rebase fixes * Do not force screenshot on dashboard alerts
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
SELECT force_screenshot FROM report_schedule
, check that it's true for the alert and false for the report.ADDITIONAL INFORMATION