chore(reports): thread cache-key/execution-id log context through screenshot capture logs - #42657
chore(reports): thread cache-key/execution-id log context through screenshot capture logs#42657eschutho wants to merge 1 commit into
Conversation
Code Review Agent Run #c28ae9Actionable Suggestions - 0Additional Suggestions - 2
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #42657 +/- ##
==========================================
+ Coverage 55.88% 65.44% +9.56%
==========================================
Files 2810 2810
Lines 159375 159381 +6
Branches 36374 36373 -1
==========================================
+ Hits 89062 104304 +15242
+ Misses 69481 53034 -16447
- Partials 832 2043 +1211
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…eenshot capture logs The screenshot capture code is reached by two call paths that identify their runs differently: scheduled reports carry an execution_id (already threaded end-to-end via log_context since #42253), while thumbnails and direct PDF/screenshot downloads are identified by their cache_key -- which was never passed down. BaseScreenshot.compute_and_cache had the cache_key in hand and get_screenshot already accepted a log_context parameter, but the two were never connected, so every capture-layer log line produced by a thumbnail or direct-download run is anonymous: there is no way to join "trying to generate screenshot" / webdriver navigation / readiness / capture-result log lines to the cached digest they were computing. This threads the existing optional log_context through the remaining capture-layer log lines, and populates it on the thumbnail path: - screenshots.py: compute_and_cache passes log_context=f"cache_key={cache_key}" into get_screenshot and resize_image; the thumbnail lifecycle log lines (generate/fail/resize/ cache-updated) now include the cache_key; driver() accepts log_context for its Playwright-unavailable fallback notice. - webdriver.py: the non-tiled Playwright log lines (navigation, headstart, element/chart-container waits, screenshot result), the entire WebDriverSelenium.get_screenshot path, and find_unexpected_errors (both engines) now append the context suffix. - screenshot_utils.py: the non-budget tiled log lines (dimensions, tile count, scroll, capture, skip, combine) and combine_screenshot_tiles gain the same suffix. Log-line/plumbing only -- no behavior change. Split out of #42118 per its scope reduction to tiled-path budgeting; the readiness log lines added by Co-Authored-By: Claude <noreply@anthropic.com>
560e52c to
b5eca9a
Compare
Code Review Agent Run #447e0eActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
SUMMARY
The screenshot capture code is reached by two call paths that identify their runs differently: scheduled reports carry an
execution_id(already threaded end-to-end vialog_contextsince #42253), while thumbnails and direct PDF/screenshot downloads are identified by theircache_key— which was never passed down.BaseScreenshot.compute_and_cachehas the cache_key in hand andget_screenshotalready accepts alog_contextparameter, but the two were never connected: every capture-layer log line produced by a thumbnail or direct-download run is anonymous, so an "exact-cache-key production trace" (auth → navigation → readiness → capture → terminal cache state, joined on one key) is impossible on that path today. Incident investigations degenerate into filtered-log archaeology across thousands of unkeyed lines.This PR threads the existing optional
log_contextthrough the remaining capture-layer log lines and populates it on the thumbnail path:screenshots.py— the load-bearing change:compute_and_cachepasseslog_context=f"cache_key={cache_key}"intoget_screenshotandresize_image; the thumbnail lifecycle lines ("trying to generate screenshot", generate/resize failures, "Updated thumbnail cache") now include the cache_key;driver()acceptslog_contextfor its Playwright-unavailable fallback notice.webdriver.py— the non-tiled Playwright log lines (navigation timeout, headstart sleep, element/chart-container waits, screenshot result, unexpected-error handler), the entireWebDriverSelenium.get_screenshotpath, andfind_unexpected_errors(both engines) now append the[cache_key=…]/[execution_id=…]suffix.screenshot_utils.py— the non-budget tiled log lines (dashboard dimensions, tile count, scroll, capture, skip, combine) andcombine_screenshot_tilesgain the same suffix.Log-line/plumbing only — no behavior change. Split out of #42118 per its scope reduction to tiled-path budgeting only. The readiness log lines added by #42253/#42427 already carry
log_contextand are untouched; the report path already suppliesexecution_idand needs no changes.New test pins the load-bearing wiring:
compute_and_cachemust callget_screenshot/resize_imagewithlog_context="cache_key=<key>". Existing log-assertion tests updated for the added suffix argument.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable; logging only. Example log line after:
Taking screenshot of url http://… as user reports_user [cache_key=a10e2389…]TESTING INSTRUCTIONS
ADDITIONAL INFORMATION