Add metric job_pod_finished

To count the number of pods that the job controller successfully tracked with the JobTrackingWithFinalizers feature gate.
This commit is contained in:
Aldo Culquicondor
2021-09-02 14:28:28 -04:00
parent 7d9cb88fed
commit a0e7a567c5
4 changed files with 74 additions and 9 deletions

View File

@@ -68,10 +68,26 @@ var (
},
[]string{"completion_mode", "result"},
)
// JobPodsFinished records the number of finished Pods that the job controller
// finished tracking.
// It only applies to Jobs that were created while the feature gate
// JobTrackingWithFinalizers was enabled.
// Possible label values:
// completion_mode: Indexed, NonIndexed
// result: failed, succeeded
JobPodsFinished = metrics.NewCounterVec(
&metrics.CounterOpts{
Subsystem: JobControllerSubsystem,
Name: "job_pods_finished_total",
Help: "The number of finished Pods that are fully tracked",
},
[]string{"completion_mode", "result"})
)
// Possible values for the "action" label in the above metrics.
const (
// Possible values for the "action" label in the above metrics.
// JobSyncActionReconciling when the Job's pod creation/deletion expectations
// are unsatisfied and the controller is waiting for issued Pod
// creation/deletions to complete.
@@ -88,6 +104,11 @@ const (
// if a Job is suspended or if the number of active Pods is more than
// parallelism.
JobSyncActionPodsDeleted = "pods_deleted"
// Possible values for "result" label in the above metrics.
Succeeded = "succeeded"
Failed = "failed"
)
var registerMetrics sync.Once
@@ -98,5 +119,6 @@ func Register() {
legacyregistry.MustRegister(JobSyncDurationSeconds)
legacyregistry.MustRegister(JobSyncNum)
legacyregistry.MustRegister(JobFinishedNum)
legacyregistry.MustRegister(JobPodsFinished)
})
}