Skip to content

Commit 2990fd5

Browse files
Ignore casing while scraping failure reason for kube_job_status_failed
1 parent e3d99ba commit 2990fd5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/store/job.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package store
1919
import (
2020
"context"
2121
"strconv"
22+
"strings"
2223

2324
basemetrics "k8s.io/component-base/metrics"
2425

@@ -39,7 +40,7 @@ var (
3940
descJobLabelsName = "kube_job_labels"
4041
descJobLabelsHelp = "Kubernetes labels converted to Prometheus labels."
4142
descJobLabelsDefaultLabels = []string{"namespace", "job_name"}
42-
jobFailureReasons = []string{"BackoffLimitExceeded", "DeadLineExceeded", "Evicted"}
43+
jobFailureReasons = []string{"BackoffLimitExceeded", "DeadlineExceeded", "Evicted"}
4344
)
4445

4546
func jobMetricFamilies(allowAnnotationsList, allowLabelsList []string) []generator.FamilyGenerator {
@@ -429,5 +430,5 @@ func failureReason(jc *v1batch.JobCondition, reason string) bool {
429430
if jc == nil {
430431
return false
431432
}
432-
return jc.Reason == reason
433+
return strings.EqualFold(jc.Reason, reason)
433434
}

0 commit comments

Comments
 (0)