diff options
author | Stan Hu <stanhu@gmail.com> | 2019-07-21 08:34:46 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-24 07:38:05 +0300 |
commit | 291df05e434f5678c47bce9521ff15748d6c767f (patch) | |
tree | a9ebe8e457d875b18998ac1a997c2faa0b1889f8 /lib/gitlab/rugged_instrumentation.rb | |
parent | 4482b82687e5b647459946338686eca0b53b7ce4 (diff) |
Add Rugged calls to performance bar
This will help diagnose the source of excessive I/O from Rugged
calls. To implement this, we need to obtain the full list of arguments
sent to each request method.
Diffstat (limited to 'lib/gitlab/rugged_instrumentation.rb')
-rw-r--r-- | lib/gitlab/rugged_instrumentation.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/gitlab/rugged_instrumentation.rb b/lib/gitlab/rugged_instrumentation.rb index 70c06e8b308..8bb8c547ae1 100644 --- a/lib/gitlab/rugged_instrumentation.rb +++ b/lib/gitlab/rugged_instrumentation.rb @@ -24,7 +24,24 @@ module Gitlab end def self.active? - Gitlab::SafeRequestStore.active? + SafeRequestStore.active? + end + + def self.peek_enabled? + SafeRequestStore[:peek_enabled] + end + + def self.add_call_details(details) + return unless peek_enabled? + + Gitlab::SafeRequestStore[:rugged_call_details] ||= [] + Gitlab::SafeRequestStore[:rugged_call_details] << details + end + + def self.list_call_details + return [] unless peek_enabled? + + Gitlab::SafeRequestStore[:rugged_call_details] || [] end end end |