diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /lib/gitlab/grape_logging | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
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 |