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
[logging] Add Auto Refresh Dashboard event into dashboard logging #9087
Conversation
9da4707
to
b3a0d7b
Compare
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
1. add logging 2. refactor general periodical render function
b3a0d7b
to
bab5097
Compare
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.
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); |
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'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?
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 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(); |
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.
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 => { |
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.
Stop interval is here.
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.
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); |
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 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.
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!
CATEGORY
Choose one
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
REVIEWERS
@etr2460 @serenajiang