-
Notifications
You must be signed in to change notification settings - Fork 628
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
Rule "KubeStatefulSetUpdateNotRolledOut" in Group "kubernetes-apps" will never throw an alert if the statfulset metrics has any other labels apart from "namespace", "statefulset", "job" and any custom clusterLabel"
This is because the "max by" in the beggining of query drops all other labels, and the subsequent multiply and 'and' operator does not have an "on" clause, so the labels are mismatched.
Please provide any helpful snippets.
Current state:
{
expr: |||
(
max by(namespace, statefulset, job, %(clusterLabel)s) (
kube_statefulset_status_current_revision{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s}
unless
kube_statefulset_status_update_revision{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s}
)
*
(
kube_statefulset_replicas{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s}
!=
kube_statefulset_status_replicas_updated{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s}
)
) and (
changes(kube_statefulset_status_replicas_updated{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s}[5m])
==
0
)
||| % $._config,
...
alert: 'KubeStatefulSetUpdateNotRolledOut',
},My proposal:
{
expr: |||
(
max by(namespace, statefulset, job, %(clusterLabel)s) (
kube_statefulset_status_current_revision{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s}
unless
kube_statefulset_status_update_revision{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s}
)
* on(namespace, statefulset, job, %(clusterLabel)s)
(
kube_statefulset_replicas{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s}
!=
kube_statefulset_status_replicas_updated{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s}
)
) and on(namespace, statefulset, job, %(clusterLabel)s) (
changes(kube_statefulset_status_replicas_updated{%(prefixedNamespaceSelector)s%(kubeStateMetricsSelector)s}[5m])
==
0
)
||| % $._config,
...
alert: 'KubeStatefulSetUpdateNotRolledOut',
},What parts of the codebase are affected?
Alerts
I agree to the following terms:
- I agree to follow this project's Code of Conduct.
- I have filled out all the required information above to the best of my ability.
- I have searched the issues of this repository and believe that this is not a duplicate.
- I have confirmed this bug exists in the default branch of the repository, as of the latest commit at the time of submission.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working