Commit ea5eb482 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add runner type label to queue retrieval duration histogram

This commit adds a runner_type label to the Prometheus histogram we use
to record the time it takes to retrieve a builds queue from the
database.

We also add this label to the histogram we use to track duration of the
entire process of processing a queue for a given runner.
parent bbe3dfc3
...@@ -24,7 +24,7 @@ module Ci ...@@ -24,7 +24,7 @@ module Ci
def execute(params = {}) def execute(params = {})
@metrics.increment_queue_operation(:queue_attempt) @metrics.increment_queue_operation(:queue_attempt)
@metrics.observe_queue_time(:process) do @metrics.observe_queue_time(:process, @runner.runner_type) do
process_queue(params) process_queue(params)
end end
end end
...@@ -128,7 +128,7 @@ module Ci ...@@ -128,7 +128,7 @@ module Ci
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
def retrieve_queue(queue_query_proc) def retrieve_queue(queue_query_proc)
@metrics.observe_queue_time(:retrieve) do @metrics.observe_queue_time(:retrieve, @runner.runner_type) do
queue_query_proc.call queue_query_proc.call
end end
end end
......
...@@ -100,7 +100,7 @@ module Gitlab ...@@ -100,7 +100,7 @@ module Gitlab
self.class.queue_size_total.observe({ runner_type: runner_type }, size_proc.call.to_f) self.class.queue_size_total.observe({ runner_type: runner_type }, size_proc.call.to_f)
end end
def observe_queue_time(metric) def observe_queue_time(metric, runner_type)
start_time = ::Gitlab::Metrics::System.monotonic_time start_time = ::Gitlab::Metrics::System.monotonic_time
result = yield result = yield
...@@ -111,9 +111,9 @@ module Gitlab ...@@ -111,9 +111,9 @@ module Gitlab
case metric case metric
when :process when :process
self.class.queue_iteration_duration_seconds.observe({}, seconds.to_f) self.class.queue_iteration_duration_seconds.observe({ runner_type: runner_type }, seconds.to_f)
when :retrieve when :retrieve
self.class.queue_retrieval_duration_seconds.observe({}, seconds.to_f) self.class.queue_retrieval_duration_seconds.observe({ runner_type: runner_type }, seconds.to_f)
else else
raise ArgumentError unless Rails.env.production? raise ArgumentError unless Rails.env.production?
end end
......
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