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

[logging] Add Auto Refresh Dashboard event into dashboard logging #9087

Conversation

graceguo-supercat
Copy link

@graceguo-supercat graceguo-supercat commented Feb 4, 2020

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

In Dashboard, we allow dashboard owner set a refresh_frequency and save it with dashboard metadata. A dashboard with refresh_frequency (> 0) will auto force-refresh itself periodically once it is loaded in browser. But this auto-refresh event is not logged correctly in current dashboard logging mechanism.

This PR is to add auto refresh event, and a little code refactor for the period rendering function.

TEST PLAN

Test is covered by existed integration tests.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

REVIEWERS

@etr2460 @serenajiang

@graceguo-supercat graceguo-supercat changed the title [logging] Add Auto Refresh Dashboard user event into dashboard logging [WIP][logging] Add Auto Refresh Dashboard user event into dashboard logging Feb 4, 2020
@graceguo-supercat graceguo-supercat changed the title [WIP][logging] Add Auto Refresh Dashboard user event into dashboard logging [WIP][logging] Add Auto Refresh Dashboard event into dashboard logging Feb 4, 2020
@graceguo-supercat graceguo-supercat force-pushed the gg-AddLoggingForAutoRefreshDashEvent branch from 9da4707 to b3a0d7b Compare February 5, 2020 00:03
@graceguo-supercat graceguo-supercat changed the title [WIP][logging] Add Auto Refresh Dashboard event into dashboard logging [logging] Add Auto Refresh Dashboard event into dashboard logging Feb 5, 2020
@codecov-io
Copy link

codecov-io commented Feb 5, 2020

Codecov Report

Merging #9087 into master will decrease coverage by 0.43%.
The diff coverage is 34.48%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #9087      +/-   ##
=========================================
- Coverage   59.44%     59%   -0.44%     
=========================================
  Files         369     371       +2     
  Lines       11749   11816      +67     
  Branches     2888    2902      +14     
=========================================
- Hits         6984    6972      -12     
- Misses       4586    4662      +76     
- Partials      179     182       +3
Impacted Files Coverage Δ
...ssets/src/dashboard/containers/DashboardHeader.jsx 100% <ø> (ø) ⬆️
superset/assets/src/logger/LogUtils.js 100% <ø> (ø) ⬆️
...set/assets/src/dashboard/actions/dashboardState.js 31.72% <0%> (-9.24%) ⬇️
superset/assets/src/chart/chartAction.js 43.24% <0%> (-4.71%) ⬇️
.../src/dashboard/components/gridComponents/Chart.jsx 67.41% <100%> (ø) ⬆️
...uperset/assets/src/dashboard/components/Header.jsx 41.79% <25%> (-0.28%) ⬇️
...set/assets/src/dashboard/util/setPeriodicRunner.js 66.66% <66.66%> (ø)
...sets/src/explore/components/DisplayQueryButton.jsx 51.38% <0%> (-1.74%) ⬇️
...rset/assets/src/explore/reducers/exploreReducer.js 25% <0%> (-0.93%) ⬇️
... and 6 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 66fd177...bab5097. Read the comment docs.

1. add logging
2. refactor general periodical render function
@graceguo-supercat graceguo-supercat force-pushed the gg-AddLoggingForAutoRefreshDashEvent branch from b3a0d7b to bab5097 Compare February 5, 2020 08:21
Copy link
Member

@etr2460 etr2460 left a comment

Choose a reason for hiding this comment

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

a couple questions

@@ -188,7 +188,7 @@ class Header extends React.PureComponent {

forceRefresh() {
if (!this.props.isLoading) {
const chartList = Object.values(this.props.charts);
const chartList = Object.keys(this.props.charts);
Copy link
Member

Choose a reason for hiding this comment

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

what's the value in only passing around the chart keys instead of the chart object? It looks like we still need to get the whole object from state when we actually fetch the chart, so does this save much?

Copy link
Author

Choose a reason for hiding this comment

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

I noticed this because when dashboard periodically refreshing for a long time, the dashboard state/chart state might be changed, like added filter etc. User will expect periodically load the latest query params.

If I pass chart object here, its state is not updated. So i prefer to only pass the affected chart id.

};

return (dispatch, getState) => {
stopPeriodicRender();
Copy link
Member

Choose a reason for hiding this comment

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

did we lose the code where we cancel the periodic render function? i didn't see it anywhere here (but might've missed it)

* specific language governing permissions and limitations
* under the License.
*/
const stopPeriodicRender = refreshTimer => {
Copy link
Author

Choose a reason for hiding this comment

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

Stop interval is here.

Copy link
Member

Choose a reason for hiding this comment

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

oh duh, sorry!

@@ -188,7 +188,7 @@ class Header extends React.PureComponent {

forceRefresh() {
if (!this.props.isLoading) {
const chartList = Object.values(this.props.charts);
const chartList = Object.keys(this.props.charts);
Copy link
Author

Choose a reason for hiding this comment

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

I noticed this because when dashboard periodically refreshing for a long time, the dashboard state/chart state might be changed, like added filter etc. User will expect periodically load the latest query params.

If I pass chart object here, its state is not updated. So i prefer to only pass the affected chart id.

Copy link
Member

@etr2460 etr2460 left a comment

Choose a reason for hiding this comment

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

lgtm!

@graceguo-supercat graceguo-supercat merged commit 26def81 into apache:master Feb 5, 2020
@graceguo-supercat graceguo-supercat deleted the gg-AddLoggingForAutoRefreshDashEvent branch February 10, 2020 04:17
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.36.0 labels Feb 28, 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 size/L 🚢 0.36.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants