feat(sources): log poll failures and recoveries with source context #38

Manually merged
jfro merged 3 commits from feat/16-poll-logging into main 2026-11-01 21:12:14 +00:00
Owner

Closes #16.

The Poller logged [id] poll failed: msg on every interval, with no source type, name, HTTP status or duration. Now it logs state changes:

  • Starts failing, or fails with a different error: warning, e.g. Source 3 (Proxmox VE "pve") poll failed after 412ms (HTTP 401): pve rejected the credentials (HTTP 401). Check the API token. Metadata: source_id, source_type, http_status, duration_ms.
  • Recovers: info, once: Source 3 (Proxmox VE "pve") recovered after 5 failed polls (300s); polled in 120ms.
  • Same failure again, healthy polls: debug only (signal count + duration).

The HTTP status is read from the HTTP NNN the shared Sources.HTTP helpers put in every error message, so it's set for all HTTP sources without changing the SourceType contract. poll_once/2 (Test connection, tests) still warns on every failure since it has no history. Processing errors also carry source_id/source_type metadata now.

Tests: new sync PollerLoggingTest drives a real Poller through scripted results (start failing, same error again, a different error, recovery, healthy). mix precommit: 806 passed.

Closes #16. The Poller logged `[id] poll failed: msg` on every interval, with no source type, name, HTTP status or duration. Now it logs state changes: - **Starts failing, or fails with a different error**: warning, e.g. `Source 3 (Proxmox VE "pve") poll failed after 412ms (HTTP 401): pve rejected the credentials (HTTP 401). Check the API token.` Metadata: source_id, source_type, http_status, duration_ms. - **Recovers**: info, once: `Source 3 (Proxmox VE "pve") recovered after 5 failed polls (300s); polled in 120ms`. - **Same failure again, healthy polls**: debug only (signal count + duration). The HTTP status is read from the `HTTP NNN` the shared Sources.HTTP helpers put in every error message, so it's set for all HTTP sources without changing the SourceType contract. `poll_once/2` (Test connection, tests) still warns on every failure since it has no history. Processing errors also carry source_id/source_type metadata now. Tests: new sync PollerLoggingTest drives a real Poller through scripted results (start failing, same error again, a different error, recovery, healthy). `mix precommit`: 806 passed.
jfro added this to the v1.0 milestone 2026-11-01 20:45:33 +00:00
feat(sources): log poll failures and recoveries with source context
All checks were successful
CI / test (pull_request) Successful in 26s
7a0eadf30d
A failing source logged "[id] poll failed: msg" every interval with no
type, name, status or duration. Now a source that starts failing (or
fails differently) warns once with its id, type, name, HTTP status and
duration; recovery logs once at info with how many polls failed; repeat
failures and healthy polls log at debug.

Closes #16
fix(sources): leave failed-poll warnings to the Poller
Some checks failed
CI / test (pull_request) Failing after 26s
10f75a199f
Dokploy, Sable and Uptime Robot logged their own warnings on every failed
poll, so a source that stayed down still warned each interval. Requests that
fail a poll now log at debug; Dokploy's deploy lookups, which don't fail the
poll, still warn. A raise in Triggers.process no longer hides the poll's
outcome from the Poller's log.
test(sources): only refute this test's own poll warning
All checks were successful
CI / test (pull_request) Successful in 26s
bd7e99f33e
capture_log in async tests also picks up other tests' Poller warnings.
jfro manually merged commit 06b9e71d99 into main 2026-11-01 21:12:14 +00:00
Sign in to join this conversation.
No description provided.