You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by el...@apache.org on 2026/06/16 00:31:40 UTC
(superset) 02/03: fix(screenshots): add debug logs for blank-PDF investigation in Playwright path
This is an automated email from the ASF dual-hosted git repository.
eschutho pushed a commit to branch reports-screenshot-api-spinner-wait
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 78b41b93c2271a2f83817cf9efc73463fd1b3f25
Author: Elizabeth Thompson <es...@gmail.com>
AuthorDate: Mon Jun 15 23:10:12 2026 +0000
fix(screenshots): add debug logs for blank-PDF investigation in Playwright path
Add debug-level logging at each decision point in WebDriverPlaywright so that
enabling DEBUG logging exposes the full screenshot pipeline:
- Which path was taken (tiled / standard-below-threshold / tiled-disabled)
including chart count and dashboard height when the tiling decision is made
- "Waiting for all spinners to clear" with SCREENSHOT_LOAD_WAIT value at the
start of each wait, so a timeout message has clear context
- "All spinners cleared" confirmation after wait_for_function succeeds
- "Taking screenshot of url %s as user %s" immediately before capture, rather
than at the misleading early position it previously occupied
- "Screenshot result: N bytes" (or "Tiled screenshot result: N bytes") after
capture so a blank or suspiciously small result is visible in the log
Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
superset/utils/webdriver.py | 54 ++++++++++++++++++++++++++++++++++++++-------
1 file changed, 46 insertions(+), 8 deletions(-)
diff --git a/superset/utils/webdriver.py b/superset/utils/webdriver.py
index da0a98695b0..53cf3778da4 100644
--- a/superset/utils/webdriver.py
+++ b/superset/utils/webdriver.py
@@ -301,11 +301,6 @@ class WebDriverPlaywright(WebDriverProxy):
selenium_animation_wait = app.config[
"SCREENSHOT_SELENIUM_ANIMATION_WAIT"
]
- logger.debug(
- "Taking a PNG screenshot of url %s as user %s",
- url,
- user.username if user else "None",
- )
if app.config["SCREENSHOT_REPLACE_UNEXPECTED_ERRORS"]:
unexpected_errors = WebDriverPlaywright.find_unexpected_errors(page)
if unexpected_errors:
@@ -380,14 +375,28 @@ class WebDriverPlaywright(WebDriverProxy):
img = WebDriverPlaywright._get_screenshot(
page, element, element_name
)
+ logger.debug(
+ "Tiled screenshot result: %d bytes for url: %s",
+ len(img) if img else 0,
+ url,
+ )
else:
+ logger.debug(
+ "Dashboard below tiling threshold "
+ "(%s charts, %spx height); using standard screenshot "
+ "for url: %s",
+ chart_count,
+ dashboard_height,
+ url,
+ )
# Standard screenshot captures the full element including
# below-the-fold content, so wait for all spinners globally.
try:
logger.debug(
- "Wait for loading element of charts to be gone"
- " at url: %s",
+ "Waiting for all spinners to clear at url: %s "
+ "(SCREENSHOT_LOAD_WAIT=%ss)",
url,
+ self._screenshot_load_wait,
)
page.wait_for_function(
"() => document.querySelectorAll("
@@ -402,22 +411,40 @@ class WebDriverPlaywright(WebDriverProxy):
self._screenshot_load_wait,
)
raise
+ logger.debug("All spinners cleared for url: %s", url)
if selenium_animation_wait > 0:
logger.debug(
"Wait %i seconds for chart animation",
selenium_animation_wait,
)
page.wait_for_timeout(selenium_animation_wait * 1000)
+ logger.debug(
+ "Taking screenshot of url %s as user %s",
+ url,
+ user.username if user else "None",
+ )
img = WebDriverPlaywright._get_screenshot(
page, element, element_name
)
+ logger.debug(
+ "Screenshot result: %d bytes for url: %s",
+ len(img) if img else 0,
+ url,
+ )
else:
+ logger.debug(
+ "Tiled screenshots disabled; using standard screenshot "
+ "for url: %s",
+ url,
+ )
# Standard screenshot captures the full element including
# below-the-fold content, so wait for all spinners globally.
try:
logger.debug(
- "Wait for loading element of charts to be gone at url: %s",
+ "Waiting for all spinners to clear at url: %s "
+ "(SCREENSHOT_LOAD_WAIT=%ss)",
url,
+ self._screenshot_load_wait,
)
page.wait_for_function(
"() => document.querySelectorAll('.loading').length === 0",
@@ -431,15 +458,26 @@ class WebDriverPlaywright(WebDriverProxy):
self._screenshot_load_wait,
)
raise
+ logger.debug("All spinners cleared for url: %s", url)
if selenium_animation_wait > 0:
logger.debug(
"Wait %i seconds for chart animation",
selenium_animation_wait,
)
page.wait_for_timeout(selenium_animation_wait * 1000)
+ logger.debug(
+ "Taking screenshot of url %s as user %s",
+ url,
+ user.username if user else "None",
+ )
img = WebDriverPlaywright._get_screenshot(
page, element, element_name
)
+ logger.debug(
+ "Screenshot result: %d bytes for url: %s",
+ len(img) if img else 0,
+ url,
+ )
except PlaywrightTimeout:
raise