Commit b59f269
authored
Metrics whitelist for alloy (#418)
## Summary
Comprehensive metrics cost control for the monitoring module — reduces
cardinality, halves DPM billing, fixes broken scraping, and adds
bad-node detection capability.
### Scrape interval standardization (halves DPM)
- **All monitors now use 60s scrape interval** (Grafana recommendation)
— directly halves data points per minute (DPM), reducing Grafana Cloud
billing (billed at 95th percentile)
- Changed: kubelet, cadvisor, KSM, DCGM, ARC controller, Karpenter,
BuildKit, BuildKit HAProxy, Harbor, git-cache-central, git-cache
DaemonSet, node-compactor
- Exceptions: arc-listeners (3m), node-exporter/apiserver/coredns
(already 60s)
### Metrics cardinality reduction
- **Disable kubelet `/metrics/probes`** (`probes: false`) — drops ~1800
`prober_probe_*` series with no alerting value
- **Karpenter**: replace broad regex with precise keep list (7 metrics)
— saves ~400-500 series by dropping all histogram buckets and low-value
gauges
- **API server**: switch from drop-list to keep-whitelist
(`apiserver_request_total`, `apiserver_request_terminations_total`)
- **ARC controller**: add keep-whitelist (`gha_controller_.*`,
`controller_runtime_reconcile_errors_total`)
- **BuildKit**: drop `go_.*`, `process_.*`, `promhttp_.*`, and all
`_bucket` histograms
- **BuildKit HAProxy**: switch to keep-list (4 metrics:
`haproxy_server_status`, `haproxy_server_current_sessions`,
`haproxy_server_connection_errors_total`,
`haproxy_backend_current_sessions`)
- **Harbor**: drop `go_.*`, `process_.*`, `promhttp_.*`
- **KSM**: explicit `keep` allowlist (RE2-compatible, no lookahead):
- daemonset: 4 health status metrics only
- deployment: 5 core metrics (replica status + conditions + desired
count)
- namespace/node/statefulset/pv/hpa/job: all (low cardinality)
- pod: `kube_pod_info` + error indicators + non-routine status reasons
- Drop successful terminations (exit code 0, reason Completed)
- Drop routine status reasons (Shutdown, NodeAffinity)
- **Node-exporter**: keep-whitelist for CPU (idle/iowait only) and
memory metrics
- **Kubelet**: keep-whitelist for `kubelet_running_pods/containers` and
`kubelet_node_name`
- **Alloy cost_control**: drop
`go_.*|process_.*|promhttp_.*|prometheus_operator_.*` globally, drop
`kubernetes_feature_enabled`, drop ARC histogram buckets
### Fix KSM regex (RE2 compatibility)
- Replace `(?!...)` negative lookahead with explicit `keep` allowlist —
RE2 (used by Prometheus/Alloy relabeling) does not support lookahead
syntax, causing all `kube_*` metrics to be silently dropped
### Bad node detection
- **Keep `kube_pod_info`** in KSM metrics — provides `node` label to
correlate pod failures with specific nodes:
```promql
count(
kube_pod_container_status_last_terminated_exitcode{container_exit_code!="0"}
* on(namespace, pod) group_left(node) kube_pod_info
) by (node)
```
### Fix arc-listeners PodMonitor (was returning no data)
- **Namespace**: `arc-runners` → `arc-systems` (listener pods run in
arc-systems)
- **Label selector**: → `app.kubernetes.io/component:
runner-scale-set-listener`
- **Add metricRelabelings**: keep only important listener metrics, drop
`instance` label
- **Scrape interval**: 30s → 3m (reduce load, listener metrics change
slowly)
### Documentation
- Add comprehensive "What we collect" section to CLAUDE.md per source
- Document 60s scrape interval standard, KSM keep-list, HAProxy
keep-list, status_reason filtering1 parent f63f995 commit b59f269
15 files changed
Lines changed: 158 additions & 37 deletions
File tree
- osdc/modules/monitoring
- helm
- kubernetes/monitors
- podmonitors
- servicemonitors
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
| 115 | + | |
114 | 116 | | |
115 | 117 | | |
116 | 118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
53 | | - | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
57 | | - | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | | - | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
64 | | - | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | | - | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
71 | | - | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | | - | |
| 76 | + | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
78 | | - | |
| 80 | + | |
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
33 | 55 | | |
34 | 56 | | |
35 | 57 | | |
| |||
66 | 88 | | |
67 | 89 | | |
68 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
69 | 99 | | |
70 | 100 | | |
71 | 101 | | |
72 | 102 | | |
73 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
74 | 133 | | |
75 | 134 | | |
76 | 135 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
Lines changed: 3 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 30 | + | |
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
0 commit comments