mirror of
https://github.com/unpoller/unpoller.git
synced 2026-10-22 05:09:10 +02:00
fix(prometheus): serve scrapes from cached background poll (#1013)
Decouples Prometheus scrape cadence from upstream UniFi API calls so a 429 backoff loop on the controller side no longer stalls /metrics. The output plugin now owns a 60s background poller (configurable) whose result is served from an in-memory cache. Concurrent /scrape requests for the same target are coalesced via singleflight to prevent a noisy scraper from multiplying upstream load. Adds two new metrics so operators can detect cache staleness and refresh failures independently: - unpoller_prometheus_cache_age_seconds - unpoller_prometheus_refresh_failures_total Background goroutine recovers from panics so a malformed input payload no longer silently kills refreshes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
0b83c6ad19
commit
dabfeffe66
@@ -35,6 +35,10 @@
|
||||
report_errors = false
|
||||
## Record data for disabled or down (unlinked) switch ports.
|
||||
dead_ports = false
|
||||
# How often the background poller refreshes the cache served to /metrics.
|
||||
# Decouples scrape cadence from UniFi API calls so 429 backoff loops no
|
||||
# longer block /metrics. Default: 60s. Values below 15s are clamped to 15s.
|
||||
interval = "60s"
|
||||
|
||||
[influxdb]
|
||||
disable = false
|
||||
|
||||
Reference in New Issue
Block a user