Fix job execution duration when runner assign time is not set (#4472)

This commit is contained in:
Nikola Jokic 2026-05-11 15:57:43 +02:00 committed by GitHub
parent 081b9ce1ee
commit e7b6482761
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 3 deletions

View File

@ -493,11 +493,13 @@ func (e *exporter) RecordJobStarted(msg *scaleset.JobStarted) {
}
func (e *exporter) RecordJobCompleted(msg *scaleset.JobCompleted) {
if msg.RunnerAssignTime.IsZero() {
return
}
l := e.completedJobLabels(msg)
e.incCounter(MetricCompletedJobsTotal, l)
executionDuration := msg.FinishTime.Unix() - msg.RunnerAssignTime.Unix()
e.observeHistogram(MetricJobExecutionDurationSeconds, l, float64(executionDuration))
e.observeHistogram(MetricJobExecutionDurationSeconds, l, float64(msg.FinishTime.Unix()-msg.RunnerAssignTime.Unix()))
}
func (e *exporter) RecordDesiredRunners(count int) {