I had similar problem. I found no straightforward solution, bur eventually I solved it with a workaround.
The problem is that kube_job_status_succeeded
will always present number of rows equal to .spec.successfulJobsHistoryLimit
(if some jobs in the past have succeded) with value of 1, and number of rows equal to .spec.failedJobsHistoryLimit
(if some jobs in the past have failed) with value of 0. Moreover, kube_job_status_succeeded
does not tell you when the job was performed.
In other words, kube_job_status_succeeded
just store .spec.successfulJobsHistoryLimit
(default: 3) of most recent succesful jobs and .spec.failedJobsHistoryLimit
(default: 1) of most recent failed jobs
My workaround is based on joining data from kube_job_status_succeeded and kube_job_created. In this way, I take most recent timestamp of successful job. Then I deduct it from current timestamp. In result I get a info how long ago last successful job execution took a place.
time() - max(kube_job_status_succeeded{namespace="my_namespace",job_name=~"job_name.*"} * on (job_name) kube_job_created{namespace="my_namespace",job_name=~"job_name.*"})
In Grafana it looks like this:
Maybe this is not direct answer to your question, but I believe that this might be a good starting point to achieve your goal. In Grafana you can do some data mapping to present time diff calculated in the query as one big "success"/"failed" label, depending on your neads