diff options
author | Stan Hu <stanhu@gmail.com> | 2019-08-09 07:33:20 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-08-09 11:08:32 +0300 |
commit | a74396dcc5e372c0b6a23fd47db22ebbeb8386d7 (patch) | |
tree | 20492308e8d7acd6658fc3c80a6e98fedbd79be1 /config | |
parent | bbf639c43d689bd63a32ef7a60bdf83d3bd329bf (diff) |
Add Gitaly and Rugged call timing in Sidekiq logs
This will help identify Sidekiq jobs that invoke excessive number of
filesystem access.
The timing data is stored in `RequestStore`, but this is only active
within the middleware and is not directly accessible to the Sidekiq
logger. However, it is possible for the middleware to modify the job
hash to pass this data along to the logger.
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/lograge.rb | 14 | ||||
-rw-r--r-- | config/initializers/sidekiq.rb | 1 |
2 files changed, 2 insertions, 13 deletions
diff --git a/config/initializers/lograge.rb b/config/initializers/lograge.rb index 3d84b4e44ce..346725e4080 100644 --- a/config/initializers/lograge.rb +++ b/config/initializers/lograge.rb @@ -27,19 +27,7 @@ unless Sidekiq.server? queue_duration: event.payload[:queue_duration] } - gitaly_calls = Gitlab::GitalyClient.get_request_count - - if gitaly_calls > 0 - payload[:gitaly_calls] = gitaly_calls - payload[:gitaly_duration] = Gitlab::GitalyClient.query_time_ms - end - - rugged_calls = Gitlab::RuggedInstrumentation.query_count - - if rugged_calls > 0 - payload[:rugged_calls] = rugged_calls - payload[:rugged_duration_ms] = Gitlab::RuggedInstrumentation.query_time_ms - end + ::Gitlab::InstrumentationHelper.add_instrumentation_data(payload) payload[:response] = event.payload[:response] if event.payload[:response] payload[Labkit::Correlation::CorrelationId::LOG_KEY] = Labkit::Correlation::CorrelationId.current_id diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index 9f88fb9895b..7217f098fd9 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -39,6 +39,7 @@ Sidekiq.configure_server do |config| chain.add Gitlab::SidekiqMiddleware::RequestStoreMiddleware unless ENV['SIDEKIQ_REQUEST_STORE'] == '0' chain.add Gitlab::SidekiqMiddleware::BatchLoader chain.add Gitlab::SidekiqMiddleware::CorrelationLogger + chain.add Gitlab::SidekiqMiddleware::InstrumentationLogger chain.add Gitlab::SidekiqStatus::ServerMiddleware end |