diff options
Diffstat (limited to 'lib/gitlab/grape_logging')
-rw-r--r-- | lib/gitlab/grape_logging/loggers/queue_duration_logger.rb | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/gitlab/grape_logging/loggers/queue_duration_logger.rb b/lib/gitlab/grape_logging/loggers/queue_duration_logger.rb index fe741a5bbe8..dde2bdd855e 100644 --- a/lib/gitlab/grape_logging/loggers/queue_duration_logger.rb +++ b/lib/gitlab/grape_logging/loggers/queue_duration_logger.rb @@ -6,21 +6,12 @@ module Gitlab module GrapeLogging module Loggers class QueueDurationLogger < ::GrapeLogging::Loggers::Base - attr_accessor :start_time - - def before - @start_time = Time.now - end - def parameters(request, _) - proxy_start = request.env['HTTP_GITLAB_WORKHORSE_PROXY_START'].presence - - return {} unless proxy_start && start_time + duration_s = request.env[Gitlab::Middleware::RailsQueueDuration::GITLAB_RAILS_QUEUE_DURATION_KEY].presence - # Time in milliseconds since gitlab-workhorse started the request - duration = start_time.to_f * 1_000 - proxy_start.to_f / 1_000_000 + return {} unless duration_s - { 'queue_duration_s': Gitlab::Utils.ms_to_round_sec(duration) } + { 'queue_duration_s': duration_s } end end end |