Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/peek
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-08-03 09:40:32 +0300
committerStan Hu <stanhu@gmail.com>2019-08-03 09:48:14 +0300
commita43c84e6ab34056262cc6b831afa01043936b343 (patch)
tree5eb166d706b0cb09ed94f3d3996755891f0fdc6d /lib/peek
parentbce8b66d516e906f6131d8a6dcae797def5288b6 (diff)
Only track Redis calls if Peek is enabled
In dev environments, Sidekiq was encountering the message: Circular dependency detected while autoloading constant Gitlab::Profiler This saves some overhead during normal usage.
Diffstat (limited to 'lib/peek')
-rw-r--r--lib/peek/views/redis_detailed.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/peek/views/redis_detailed.rb b/lib/peek/views/redis_detailed.rb
index b95307deddb..f36f581d5e9 100644
--- a/lib/peek/views/redis_detailed.rb
+++ b/lib/peek/views/redis_detailed.rb
@@ -16,6 +16,7 @@ module Gitlab
private
def add_call_details(duration, args)
+ return unless peek_enabled?
# redis-rb passes an array (e.g. [:get, key])
return unless args.length == 1
@@ -26,6 +27,10 @@ module Gitlab
}
end
+ def peek_enabled?
+ Gitlab::SafeRequestStore.store[:peek_enabled]
+ end
+
def detail_store
::Gitlab::SafeRequestStore['redis_call_details'] ||= []
end