Skip to content

Commit d562321

Browse files
author
Ankit Patel
committed
change metric to only emit when pod is actually ready
1 parent 6ce27bf commit d562321

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

internal/store/pod.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ func createPodStatusReadyTimeFamilyGenerator() generator.FamilyGenerator {
12881288
ms := []*metric.Metric{}
12891289

12901290
for _, c := range p.Status.Conditions {
1291-
if c.Type == v1.PodReady {
1291+
if c.Type == v1.PodReady && c.Status == v1.ConditionTrue {
12921292
ms = append(ms, &metric.Metric{
12931293
LabelKeys: []string{},
12941294
LabelValues: []string{},

internal/store/pod_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,6 @@ func TestPodStore(t *testing.T) {
14091409
# HELP kube_pod_status_ready_time Readiness achieved time in unix timestamp for a pod.
14101410
# TYPE kube_pod_status_ready gauge
14111411
# TYPE kube_pod_status_ready_time gauge
1412-
kube_pod_status_ready_time{namespace="ns2",pod="pod2",uid="uid2"} 1.501666018e+09
14131412
kube_pod_status_ready{condition="false",namespace="ns2",pod="pod2",uid="uid2"} 1
14141413
kube_pod_status_ready{condition="true",namespace="ns2",pod="pod2",uid="uid2"} 0
14151414
kube_pod_status_ready{condition="unknown",namespace="ns2",pod="pod2",uid="uid2"} 0

0 commit comments

Comments
 (0)