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: Allow users to bust cache in report dashboard + alerts charts + alert dashboards #18795

Merged
merged 15 commits into from
Mar 4, 2022

Conversation

hughhhh
Copy link
Member

@hughhhh hughhhh commented Feb 17, 2022

SUMMARY

Added the setting to allow users to bypass caching for both dashboard alerts, charts alerts, + dashboard reports. This will always default to false. Additionally add the functionally to allow the chart component to read the params and force refresh whenever the url param force=true is in the url.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

bypass_cache.mov

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 Feb 17, 2022

Codecov Report

Merging #18795 (3cbdfb4) into master (3298551) will increase coverage by 0.00%.
The diff coverage is 66.66%.

❗ Current head 3cbdfb4 differs from pull request most recent head fd235bf. Consider uploading reports for the commit fd235bf to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #18795   +/-   ##
=======================================
  Coverage   66.52%   66.52%           
=======================================
  Files        1641     1641           
  Lines       63475    63476    +1     
  Branches     6443     6444    +1     
=======================================
+ Hits        42226    42227    +1     
- Misses      19584    19585    +1     
+ Partials     1665     1664    -1     
Flag Coverage Δ
javascript 51.28% <66.66%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
superset/reports/commands/execute.py 91.51% <ø> (ø)
superset-frontend/src/chart/Chart.jsx 53.33% <50.00%> (-0.12%) ⬇️
...frontend/src/views/CRUD/alert/AlertReportModal.tsx 52.38% <100.00%> (+0.14%) ⬆️

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 3298551...fd235bf. Read the comment docs.

@chonyy
Copy link

chonyy commented Feb 23, 2022

Hi @hughhhh , we recently encountered this issue and found this PR. I saw that the option you are adding is called “Ignore cache when generating screenshot”. I’m wondering whether this also works when I’m sending csv or text. We found the content is cached when we are sending a chart as text. Thanks 🙏

@eschutho eschutho added the need:qa-review Requires QA review label Feb 23, 2022
@pull-request-size pull-request-size bot added size/M and removed size/L labels Feb 25, 2022
@hughhhh
Copy link
Member Author

hughhhh commented Feb 25, 2022

Hi @hughhhh , we recently encountered this issue and found this PR. I saw that the option you are adding is called “Ignore cache when generating screenshot”. I’m wondering whether this also works when I’m sending csv or text. We found the content is cached when we are sending a chart as text. Thanks 🙏

That is prolly a seperate problem i'm currently only focusing on adding the checkboxes, and also adding the configuration in the client to setup the network calls for forcing all charts to pull from the source.

File another ticket and tag me in it and I can take a look

@@ -29,6 +29,8 @@ import ErrorBoundary from 'src/components/ErrorBoundary';
import { Logger, LOG_ACTIONS_RENDER_CHART } from 'src/logger/LogUtils';
import ChartRenderer from './ChartRenderer';
import { ChartErrorMessage } from './ChartErrorMessage';
import { URL_PARAMS } from 'src/constants';
Copy link
Member

Choose a reason for hiding this comment

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

fix these import issues

Copy link
Member

Choose a reason for hiding this comment

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

@hughhhh I fixed these real quick so that I could use your branch for testing locally.

@@ -157,7 +159,7 @@ class Chart extends React.PureComponent {
// Load saved chart with a GET request
this.props.actions.getSavedChart(
this.props.formData,
this.props.force,
this.props.force || getUrlParam(URL_PARAMS.force), // allow override via url params force=true
Copy link
Member

Choose a reason for hiding this comment

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

what does URL_PARAMS.force do?

Copy link
Member Author

Choose a reason for hiding this comment

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

URL_PARAMS is an enum that represents the key for url param we want to pull. In this case it is force

Copy link
Member

@eschutho eschutho left a comment

Choose a reason for hiding this comment

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

Looks awesome.. if you have time to add a front end test, that would be great, but not blocking.

</>
)}
<StyledCheckbox
Copy link
Member

Choose a reason for hiding this comment

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

should this have a tooltip that explains what it is? Or is it self-explanatory

Copy link
Member Author

Choose a reason for hiding this comment

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

it's not in the spec, personally think it is fine since we are explicitly putting text right next to the checkbox

@jinghua-qa
Copy link
Member

