Commit 8e742e10 authored by Igor Wiedler's avatar Igor Wiedler

Propagate remote_ip through ApplicationContext for API requests

parent f20ee83e
......@@ -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