cadvisor's housekeeping interval defaults to 1s regardless of the Prometheus scrape interval (120s), so container stats were being collected more often than needed.
Alloy 1.22 added a housekeeping_interval argument to prometheus.exporter.cadvisor. This PR sets it explicitly to match the default scrape interval instead of relying on the 1s default, lowering Alloy's CPU usage.
Two new env vars:
PROMETHEUS_SCRAPE_INTERVAL (default 120s, unchanged): how often metrics are sent to Prometheus.
CADVISOR_HOUSEKEEPING_INTERVAL (default 60s): how often cadvisor refreshes its container stats.
Both are independent timers. Keep the cadvisor housekeeping interval below the scrape interval, so a new sample is collected before every scrape. Otherwise, some scrapes can read the same cached value twice.
cadvisor's housekeeping interval defaults to 1s regardless of the Prometheus scrape interval (120s), so container stats were being collected more often than needed.
Alloy 1.22 added a `housekeeping_interval` argument to `prometheus.exporter.cadvisor`. This PR sets it explicitly to match the default scrape interval instead of relying on the 1s default, lowering Alloy's CPU usage.
Two new env vars:
- `PROMETHEUS_SCRAPE_INTERVAL` (default 120s, unchanged): how often metrics are sent to Prometheus.
- `CADVISOR_HOUSEKEEPING_INTERVAL` (default 60s): how often cadvisor refreshes its container stats.
Both are independent timers. Keep the cadvisor housekeeping interval below the scrape interval, so a new sample is collected before every scrape. Otherwise, some scrapes can read the same cached value twice.
Alloy v1.22.0 added housekeeping_interval to the cadvisor exporter,
which previously defaulted to 1s regardless of scrape interval,
wasting CPU. Make it configurable via CADVISOR_HOUSEKEEPING_INTERVAL
(default 60s), and the Prometheus scrape interval via
PROMETHEUS_SCRAPE_INTERVAL (default 120s, unchanged).
CODEOWNERS rules
requested review from monitoring-ng-maintainers 2026-12-01 14:21:29 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
cadvisor's housekeeping interval defaults to 1s regardless of the Prometheus scrape interval (120s), so container stats were being collected more often than needed.
Alloy 1.22 added a
housekeeping_intervalargument toprometheus.exporter.cadvisor. This PR sets it explicitly to match the default scrape interval instead of relying on the 1s default, lowering Alloy's CPU usage.Two new env vars:
PROMETHEUS_SCRAPE_INTERVAL(default 120s, unchanged): how often metrics are sent to Prometheus.CADVISOR_HOUSEKEEPING_INTERVAL(default 60s): how often cadvisor refreshes its container stats.Both are independent timers. Keep the cadvisor housekeeping interval below the scrape interval, so a new sample is collected before every scrape. Otherwise, some scrapes can read the same cached value twice.
Nice 😍