-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
Conversation
Codecov Report
@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
9ee0013
to
8e41881
Compare
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 🙏 |
02ff786
to
7868634
Compare
7868634
to
843f1bc
Compare
…-add-bypass-cache-dash
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'; |
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.
fix these import issues
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.
@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 |
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.
what does URL_PARAMS.force do?
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.
URL_PARAMS is an enum that represents the key for url param we want to pull. In this case it is force
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.
Looks awesome.. if you have time to add a front end test, that would be great, but not blocking.
</> | ||
)} | ||
<StyledCheckbox |
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.
should this have a tooltip that explains what it is? Or is it self-explanatory
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.
it's not in the spec, personally think it is fine since we are explicitly putting text right next to the checkbox
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 |
d9d6d65
to
8138b0d
Compare
@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. |
6a35537
to
5c92769
Compare
b6e088e
to
3678612
Compare
/testenv up |
@hughhhh Ephemeral environment spinning up at http://34.217.8.127:8080. Credentials are |
const data: any = { | ||
...currentAlert, | ||
type: isReport ? 'Report' : 'Alert', | ||
force_screenshot: shouldEnableForceScreenshot || forceScreenshot, | ||
force_screenshot: !isReport || forceScreenshot, // alerts (!isReport) should always bypass cache |
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.
Wait... for alerts with dashboards we don't want to always bypass the cache.
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.
Why not? Is it because of the perf issue that may arise?
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! |
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.
LGTM from QA testing
already got 3 and address beto's concerns
Ephemeral environment shutdown and build artifacts deleted. |
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