fix(reports): downgrade tile-wait-budget logs to WARNING and add execution-id tracing

Budget exhaustion and per-tile spinner timeouts in take_tiled_screenshot()
are customer-side chart-loading issues, not Superset system faults, so log
them at WARNING instead of ERROR -- consistent with the precedent set by
#38130 and #38441, which deliberately downgraded screenshot timeout logs
the same way. Genuine system faults (browser crash, uncaught Playwright
errors) remain at the existing exception/ERROR level, unchanged.

Thread an optional log_context string through the screenshot call chain
(ChartScreenshot/DashboardScreenshot.get_screenshot -> WebDriverProxy
implementations -> take_tiled_screenshot) so every log line this PR adds
or touches can be traced back to its run: the report execution id on the
report path, or the thumbnail cache key on the thumbnail path (no new
plumbing invented there -- cache_key was already in scope).

Also add a per-tile DEBUG timing line (spinner wait vs. animation wait)
and richer WARNING diagnostics (tile index, tiles captured so far, elapsed
vs. budget) so a slow dashboard can be profiled and a timeout diagnosed
from logs alone.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Elizabeth Thompson
2026-07-16 22:31:07 +00:00
parent 4fca5099dd
commit e4ec4e1067
6 changed files with 188 additions and 46 deletions

View File

@@ -1038,9 +1038,9 @@ class TestWebDriverPlaywrightAnimationWaitOrder:
assert "animation_wait" in call_order
spinner_idx = call_order.index("spinner_wait")
anim_idx = call_order.index("animation_wait")
assert spinner_idx < anim_idx, (
"spinner wait must precede animation wait in non-tiled path"
)
assert (
spinner_idx < anim_idx
), "spinner wait must precede animation wait in non-tiled path"
@patch("superset.utils.webdriver.PLAYWRIGHT_AVAILABLE", True)
@patch("superset.utils.webdriver._browser_manager")
@@ -1121,6 +1121,7 @@ class TestWebDriverPlaywrightAnimationWaitOrder:
600,
load_wait=30,
animation_wait=2,
log_context=None,
)
# The only wait_for_timeout call should be the 0ms headstart; no global
# animation wait should be issued (handled per-tile by take_tiled_screenshot)
@@ -1129,9 +1130,9 @@ class TestWebDriverPlaywrightAnimationWaitOrder:
for call in mock_page.wait_for_timeout.call_args_list
if call[0][0] == 2 * 1000
]
assert animation_waits == [], (
"No global 2s animation wait_for_timeout should fire on the tiled path"
)
assert (
animation_waits == []
), "No global 2s animation wait_for_timeout should fire on the tiled path"
@patch("superset.utils.webdriver.PLAYWRIGHT_AVAILABLE", True)
@patch("superset.utils.webdriver._browser_manager")
@@ -1194,6 +1195,6 @@ class TestWebDriverPlaywrightAnimationWaitOrder:
timeout_values = [
call[0][0] for call in mock_page.wait_for_timeout.call_args_list
]
assert timeout_values == [0], (
f"Expected only [0] (headstart), got {timeout_values}"
)
assert timeout_values == [
0
], f"Expected only [0] (headstart), got {timeout_values}"