Skip to content

Fix labeling of the gitlab_runner_failed_jobs_total metric

Tomasz Maczukin requested to merge fix-failure-reason-metrics into main

What does this MR do?

Fix labeling of the gitlab_runner_failed_jobs_total metric

While working on !4098 (merged) we've refactored the way how failure reason setting is handled. When doing that we've missed a specific case when failure reason would be empty (some cases for script_failure failures and cases that are related to job execution and for which Runner doesn't yet recognize specific failure reason).

Previously that would be automatically translated to script_failure for both the reason reported back to GitLab and the reason tracked by metrics.

After the change this check was still executed when preparing the reason that should be reported back to GitLab (where we need to do few more checks) but was missed for the metric collection.

This commit will fix that.

This closes #36929 (closed)

Why was this MR needed?

What's the best way to test this MR?

What are the relevant issue numbers?

Merge request reports