diff options
author | Andrew Newdigate <andrew@gitlab.com> | 2017-09-19 10:55:37 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-09-19 10:55:37 +0000 |
commit | 64d7ec0a9e3ffd6233ccfbe9100f8a9391c648e5 (patch) | |
tree | 2cc89bc2d1087eb145918c6ae8cbf70878d40e97 /config | |
parent | 39dd7736585d3e35d5c6f391e6a94c312da09056 (diff) | |
download | gitlab-ce-64d7ec0a9e3ffd6233ccfbe9100f8a9391c648e5.tar.gz |
Detect n+1 issues involving Gitaly
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/lograge.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/config/initializers/lograge.rb b/config/initializers/lograge.rb index 21fe8d72459..8560d24526f 100644 --- a/config/initializers/lograge.rb +++ b/config/initializers/lograge.rb @@ -12,13 +12,18 @@ unless Sidekiq.server? config.lograge.logger = ActiveSupport::Logger.new(filename) # Add request parameters to log output config.lograge.custom_options = lambda do |event| - { + payload = { time: event.time.utc.iso8601(3), params: event.payload[:params].except(*%w(controller action format)), remote_ip: event.payload[:remote_ip], user_id: event.payload[:user_id], username: event.payload[:username] } + + gitaly_calls = Gitlab::GitalyClient.get_request_count + payload[:gitaly_calls] = gitaly_calls if gitaly_calls > 0 + + payload end end end |