Skip to content

Commit 4e96f7b

Browse files
committed
Adjust dropped metrics from cAdvisor
This change drops pod-centric metrics without a non-empty 'container' label. Previously we dropped pod-centric metrics without a (pod, namespace) label set however these can be critical for debugging. Keep 'container_fs_.*' metrics from cAdvisor
1 parent 49eb7c6 commit 4e96f7b

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

jsonnet/kube-prometheus/components/k8s-control-plane.libsonnet

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ function(params) {
127127
action: 'drop',
128128
regex: '(' + std.join('|',
129129
[
130-
'container_fs_.*', // add filesystem read/write data (nodes*disks*services*4)
131130
'container_spec_.*', // everything related to cgroup specification and thus static data (nodes*services*5)
132-
'container_blkio_device_usage_total', // useful for containers, but not for system services (nodes*disks*services*operations*2)
133131
'container_file_descriptors', // file descriptors limits and global numbers are exposed via (nodes*services)
134132
'container_sockets', // used sockets in cgroup. Usually not important for system services (nodes*services)
135133
'container_threads_max', // max number of threads in cgroup. Usually for system services it is not limited (nodes*services)
@@ -138,6 +136,14 @@ function(params) {
138136
'container_last_seen', // not needed as system services are always running (nodes*services)
139137
]) + ');;',
140138
},
139+
{
140+
sourceLabels: ['__name__', 'container'],
141+
action: 'drop',
142+
regex: '(' + std.join('|',
143+
[
144+
'container_blkio_device_usage_total',
145+
]) + ');.+',
146+
},
141147
],
142148
},
143149
{

manifests/kubernetes-serviceMonitorKubelet.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,16 @@ spec:
6161
sourceLabels:
6262
- __name__
6363
- action: drop
64-
regex: (container_fs_.*|container_spec_.*|container_blkio_device_usage_total|container_file_descriptors|container_sockets|container_threads_max|container_threads|container_start_time_seconds|container_last_seen);;
64+
regex: (container_spec_.*|container_file_descriptors|container_sockets|container_threads_max|container_threads|container_start_time_seconds|container_last_seen);;
6565
sourceLabels:
6666
- __name__
6767
- pod
6868
- namespace
69+
- action: drop
70+
regex: (container_blkio_device_usage_total);.+
71+
sourceLabels:
72+
- __name__
73+
- container
6974
path: /metrics/cadvisor
7075
port: https-metrics
7176
relabelings:

0 commit comments

Comments
 (0)