feat(alloy): make scrape/housekeeping interval configurable #68
@@ -23,6 +23,11 @@ SECRET_BASIC_AUTH_VERSION=v1
|
||||
# Enable container filesystem usage metrics (expensive du-scan, ~30% CPU on large hosts)
|
||||
# CADVISOR_DISK_USAGE=1
|
||||
|
||||
# How often metrics are sent to Prometheus, and how often cadvisor
|
||||
# refreshes its container stats. Keep the second value lower than the first.
|
||||
# PROMETHEUS_SCRAPE_INTERVAL=120s
|
||||
# CADVISOR_HOUSEKEEPING_INTERVAL=60s
|
||||
|
||||
# Enable authenticated scraping of containers that opt in via
|
||||
# prometheus.io/auth=basic or prometheus.io/auth=bearer labels (used as
|
||||
# password/bearer token respectively). Insert it with:
|
||||
|
||||
@@ -11,7 +11,7 @@ export MATRIX_ALERTMANAGER_CONFIG_VERSION=v2
|
||||
export MATRIX_ALERTMANAGER_ENTRYPOINT_VERSION=v1
|
||||
export GF_ALERTS_NODE_VERSION=v5
|
||||
export GF_ALERTS_LOKI_VERSION=v5
|
||||
export CONFIG_ALLOY_VERSION=v4
|
||||
export CONFIG_ALLOY_VERSION=v5
|
||||
export GF_ALERTS_TRAEFIK_VERSION=v1
|
||||
|
||||
# migrates secrets from old names to new names by reading values from the
|
||||
|
||||
+6
-4
@@ -21,6 +21,8 @@ prometheus.exporter.cadvisor "docker" {
|
||||
{{ end }}
|
||||
// host-wide totals already come from prometheus.exporter.unix
|
||||
disable_root_cgroup_stats = true
|
||||
housekeeping_interval = "{{ or (env "CADVISOR_HOUSEKEEPING_INTERVAL") "60s" }}"
|
||||
max_housekeeping_interval = "{{ or (env "CADVISOR_HOUSEKEEPING_INTERVAL") "60s" }}"
|
||||
}
|
||||
|
||||
prometheus.exporter.unix "default" {
|
||||
@@ -44,7 +46,7 @@ prometheus.exporter.unix "default" {
|
||||
prometheus.exporter.self "alloy" {}
|
||||
|
||||
prometheus.scrape "default" {
|
||||
scrape_interval = "120s"
|
||||
scrape_interval = "{{ or (env "PROMETHEUS_SCRAPE_INTERVAL") "120s" }}"
|
||||
|
||||
targets = array.concat(
|
||||
prometheus.exporter.self.alloy.targets,
|
||||
@@ -251,14 +253,14 @@ discovery.relabel "metrics_bearerauth" {
|
||||
}
|
||||
|
||||
prometheus.scrape "containers" {
|
||||
scrape_interval = "120s"
|
||||
scrape_interval = "{{ or (env "PROMETHEUS_SCRAPE_INTERVAL") "120s" }}"
|
||||
targets = discovery.relabel.metrics_noauth.output
|
||||
forward_to = [prometheus.remote_write.prometheus.receiver]
|
||||
}
|
||||
|
||||
{{ if ne (env "SECRET_SCRAPE_AUTH_VERSION") "" }}
|
||||
prometheus.scrape "containers_basicauth" {
|
||||
scrape_interval = "120s"
|
||||
scrape_interval = "{{ or (env "PROMETHEUS_SCRAPE_INTERVAL") "120s" }}"
|
||||
targets = discovery.relabel.metrics_basicauth.output
|
||||
forward_to = [prometheus.remote_write.prometheus.receiver]
|
||||
basic_auth {
|
||||
@@ -268,7 +270,7 @@ prometheus.scrape "containers_basicauth" {
|
||||
}
|
||||
|
||||
prometheus.scrape "containers_bearerauth" {
|
||||
scrape_interval = "120s"
|
||||
scrape_interval = "{{ or (env "PROMETHEUS_SCRAPE_INTERVAL") "120s" }}"
|
||||
targets = discovery.relabel.metrics_bearerauth.output
|
||||
forward_to = [prometheus.remote_write.prometheus.receiver]
|
||||
bearer_token = "{{ secret "scrape_auth" }}"
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
cadvisor's housekeeping interval now defaults to 60s (previously 1s regardless of scrape interval) and is configurable via the new CADVISOR_HOUSEKEEPING_INTERVAL env var; the Prometheus scrape interval is configurable too, via the new PROMETHEUS_SCRAPE_INTERVAL env var (default 120s, unchanged).
|
||||
Reference in New Issue
Block a user