kgabryje opened a new pull request, #34561:
URL: https://github.com/apache/superset/pull/34561

   
   ### SUMMARY
   Playwright reports used to return a blank screenshots when run on large 
dashboards.
   
   After some experiments I found out that the problem appears to actually come 
from Chromium itself, not Playwright. After enabling CPU 4x throttling and 
taking a screenshot using Chrome's dev tools, I noticed that before taking the 
screenshot, it unmounts and redraws a lot of UI elements, leaving just the 
dashboard's background, and it doesn't finish redrawing until after the 
screenshot is taken, resulting in blank image (see video).
   The solution that this PR implements was to take multiple small 
screenshots/tiles and glue them together into the final report before sending 
it to the user.
   I tested the solution on a large dashboard (~50 charts, deck.gl and Echarts) 
which failed consistently before. After my changes, it consistently sends 
expected screenshot.
   
   There are also some config flags for fine tuning the tiling feature:
   - `SCREENSHOT_TILED_ENABLED` (True by default, disabling not recommended)
   - `SCREENSHOT_TILED_CHART_THRESHOLD` (threshold of dashboard height at which 
tiling gets triggered)
   - `SCREENSHOT_TILED_HEIGHT_THRESHOLD` (number of charts at which tiling gets 
triggered)
   - `SCREENSHOT_TILED_VIEWPORT_HEIGHT` (single tile viewport height)
   If the blank screenshot problem persists, you can try decreasing the value 
of each of those flags
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   Before:
   
   <img width="2800" height="15484" alt="image" 
src="https://github.com/user-attachments/assets/e4671dca-57c1-4afb-84fb-38a708efc50e";
 />
   
   After:
   
   <img width="2800" height="15484" alt="image" 
src="https://github.com/user-attachments/assets/2733722b-8f7e-44b2-bf0f-c29401fecdfa";
 />
   
   
   ### TESTING INSTRUCTIONS
   1. Enable `PLAYWRIGHT_REPORTS_AND_THUMBNAILS`, install playwright, run 
`playwright install`.
   2. Create a very large dashboard (~50 charts should be enough)
   3. Set up a report with this dashboard
   4. Verify that the screenshot is generated correctly
   5. Also test on smaller dashboards were the tiling effect should not trigger
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] 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
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to