Commit ce159014 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'ak/queue_metric' into 'master'

Add gauge metric on ci queue size

See merge request gitlab-org/gitlab!67420
parents b648ead0 d86702b9
......@@ -97,7 +97,9 @@ module Gitlab
def observe_queue_size(size_proc, runner_type)
return unless Feature.enabled?(:gitlab_ci_builds_queuing_metrics, default_enabled: false)
self.class.queue_size_total.observe({ runner_type: runner_type }, size_proc.call.to_f)
size = size_proc.call.to_f
self.class.queue_size_total.observe({ runner_type: runner_type }, size)
self.class.current_queue_size.set({ runner_type: runner_type }, size)
end
def observe_queue_time(metric, runner_type)
......@@ -199,6 +201,15 @@ module Gitlab
end
end
def self.current_queue_size
strong_memoize(:current_queue_size) do
name = :gitlab_ci_current_queue_size
comment = 'Current size of initialized CI/CD builds queue'
Gitlab::Metrics.gauge(name, comment)
end
end
def self.queue_iteration_duration_seconds
strong_memoize(:queue_iteration_duration_seconds) do
name = :gitlab_ci_queue_iteration_duration_seconds
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment