Commit af111c5a authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'gitaly-client-identity-3' into 'master'

Propagate remote_ip through ApplicationContext for API requests

See merge request gitlab-org/gitlab!50838
parents e7082e89 8e742e10
......@@ -59,6 +59,7 @@ module API
project: -> { @project },
namespace: -> { @group },
caller_id: route.origin,
remote_ip: request.ip,
feature_category: feature_category
)
end
......
......@@ -16,6 +16,7 @@ module API
user: -> { actor&.user },
project: -> { project },
caller_id: route.origin,
remote_ip: request.ip,
feature_category: feature_category
)
end
......
......@@ -102,6 +102,7 @@ RSpec.describe API::API do
Labkit::Context.current.to_h.tap do |log_context|
expect(log_context).to match('correlation_id' => an_instance_of(String),
'meta.caller_id' => '/api/:version/projects/:id/issues',
'meta.remote_ip' => an_instance_of(String),
'meta.project' => project.full_path,
'meta.root_namespace' => project.namespace.full_path,
'meta.user' => user.username,
......@@ -117,6 +118,7 @@ RSpec.describe API::API do
Labkit::Context.current.to_h.tap do |log_context|
expect(log_context).to match('correlation_id' => an_instance_of(String),
'meta.caller_id' => '/api/:version/users',
'meta.remote_ip' => an_instance_of(String),
'meta.feature_category' => 'users')
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