diff options
author | Stan Hu <stanhu@gmail.com> | 2019-03-27 13:56:36 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-03-27 14:01:21 +0300 |
commit | 74ff33a3fdb83cd03c41436b4ae10ca48075f0e9 (patch) | |
tree | 6104d45c38d0588c7c938eb83b976235b0d4a1db /config/initializers/lograge.rb | |
parent | 0610bb091766d3bb935fc10898dd66bc6f76b1c5 (diff) |
Log Gitaly RPC duration to api_json.log and production_json.log
This makes it easier to debug Gitaly performance issues in the field.
This commit also makes the tracking of query time thread-safe via
RequestStore.
Diffstat (limited to 'config/initializers/lograge.rb')
-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 164954d1293..5e790a9eccb 100644 --- a/config/initializers/lograge.rb +++ b/config/initializers/lograge.rb @@ -28,7 +28,12 @@ unless Sidekiq.server? } gitaly_calls = Gitlab::GitalyClient.get_request_count - payload[:gitaly_calls] = gitaly_calls if gitaly_calls > 0 + + if gitaly_calls > 0 + payload[:gitaly_calls] = gitaly_calls + payload[:gitaly_duration] = Gitlab::GitalyClient.query_time_ms + end + payload[:response] = event.payload[:response] if event.payload[:response] payload[Gitlab::CorrelationId::LOG_KEY] = Gitlab::CorrelationId.current_id |