I am still in the process of test, but i found an issue that in the alert and report configuration page, after one notification method is added, the "+ Add notification method " link is gone and user could not add another notification method, is this expected? I think we can add another notification method
Screen Shot 2022-02-25 at 10 54 40 AM
Screen Shot 2022-02-25 at 10 54 02 AM

This is what i expected:
Screen Shot 2022-02-25 at 10 50 24 AM

@chonyy
Copy link

chonyy commented Feb 27, 2022

Hi @hughhhh , we recently encountered this issue and found this PR. I saw that the option you are adding is called “Ignore cache when generating screenshot”. I’m wondering whether this also works when I’m sending csv or text. We found the content is cached when we are sending a chart as text. Thanks 🙏

That is prolly a seperate problem i'm currently only focusing on adding the checkboxes, and also adding the configuration in the client to setup the network calls for forcing all charts to pull from the source.

File another ticket and tag me in it and I can take a look

Hi @hughhhh , thanks for your quick reply!

However, I don't quite get why it's a separate problem. I assume that no matter it's a screenshot or text or csv, they are all using the same method to pull the chart right? Therefore, that's why I think if I have an option to disable cache when alerting, then the content is pulled directly from the source (real-time). No matter it's a screenshot / CSV / text. Not sure what I'm missing here. Thanks 🙏

This is the issue I'm facing
image

@betodealmeida
Copy link
Member

However, I don't quite get why it's a separate problem. I assume that no matter it's a screenshot or text or csv, they are all using the same method to pull the chart right? Therefore, that's why I think if I have an option to disable cache when alerting, then the content is pulled directly from the source (real-time). No matter it's a screenshot / CSV / text. Not sure what I'm missing here. Thanks 🙏

@chonyy unfortunately the assumption is incorrect, we use different endpoints depending on the format, and some of them even have separate caches. It's something we want to improve eventually.

@hughhhh hughhhh force-pushed the hugh-add-bypass-cache-dash branch from 6a35537 to 5c92769 Compare March 1, 2022 02:03
@pull-request-size pull-request-size bot added size/L and removed size/M labels Mar 1, 2022
@hughhhh hughhhh force-pushed the hugh-add-bypass-cache-dash branch from b6e088e to 3678612 Compare March 1, 2022 04:03
@hughhhh
Copy link
Member Author

hughhhh commented Mar 1, 2022

/testenv up

@github-actions
Copy link
Contributor

github-actions bot commented Mar 1, 2022

@hughhhh Ephemeral environment spinning up at http://34.217.8.127:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

const data: any = {
...currentAlert,
type: isReport ? 'Report' : 'Alert',
force_screenshot: shouldEnableForceScreenshot || forceScreenshot,
force_screenshot: !isReport || forceScreenshot, // alerts (!isReport) should always bypass cache
Copy link
Member

Choose a reason for hiding this comment

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

Wait... for alerts with dashboards we don't want to always bypass the cache.

Copy link
Member Author

Choose a reason for hiding this comment

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

Why not? Is it because of the perf issue that may arise?

superset/reports/commands/execute.py Show resolved Hide resolved
@jinghua-qa
Copy link
Member

I have tested bust cache option in alert+dashboard, report+dashbaord, and report+chart, working as expected. Alert+chart always have bust cache, and no bust cache option for Alert+chart. LGTM!

Copy link
Member

@jinghua-qa jinghua-qa left a comment

Choose a reason for hiding this comment

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

LGTM from QA testing

@hughhhh hughhhh dismissed betodealmeida’s stale review March 4, 2022 17:40

already got 3 and address beto's concerns

@hughhhh hughhhh merged commit 8c52fe3 into master Mar 4, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2022

Ephemeral environment shutdown and build artifacts deleted.

@villebro villebro added lts-v1 and removed need:qa-review Requires QA review labels Mar 29, 2022
villebro pushed a commit that referenced this pull request Apr 3, 2022
… alert dashboards (#18795)

* wip

* add force cahce bypass option to alerts

* remove default for alerts to bypass cache

* save for now

* save for now

* fix

* commenting out for now

* fix linting

* remove link

* add back force id test

* add frontend test

* address

(cherry picked from commit 8c52fe3)
@mistercrunch mistercrunch added 🍒 1.5.0 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.0 labels Mar 13, 2024
@mistercrunch mistercrunch deleted the hugh-add-bypass-cache-dash branch March 26, 2024 16:13
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 lts-v1 size/L 🍒 1.5.0 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants