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

   ### Decisions made that were not in the instructions
   - Also enriched the initial-request-failure log 
(`SupersetClient.post(...).catch(...)`), since it's a terminal-failure path in 
the same download flow and previously logged only the bare `error` object with 
no identifying context.
   - Used two distinct message strings ("Max retries reached" vs "Failed to 
trigger dashboard screenshot") to keep the two failure paths distinguishable in 
log output, rather than reusing one generic string.
   
   ### SUMMARY
   `useDownloadScreenshot` polls a screenshot endpoint after triggering a 
direct dashboard PDF/PNG download, and previously logged terminal failures with 
no identifying context:
   - `logging.error('Max retries reached')` when retry polling was exhausted.
   - `logging.error(error)` when the initial trigger request failed.
   
   Neither log call included the cache key, dashboard id, or requested format, 
making it impossible to correlate a client-side download failure with 
server-side logs for the same attempt (e.g. cache-key-keyed logs on the 
screenshot-cache-validation path).
   
   This PR passes that context as structured arguments to `logging.error`, 
following `console.error(message, ...args)` semantics, so the values remain 
accessible to any consumer that parses the additional console arguments:
   - Retry-exhausted path now logs `logging.error('Max retries reached', { 
cacheKey, dashboardId, format })`.
   - Initial-request-failure path now logs `logging.error('Failed to trigger 
dashboard screenshot', { dashboardId, format, error })`.
   
   No behavior changes — no new retries, toasts, or timing changes. Purely 
additive log context.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A — logging-only change, no UI impact.
   
   ### TESTING INSTRUCTIONS
   - Added two unit tests to the existing `useDownloadScreenshot.test.ts` 
asserting the enriched log calls include the expected fields:
     - `logs cacheKey, dashboardId, and format when retries are exhausted`
     - `logs dashboardId, format, and the error when the initial screenshot 
request fails`
   - Ran `npx jest src/dashboard/hooks/useDownloadScreenshot.test.ts` — all 5 
tests pass (3 pre-existing + 2 new).
   - Ran `pre-commit run` (prettier, oxlint, custom rules, stylelint, frontend 
type-checking) on the changed files — all pass.
   
   ### ADDITIONAL INFORMATION
   - [ ] 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to