Skip to content

Commit

Permalink
Merge pull request kubevirt#7372 from saschagrunert/fix-alert
Browse files Browse the repository at this point in the history
Fix `KubeVirtComponentExceedsRequestedMemory` alert on duplicate series
  • Loading branch information
kubevirt-bot authored Mar 30, 2022
2 parents 28a4fff + 8230c28 commit 9da7058
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions hack/prom-rule-ci/prom-rules-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tests:
# Pod is using more memory than expected
- interval: 1m
input_series:
- series: 'container_memory_usage_bytes{namespace="ci",container="virt-controller",pod="virt-controller-8546c99968-x9jgg",node="node1"}'
- series: 'container_memory_working_set_bytes{namespace="ci",container="",pod="virt-controller-8546c99968-x9jgg",node="node1"}'
values: "157286400 157286400 157286400 157286400 157286400 157286400 157286400 157286400"
- series: 'kube_pod_container_resource_requests{namespace="ci",container="virt-controller",resource="memory",pod="virt-controller-8546c99968-x9jgg",node="node1"}'
values: "118325248 118325248 118325248 118325248 118325248 118325248 118325248 118325248"
Expand Down Expand Up @@ -595,4 +595,4 @@ tests:
- labels: 'kubevirt_vmi_memory_used_bytes{container="virt-handler", name="vm-example-1", namespace="default", node="node-1"}'
value: 103706112
- labels: 'kubevirt_vmi_memory_used_bytes{container="virt-handler", name="vm-example-2", namespace="default", node="node-1"}'
value: 234329980
value: 234329980
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ func NewPrometheusRuleSpec(ns string, workloadUpdatesEnabled bool) *v1.Prometheu
},
{
Alert: "KubeVirtComponentExceedsRequestedMemory",
Expr: intstr.FromString(fmt.Sprintf(`((kube_pod_container_resource_requests{namespace="%s",container=~"virt-controller|virt-api|virt-handler|virt-operator",resource="memory"}) - on(pod) group_left(node) container_memory_usage_bytes{namespace="%s"}) < 0`, ns, ns)),
Expr: intstr.FromString(fmt.Sprintf(`((kube_pod_container_resource_requests{namespace="%s",container=~"virt-controller|virt-api|virt-handler|virt-operator",resource="memory"}) - on(pod) group_left(node) container_memory_working_set_bytes{container="",namespace="%s"}) < 0`, ns, ns)),
For: "5m",
Annotations: map[string]string{
"description": "Container {{ $labels.container }} in pod {{ $labels.pod }} memory usage exceeds the memory requested",
Expand Down

0 comments on commit 9da7058

Please sign in to comment.