Commit d86702b9 authored by Adrien Kohlbecker's avatar Adrien Kohlbecker

Add gauge metric on ci queue size

Changelog: added
parent 3a8dd9a1
......@@ -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