Skip to content

Log preload outcomes and PageSpeed failure reasons - #255

Merged
michaelbonner merged 2 commits into
masterfrom
log-preload-outcomes
Oct 27, 2026
Merged

michaelbonner merged 2 commits into
masterfrom
log-preload-outcomes

Conversation

@michaelbonner

Copy link
Copy Markdown
Collaborator

Summary

PageSpeed preload
  request page data
    report PageSpeed's error message when available
  save result
    report write failures as failed attempts
  log each successful page and each failed page

The success logs let Grafana distinguish repeated failures from occasional failures. A review found that database write errors were previously swallowed, which could produce a false success log. Those errors now reach the preload job.

Evidence

  • Before: A failed database insert could still log preload ok and count toward preloaded.
    After: The insert rejects, so the job logs preload failed and excludes it from preloaded.
  • bun run lint passed.
  • bunx tsc --noEmit passed.
  • git diff --check passed.

Merge Danger

Door: Two-way

Blast Radius: Preload and live PageSpeed requests

A database write failure now fails the request instead of returning an unsaved result.

A Grafana alert should fire only when a site keeps failing, not on a single
failed preload. That needs successes in the logs too, so each fulfilled
preload now logs "preload ok: <strategy> <url>".

Failures logged only "Failed to fetch data", with PageSpeed's actual reason
in a separate multi-line dump. The thrown error now carries PageSpeed's
error.message (e.g. FAILED_DOCUMENT_REQUEST ... ERR_TIMED_OUT), so the
"preload failed" line says why on its own.

Claude-Session: https://claude.ai/code/session_0113RYCb5vdxZQeeQvq5q4Cd
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🧹 Preview environment for this PR has been torn down.

@michaelbonner
michaelbonner merged commit 68cdc4f into master Oct 27, 2026
5 checks passed
@michaelbonner
michaelbonner deleted the log-preload-outcomes branch October 27, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant