Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/ci/helpers/runner.rb')
-rw-r--r--lib/api/ci/helpers/runner.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/api/ci/helpers/runner.rb b/lib/api/ci/helpers/runner.rb
index 72e36d95dc5..fe49074afed 100644
--- a/lib/api/ci/helpers/runner.rb
+++ b/lib/api/ci/helpers/runner.rb
@@ -12,6 +12,7 @@ module API
JOB_TOKEN_PARAM = :token
def authenticate_runner!
+ track_runner_authentication
forbidden! unless current_runner
current_runner
@@ -42,6 +43,14 @@ module API
end
end
+ def track_runner_authentication
+ if current_runner
+ metrics.increment_runner_authentication_success_counter(runner_type: current_runner.runner_type)
+ else
+ metrics.increment_runner_authentication_failure_counter
+ end
+ end
+
# HTTP status codes to terminate the job on GitLab Runner:
# - 403
def authenticate_job!(require_running: true, heartbeat_runner: false)
@@ -149,6 +158,10 @@ module API
def request_using_running_job_token?
current_job.present? && current_authenticated_job.present? && current_job != current_authenticated_job
end
+
+ def metrics
+ strong_memoize(:metrics) { ::Gitlab::Ci::Runner::Metrics.new }
+ end
end
end
end