Skip to content

Commit

Permalink
fix: using empty image label for container metrics (#122)
Browse files Browse the repository at this point in the history
Signed-off-by: David Calvert <[email protected]>
  • Loading branch information
dotdc authored Sep 30, 2024
1 parent bfda0bd commit 6a5ef77
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 32 deletions.
6 changes: 3 additions & 3 deletions dashboards/k8s-addons-prometheus.json
Original file line number Diff line number Diff line change
Expand Up @@ -2080,7 +2080,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(rate(container_cpu_usage_seconds_total{pod=~\"$pod\", image!=\"\", container!=\"\", cluster=~\"$cluster\"}[$__rate_interval])) by (pod, container)",
"expr": "sum(rate(container_cpu_usage_seconds_total{pod=~\"$pod\", image=\"\", container!=\"\", cluster=~\"$cluster\"}[$__rate_interval])) by (pod, container)",
"interval": "$resolution",
"legendFormat": "{{ pod }} - {{ container }}",
"range": true,
Expand Down Expand Up @@ -2184,7 +2184,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(container_memory_working_set_bytes{pod=~\"$pod\", image!=\"\", container!=\"\", cluster=~\"$cluster\"}) by (pod, container)",
"expr": "sum(container_memory_working_set_bytes{pod=~\"$pod\", image=\"\", container!=\"\", cluster=~\"$cluster\"}) by (pod, container)",
"interval": "",
"legendFormat": "{{ pod }} - {{ container }}",
"range": true,
Expand Down Expand Up @@ -3145,6 +3145,6 @@
"timezone": "",
"title": "Prometheus",
"uid": "k8s_addons_prometheus",
"version": 3,
"version": 4,
"weekStart": ""
}
8 changes: 4 additions & 4 deletions dashboards/k8s-views-global.json
Original file line number Diff line number Diff line change
Expand Up @@ -1514,7 +1514,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(rate(container_cpu_usage_seconds_total{image!=\"\", cluster=\"$cluster\"}[$__rate_interval])) by (namespace)\n+ on (namespace)\n(sum(rate(windows_container_cpu_usage_seconds_total{container_id!=\"\", cluster=\"$cluster\"}[$__rate_interval]) * on (container_id) group_left (container, pod, namespace) max by ( container, container_id, pod, namespace) (kube_pod_container_info{container_id!=\"\", cluster=\"$cluster\"}) OR kube_namespace_created{cluster=\"$cluster\"} * 0) by (namespace))",
"expr": "sum(rate(container_cpu_usage_seconds_total{image=\"\", cluster=\"$cluster\"}[$__rate_interval])) by (namespace)\n+ on (namespace)\n(sum(rate(windows_container_cpu_usage_seconds_total{container_id!=\"\", cluster=\"$cluster\"}[$__rate_interval]) * on (container_id) group_left (container, pod, namespace) max by ( container, container_id, pod, namespace) (kube_pod_container_info{container_id!=\"\", cluster=\"$cluster\"}) OR kube_namespace_created{cluster=\"$cluster\"} * 0) by (namespace))",
"format": "time_series",
"hide": false,
"interval": "$resolution",
Expand Down Expand Up @@ -1621,7 +1621,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(container_memory_working_set_bytes{image!=\"\", cluster=\"$cluster\"}) by (namespace)\n+ on (namespace)\n(sum(windows_container_memory_usage_commit_bytes{container_id!=\"\", cluster=\"$cluster\"} * on (container_id) group_left (container, pod, namespace) max by ( container, container_id, pod, namespace) (kube_pod_container_info{container_id!=\"\", cluster=\"$cluster\"}) OR kube_namespace_created{cluster=\"$cluster\"} * 0) by (namespace))",
"expr": "sum(container_memory_working_set_bytes{image=\"\", cluster=\"$cluster\"}) by (namespace)\n+ on (namespace)\n(sum(windows_container_memory_usage_commit_bytes{container_id!=\"\", cluster=\"$cluster\"} * on (container_id) group_left (container, pod, namespace) max by ( container, container_id, pod, namespace) (kube_pod_container_info{container_id!=\"\", cluster=\"$cluster\"}) OR kube_namespace_created{cluster=\"$cluster\"} * 0) by (namespace))",
"interval": "$resolution",
"legendFormat": "{{ namespace }}",
"range": true,
Expand Down Expand Up @@ -1971,7 +1971,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(rate(container_cpu_cfs_throttled_seconds_total{image!=\"\", cluster=\"$cluster\"}[$__rate_interval])) by (namespace) > 0",
"expr": "sum(rate(container_cpu_cfs_throttled_seconds_total{image=\"\", cluster=\"$cluster\"}[$__rate_interval])) by (namespace) > 0",
"interval": "$resolution",
"legendFormat": "{{ namespace }}",
"range": true,
Expand Down Expand Up @@ -3520,6 +3520,6 @@
"timezone": "",
"title": "Kubernetes / Views / Global",
"uid": "k8s_views_global",
"version": 40,
"version": 41,
"weekStart": ""
}
16 changes: 8 additions & 8 deletions dashboards/k8s-views-namespaces.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=~\"$namespace\", image!=\"\", cluster=\"$cluster\"}[$__rate_interval])) / sum(machine_cpu_cores{cluster=\"$cluster\"})",
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=~\"$namespace\", image=\"\", cluster=\"$cluster\"}[$__rate_interval])) / sum(machine_cpu_cores{cluster=\"$cluster\"})",
"instant": true,
"interval": "",
"legendFormat": "",
Expand Down Expand Up @@ -226,7 +226,7 @@
"uid": "${datasource}"
},
"exemplar": true,
"expr": "sum(container_memory_working_set_bytes{namespace=~\"$namespace\", image!=\"\", cluster=\"$cluster\"}) / sum(machine_memory_bytes{cluster=\"$cluster\"})",
"expr": "sum(container_memory_working_set_bytes{namespace=~\"$namespace\", image=\"\", cluster=\"$cluster\"}) / sum(machine_memory_bytes{cluster=\"$cluster\"})",
"interval": "",
"legendFormat": "",
"refId": "A"
Expand Down Expand Up @@ -493,7 +493,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=~\"$namespace\", image!=\"\", cluster=\"$cluster\"}[$__rate_interval]))",
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=~\"$namespace\", image=\"\", cluster=\"$cluster\"}[$__rate_interval]))",
"interval": "",
"legendFormat": "Real",
"range": true,
Expand Down Expand Up @@ -595,7 +595,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(container_memory_working_set_bytes{namespace=~\"$namespace\", image!=\"\", cluster=\"$cluster\"})",
"expr": "sum(container_memory_working_set_bytes{namespace=~\"$namespace\", image=\"\", cluster=\"$cluster\"})",
"interval": "",
"legendFormat": "Real",
"range": true,
Expand Down Expand Up @@ -747,7 +747,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=~\"$namespace\", image!=\"\", pod=~\"${created_by}.*\", cluster=\"$cluster\"}[$__rate_interval])) by (pod)",
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=~\"$namespace\", image=\"\", pod=~\"${created_by}.*\", cluster=\"$cluster\"}[$__rate_interval])) by (pod)",
"interval": "$resolution",
"legendFormat": "{{ pod }}",
"range": true,
Expand Down Expand Up @@ -846,7 +846,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(container_memory_working_set_bytes{namespace=~\"$namespace\", image!=\"\", pod=~\"${created_by}.*\", cluster=\"$cluster\"}) by (pod)",
"expr": "sum(container_memory_working_set_bytes{namespace=~\"$namespace\", image=\"\", pod=~\"${created_by}.*\", cluster=\"$cluster\"}) by (pod)",
"interval": "$resolution",
"legendFormat": "{{ pod }}",
"range": true,
Expand Down Expand Up @@ -956,7 +956,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(rate(container_cpu_cfs_throttled_seconds_total{namespace=~\"$namespace\", image!=\"\", pod=~\"${created_by}.*\", cluster=\"$cluster\"}[$__rate_interval])) by (pod) > 0",
"expr": "sum(rate(container_cpu_cfs_throttled_seconds_total{namespace=~\"$namespace\", image=\"\", pod=~\"${created_by}.*\", cluster=\"$cluster\"}[$__rate_interval])) by (pod) > 0",
"interval": "$resolution",
"legendFormat": "{{ pod }}",
"range": true,
Expand Down Expand Up @@ -2789,6 +2789,6 @@
"timezone": "",
"title": "Kubernetes / Views / Namespaces",
"uid": "k8s_views_ns",
"version": 36,
"version": 37,
"weekStart": ""
}
6 changes: 3 additions & 3 deletions dashboards/k8s-views-nodes.json
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@
"uid": "${datasource}"
},
"exemplar": true,
"expr": "sum(rate(container_cpu_usage_seconds_total{node=\"$node\", image!=\"\", cluster=\"$cluster\"}[$__rate_interval])) by (pod)",
"expr": "sum(rate(container_cpu_usage_seconds_total{node=\"$node\", image=\"\", cluster=\"$cluster\"}[$__rate_interval])) by (pod)",
"interval": "$resolution",
"legendFormat": "{{ pod }}",
"refId": "A"
Expand Down Expand Up @@ -1335,7 +1335,7 @@
"uid": "${datasource}"
},
"exemplar": true,
"expr": "sum(container_memory_working_set_bytes{node=\"$node\", image!=\"\", cluster=\"$cluster\"}) by (pod)",
"expr": "sum(container_memory_working_set_bytes{node=\"$node\", image=\"\", cluster=\"$cluster\"}) by (pod)",
"interval": "$resolution",
"legendFormat": "{{ pod }}",
"refId": "A"
Expand Down Expand Up @@ -3978,6 +3978,6 @@
"timezone": "",
"title": "Kubernetes / Views / Nodes",
"uid": "k8s_views_nodes",
"version": 30,
"version": 31,
"weekStart": ""
}
28 changes: 14 additions & 14 deletions dashboards/k8s-views-pods.json
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=\"$namespace\", pod=~\"$pod\", image!=\"\", cluster=\"$cluster\"}[$__rate_interval])) / sum(kube_pod_container_resource_requests{namespace=\"$namespace\", pod=~\"$pod\", resource=\"cpu\", job=~\"$job\", cluster=\"$cluster\"})",
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=\"$namespace\", pod=~\"$pod\", image=\"\", cluster=\"$cluster\"}[$__rate_interval])) / sum(kube_pod_container_resource_requests{namespace=\"$namespace\", pod=~\"$pod\", resource=\"cpu\", job=~\"$job\", cluster=\"$cluster\"})",
"instant": true,
"interval": "$resolution",
"legendFormat": "Requests",
Expand Down Expand Up @@ -773,7 +773,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=\"$namespace\", pod=~\"$pod\", image!=\"\", cluster=\"$cluster\"}[$__rate_interval])) / sum(kube_pod_container_resource_limits{namespace=\"$namespace\", pod=~\"$pod\", resource=\"cpu\", job=~\"$job\", cluster=\"$cluster\"})",
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=\"$namespace\", pod=~\"$pod\", image=\"\", cluster=\"$cluster\"}[$__rate_interval])) / sum(kube_pod_container_resource_limits{namespace=\"$namespace\", pod=~\"$pod\", resource=\"cpu\", job=~\"$job\", cluster=\"$cluster\"})",
"instant": true,
"interval": "$resolution",
"legendFormat": "Limits",
Expand Down Expand Up @@ -850,7 +850,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\", pod=~\"$pod\", image!=\"\", cluster=\"$cluster\"}) / sum(kube_pod_container_resource_requests{namespace=\"$namespace\", pod=~\"$pod\", resource=\"memory\", job=~\"$job\", cluster=\"$cluster\"})",
"expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\", pod=~\"$pod\", image=\"\", cluster=\"$cluster\"}) / sum(kube_pod_container_resource_requests{namespace=\"$namespace\", pod=~\"$pod\", resource=\"memory\", job=~\"$job\", cluster=\"$cluster\"})",
"instant": true,
"interval": "$resolution",
"legendFormat": "Requests",
Expand Down Expand Up @@ -923,7 +923,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\", pod=~\"$pod\", image!=\"\", cluster=\"$cluster\"}) / sum(kube_pod_container_resource_limits{namespace=\"$namespace\", pod=~\"$pod\", resource=\"memory\", job=~\"$job\", cluster=\"$cluster\"}) ",
"expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\", pod=~\"$pod\", image=\"\", cluster=\"$cluster\"}) / sum(kube_pod_container_resource_limits{namespace=\"$namespace\", pod=~\"$pod\", resource=\"memory\", job=~\"$job\", cluster=\"$cluster\"}) ",
"instant": true,
"interval": "$resolution",
"legendFormat": "Limits",
Expand Down Expand Up @@ -1100,7 +1100,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=\"$namespace\", pod=~\"$pod\", image!=\"\", container!=\"\", cluster=\"$cluster\"}[$__rate_interval])) by (container)",
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=\"$namespace\", pod=~\"$pod\", image=\"\", container!=\"\", cluster=\"$cluster\"}[$__rate_interval])) by (container)",
"format": "table",
"hide": false,
"instant": true,
Expand All @@ -1115,7 +1115,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\", pod=~\"$pod\", image!=\"\", container!=\"\", cluster=\"$cluster\"}) by (container)",
"expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\", pod=~\"$pod\", image=\"\", container!=\"\", cluster=\"$cluster\"}) by (container)",
"format": "table",
"hide": false,
"instant": true,
Expand Down Expand Up @@ -1318,7 +1318,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=\"$namespace\", pod=~\"$pod\", image!=\"\", cluster=\"$cluster\"}[$__rate_interval])) by (container) / sum(kube_pod_container_resource_requests{namespace=\"$namespace\", pod=~\"$pod\", resource=\"cpu\", job=~\"$job\", cluster=\"$cluster\"}) by (container)",
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=\"$namespace\", pod=~\"$pod\", image=\"\", cluster=\"$cluster\"}[$__rate_interval])) by (container) / sum(kube_pod_container_resource_requests{namespace=\"$namespace\", pod=~\"$pod\", resource=\"cpu\", job=~\"$job\", cluster=\"$cluster\"}) by (container)",
"interval": "$resolution",
"legendFormat": "{{ container }} REQUESTS",
"range": true,
Expand All @@ -1330,7 +1330,7 @@
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=\"$namespace\", pod=~\"$pod\", image!=\"\", cluster=\"$cluster\"}[$__rate_interval])) by (container) / sum(kube_pod_container_resource_limits{namespace=\"$namespace\", pod=~\"$pod\", resource=\"cpu\", job=~\"$job\", cluster=\"$cluster\"}) by (container)",
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=\"$namespace\", pod=~\"$pod\", image=\"\", cluster=\"$cluster\"}[$__rate_interval])) by (container) / sum(kube_pod_container_resource_limits{namespace=\"$namespace\", pod=~\"$pod\", resource=\"cpu\", job=~\"$job\", cluster=\"$cluster\"}) by (container)",
"hide": false,
"legendFormat": "{{ container }} LIMITS",
"range": true,
Expand Down Expand Up @@ -1447,7 +1447,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\", pod=~\"$pod\", image!=\"\", cluster=\"$cluster\"}) by (container) / sum(kube_pod_container_resource_requests{namespace=\"$namespace\", pod=~\"$pod\", resource=\"memory\", job=~\"$job\", cluster=\"$cluster\"}) by (container)",
"expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\", pod=~\"$pod\", image=\"\", cluster=\"$cluster\"}) by (container) / sum(kube_pod_container_resource_requests{namespace=\"$namespace\", pod=~\"$pod\", resource=\"memory\", job=~\"$job\", cluster=\"$cluster\"}) by (container)",
"interval": "",
"legendFormat": "{{ container }} REQUESTS",
"range": true,
Expand All @@ -1459,7 +1459,7 @@
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\", pod=~\"$pod\", image!=\"\", cluster=\"$cluster\"}) by (container) / sum(kube_pod_container_resource_limits{namespace=\"$namespace\", pod=~\"$pod\", resource=\"memory\", job=~\"$job\", cluster=\"$cluster\"}) by (container)",
"expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\", pod=~\"$pod\", image=\"\", cluster=\"$cluster\"}) by (container) / sum(kube_pod_container_resource_limits{namespace=\"$namespace\", pod=~\"$pod\", resource=\"memory\", job=~\"$job\", cluster=\"$cluster\"}) by (container)",
"hide": false,
"legendFormat": "{{ container }} LIMITS",
"range": true,
Expand Down Expand Up @@ -1583,7 +1583,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=\"$namespace\", pod=~\"$pod\", image!=\"\", container!=\"\", cluster=\"$cluster\"}[$__rate_interval])) by (container)",
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=\"$namespace\", pod=~\"$pod\", image=\"\", container!=\"\", cluster=\"$cluster\"}[$__rate_interval])) by (container)",
"interval": "$resolution",
"legendFormat": "{{ container }}",
"range": true,
Expand Down Expand Up @@ -1690,7 +1690,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\", pod=~\"$pod\", image!=\"\", container!=\"\", cluster=\"$cluster\"}) by (container)",
"expr": "sum(container_memory_working_set_bytes{namespace=\"$namespace\", pod=~\"$pod\", image=\"\", container!=\"\", cluster=\"$cluster\"}) by (container)",
"interval": "",
"legendFormat": "{{ container }}",
"range": true,
Expand Down Expand Up @@ -1800,7 +1800,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(rate(container_cpu_cfs_throttled_seconds_total{namespace=~\"$namespace\", pod=~\"$pod\", image!=\"\", container!=\"\", cluster=\"$cluster\"}[$__rate_interval])) by (container)",
"expr": "sum(rate(container_cpu_cfs_throttled_seconds_total{namespace=~\"$namespace\", pod=~\"$pod\", image=\"\", container!=\"\", cluster=\"$cluster\"}[$__rate_interval])) by (container)",
"interval": "$resolution",
"legendFormat": "{{ container }}",
"range": true,
Expand Down Expand Up @@ -2712,6 +2712,6 @@
"timezone": "",
"title": "Kubernetes / Views / Pods",
"uid": "k8s_views_pods",
"version": 30,
"version": 31,
"weekStart": ""
}

0 comments on commit 6a5ef77

Please sign in to comment.