Skip to content

Commit 3d4a542

Browse files
authored
Merge pull request #180 from metalmatze/cpu-request-running
Count overcommit CPU only for pods in Pending or Running status
2 parents 96f09fe + cfd29a3 commit 3d4a542

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rules/rules.libsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
record: 'namespace_name:kube_pod_container_resource_requests_cpu_cores:sum',
6262
expr: |||
6363
sum by (namespace, label_name) (
64-
sum(kube_pod_container_resource_requests_cpu_cores{%(kubeStateMetricsSelector)s} and on(pod) kube_pod_status_scheduled{condition="true"}) by (namespace, pod)
64+
sum(kube_pod_container_resource_requests_cpu_cores{%(kubeStateMetricsSelector)s} * on (endpoint, instance, job, namespace, pod, service) group_left(phase) (kube_pod_status_phase{phase=~"^(Pending|Running)$"} == 1)) by (namespace, pod)
6565
* on (namespace, pod) group_left(label_name)
6666
label_replace(kube_pod_labels{%(kubeStateMetricsSelector)s}, "pod_name", "$1", "pod", "(.*)")
6767
)

0 commit comments

Comments
 (0)