Skip to content

Commit 8c9653b

Browse files
committed
Scrape_configs: retain cAdvisor metrics for system processes
Currently, CPU metrics for Kubelet, Containerd, etc. are dropped by a relabel rule since they don't have a container image. On most systems they run in their own cgroup called `system.slice`, so we can add another rule which uses that fact to give the `image` label a value and then they won't be dropped.
1 parent 254dfb6 commit 8c9653b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

prometheus/scrape_configs.libsonnet

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,15 @@
254254
},
255255
],
256256

257+
metric_relabel_configs: [
258+
// Let system processes like kubelet survive the next rule by giving them a fake image.
259+
{
260+
source_labels: ['__name__', 'id'],
261+
regex: 'container_([a-z_]+);/system.slice/(.+)',
262+
target_label: 'image',
263+
replacement: '$2',
264+
},
265+
257266
metric_relabel_configs: [
258267
// Drop container_* metrics with no image.
259268
{

0 commit comments

Comments
 (0)