Canceled jobs are counted in gitlab_runner_failed_jobs_total as "unknown_failure"

Summary

Canceled jobs are counted in the prometheus metric gitlab_runner_failed_jobs_total which is unexpected since a canceled jobs isn't really a failed job and does not have status=failed.

Steps to reproduce

  1. Enable prometheus metrics endpoint in the gitlab-runner
  2. Trigger a job
  3. Cancel the job before it completes.

Actual behavior

The metric gitlab_runner_failed_jobs_total{failure_reason="unknown_failure"} is incremented.

Expected behavior

The metric gitlab_runner_failed_jobs_total{failure_reason="unknown_failure"} is not incremented.

OR

documentation is updated regarding this metric and canceled jobs.

Relevant logs and/or screenshots

N/A

Environment description

N/A

Used GitLab Runner version

15.11.0

Possible fixes