Fix job execution duration when runner assign time is not set (#4472)
This commit is contained in:
parent
081b9ce1ee
commit
e7b6482761
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue