Skip to content

Add metrics for runner authentication success/failure

What does this MR do and why?

Describe in detail what your merge request does and why.

This allows site administrators to monitor how frequently runners are being authenticated, as well as how frequently authentication is failing.

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

image image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

gitlab=https://gitlab.example.com
registration_token=abc123
runner_token=

# Verify gitlab_ci_runner_authentication_success_total
curl -s $gitlab/-/metrics | grep gitlab_ci_runner_authentication_success_total
if [ -z "$runner_token" ]; then
  runner_token=$(curl -s --request POST --form "token=$registration_token" $gitlab/api/v4/runners | jq -r .token)
fi
curl -s --request POST --form "token=$runner_token" $gitlab/api/v4/runners/verify
curl -s $gitlab/-/metrics | grep gitlab_ci_runner_authentication_success_total

# Verify gitlab_ci_runner_authentication_failure_total
curl -s $gitlab/-/metrics | grep gitlab_ci_runner_authentication_failure_total
curl -s --request POST --form "token=invalid" $gitlab/api/v4/runners/verify
curl -s $gitlab/-/metrics | grep gitlab_ci_runner_authentication_failure_total

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Kyle Edwards

Merge request reports