summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/queue/metrics.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 13:18:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 13:18:24 +0000
commit0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch)
tree4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /lib/gitlab/ci/queue/metrics.rb
parent744144d28e3e7fddc117924fef88de5d9674fe4c (diff)
downloadgitlab-ce-0653e08efd039a5905f3fa4f6e9cef9f5d2f799c.tar.gz
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'lib/gitlab/ci/queue/metrics.rb')
-rw-r--r--lib/gitlab/ci/queue/metrics.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/gitlab/ci/queue/metrics.rb b/lib/gitlab/ci/queue/metrics.rb
index 859aeb35f26..7f45d626922 100644
--- a/lib/gitlab/ci/queue/metrics.rb
+++ b/lib/gitlab/ci/queue/metrics.rb
@@ -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