Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-20 11:43:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-20 11:43:02 +0300
commitd9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch)
tree2341ef426af70ad1e289c38036737e04b0aa5007 /lib/gitlab/grape_logging
parentd6e514dd13db8947884cd58fe2a9c2a063400a9b (diff)
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'lib/gitlab/grape_logging')
-rw-r--r--lib/gitlab/grape_logging/loggers/context_logger.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/gitlab/grape_logging/loggers/context_logger.rb b/lib/gitlab/grape_logging/loggers/context_logger.rb
index 468a296886e..1da96fdfdff 100644
--- a/lib/gitlab/grape_logging/loggers/context_logger.rb
+++ b/lib/gitlab/grape_logging/loggers/context_logger.rb
@@ -1,11 +1,18 @@
# frozen_string_literal: true
-# This module adds additional correlation id the grape logger
+# This class adds application context to the grape logger
module Gitlab
module GrapeLogging
module Loggers
class ContextLogger < ::GrapeLogging::Loggers::Base
- def parameters(_, _)
+ def parameters(request, _)
+ # Add remote_ip if this request wasn't already handled. If we
+ # add it unconditionally we can break client_id due to the way
+ # the context inherits the user.
+ unless Gitlab::ApplicationContext.current_context_include?(:remote_ip)
+ Gitlab::ApplicationContext.push(remote_ip: request.ip)
+ end
+
Gitlab::ApplicationContext.current
end
end