kube-state-metrics icon indicating copy to clipboard operation
kube-state-metrics copied to clipboard

`kube_job_failed` should have `reason` label

Open keisku opened this issue 9 months ago • 1 comments

What would you like to be added:

Add reason label here other than condition.

https://github.com/kubernetes/kube-state-metrics/blob/9e6e70d328c5d750a0df84cc044c38124b271538/internal/store/job.go#L292-L316

Why is this needed:

Enable to monitor why a job fails.

Describe the solution you'd like

-- 					metric.LabelKeys = []string{"condition"}
++ 					metric.LabelKeys = []string{"condition", "reason"}

Additional context

I would like to know why the current implementation doesn't allow adding reason label. Any concerns?

keisku avatar Apr 29 '24 02:04 keisku

I would like to know why the current implementation doesn't allow adding reason label. Any concerns?

I don't know, but wouldn't using kube_job_status_failed instead of kube_job_failed solve your issue?

ricardoapl avatar Apr 30 '24 16:04 ricardoapl

/triage accepted /assign @CatherineF-dev

logicalhan avatar May 02 '24 16:05 logicalhan

Yes, kube_job_status_failed has reason. https://github.com/kubernetes/kube-state-metrics/blob/9e6e70d328c5d750a0df84cc044c38124b271538/internal/store/job_test.go#L207

CatherineF-dev avatar May 02 '24 16:05 CatherineF-dev

/close

CatherineF-dev avatar May 02 '24 16:05 CatherineF-dev

@CatherineF-dev: Closing this issue.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar May 02 '24 16:05 k8s-ci-robot