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 flag for document visibility #9070

Conversation

graceguo-supercat
Copy link

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

CATEGORY

Choose one

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

SUMMARY

When we measure dashboard performance, we use dashboard's TTI (time to interactive), which is duration from document load till all charts finished render. But when a user opens a dashboard and visits another browser tab right away, the dashboard won’t start loading its slices until the user goes back to focus on this browser tab: [https://superuser.com/questions/779021/google-chrome-background-tabs-dont-load-build-until-selected]

Modern browser supports Page Visibility API to detect current webpage's visibility:
https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
This PR is to check if user is focused on other browser tab and Superset dashboard is hidden. If so, we should log it as a special case:
Screen Shot 2020-02-01 at 11 03 14 PM

TEST PLAN

CI and manual test

REVIEWERS

@etr2460 @serenajiang

@codecov-io
Copy link

Codecov Report

Merging #9070 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #9070   +/-   ##
=======================================
  Coverage   59.45%   59.45%           
=======================================
  Files         369      369           
  Lines       11747    11747           
  Branches     2888     2888           
=======================================
  Hits         6984     6984           
  Misses       4584     4584           
  Partials      179      179
Impacted Files Coverage Δ
superset/assets/src/middleware/loggerMiddleware.js 70.27% <ø> (ø) ⬆️

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 7364024...5ded170. Read the comment docs.

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, but one question

@@ -107,6 +107,7 @@ const loggerMiddleware = store => next => action => {
...eventData,
event_type: 'user',
event_id: lastEventId,
visibility: document.visibilityState,
Copy link
Member

Choose a reason for hiding this comment

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

should we move this into the top level eventData so that it's added on timing events too?

Copy link
Author

Choose a reason for hiding this comment

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

timing event (mostly is data loading and chart render) is triggered by user event (dashboard mount, switch tab, etc). I assume during 1 user event (a few charts will be loading and re-render), the browser's visibilityState will not change.

@graceguo-supercat graceguo-supercat merged commit c9a4384 into apache:master Feb 3, 2020
@graceguo-supercat graceguo-supercat deleted the gg-CheckBrowserTabVisiable 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/XS 🚢 0.36.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants