From 311c6821c1ccd5a22211dc754b656dec0185089c Mon Sep 17 00:00:00 2001 From: cedric lamoriniere Date: Wed, 5 Feb 2020 21:24:02 +0100 Subject: [PATCH] update pod metrics docs after review Signed-off-by: cedric lamoriniere --- docs/pod-metrics.md | 8 ++++---- internal/store/pod_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/pod-metrics.md b/docs/pod-metrics.md index cce04d98..bc6eae33 100644 --- a/docs/pod-metrics.md +++ b/docs/pod-metrics.md @@ -44,17 +44,17 @@ ### How to retrieve none standard Pod state -It is not straightforward to get the Pod states for certain cases like "Terminating" and "Unknow" since it is not stored behind a field in the `Pod.status`. +It is not straightforward to get the Pod states for certain cases like "Terminating" and "Unknown" since it is not stored behind a field in the `Pod.Status`. -So to get them, you need to compose multiple metrics (like it is done in the `kubectl` command line). +So to get them, you will need to compose multiple metrics (like it is done in the `kubectl` command line code). For example: -* To get the list the Pods that are in an `Unknow` state you can to the following promQL query: `count(kube_pod_status_phase{phase="Running"}) by (namespace, pod) * count(kube_pod_status_reason{reason="NodeLost"}) by(namespace, pod)` +* To get the list of pods that are in the `Unknown` state, you can run the following promQL query: `count(kube_pod_status_phase{phase="Running"}) by (namespace, pod) * count(kube_pod_status_reason{reason="NodeLost"}) by(namespace, pod)` * For Pods in `Terminated` state: `count(kube_pod_status_phase{phase="Running"}) by (namespace, pod) * count(kube_pod_deleted) by (namespace, pod) * count(kube_pod_status_reason{reason!="NodeLost"})) by (namespace, pod)` -A useful "Rule" can be to be alerted when a Pod is blocked in `Terminated` state for more than `5m`. +Here is an example of a Prometheus rule that can be used to alert on a Pod that has been in the `Terminated` state for more than `5m`. ```yaml groups: diff --git a/internal/store/pod_test.go b/internal/store/pod_test.go index 79d0a755..e856cb6c 100644 --- a/internal/store/pod_test.go +++ b/internal/store/pod_test.go @@ -1605,7 +1605,7 @@ func BenchmarkPodStore(b *testing.B) { }, } - expectedFamilies := 41 + expectedFamilies := 37 for n := 0; n < b.N; n++ { families := f(pod) if len(families) != expectedFamilies {