metrics: add worker error metrics

This commit introduces the collection of error
metrics since it is now possible to differentiate
between internal errors and user input errors.
Additionally, the error status is reported for
job duration metrics.
This commit is contained in:
Gianluca Zuccarelli 2022-01-31 11:21:19 +00:00 committed by Tom Gundersen
parent 6c4caec022
commit 290472dfdf
3 changed files with 50 additions and 4 deletions

View file

@ -486,7 +486,8 @@ func (s *Server) FinishJob(token uuid.UUID, result json.RawMessage) error {
if err != nil {
logrus.Errorf("error finding job status: %v", err)
} else {
prometheus.FinishJobMetrics(status.Started, status.Finished, status.Canceled, jobType)
statusCode := clienterrors.GetStatusCode(jobResult.JobError)
prometheus.FinishJobMetrics(status.Started, status.Finished, status.Canceled, jobType, statusCode)
}
// Move artifacts from the temporary location to the final job