Skip to content

Commit

Permalink
fix(k8s-views-namespaces): filter metrics to prevent reporting double…
Browse files Browse the repository at this point in the history
… cpu/memory

Most queries already use label matcher. The metric reports usage for each
individual image, and the whole pod which will result in incorrect reporting if
not filtered correctly.

Fixes: #60
  • Loading branch information
uhthomas authored and dotdc committed Jul 25, 2023
1 parent 92021d7 commit d95e46b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dashboards/k8s-views-namespaces.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
},
"editorMode": "code",
"exemplar": false,
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=~\"$namespace\", image!=\"\"}[$__rate_interval])) / sum(machine_cpu_cores)",
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=~\"$namespace\", image=\"\"}[$__rate_interval])) / sum(machine_cpu_cores)",
"instant": true,
"interval": "",
"legendFormat": "",
Expand Down Expand Up @@ -214,7 +214,7 @@
"uid": "${datasource}"
},
"exemplar": true,
"expr": "sum(container_memory_working_set_bytes{namespace=~\"$namespace\"}) / sum(machine_memory_bytes)",
"expr": "sum(container_memory_working_set_bytes{namespace=~\"$namespace\", image=\"\"}) / sum(machine_memory_bytes)",
"interval": "",
"legendFormat": "",
"refId": "A"
Expand Down Expand Up @@ -475,7 +475,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=~\"$namespace\"}[$__rate_interval]))",
"expr": "sum(rate(container_cpu_usage_seconds_total{namespace=~\"$namespace\", image=\"\"}[$__rate_interval]))",
"interval": "",
"legendFormat": "Real",
"range": true,
Expand Down Expand Up @@ -574,7 +574,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(container_memory_working_set_bytes{namespace=~\"$namespace\"})",
"expr": "sum(container_memory_working_set_bytes{namespace=~\"$namespace\", image=\"\"})",
"interval": "",
"legendFormat": "Real",
"range": true,
Expand Down

0 comments on commit d95e46b

Please sign in to comment.