summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-08-02 23:40:32 -0700
committerStan Hu <stanhu@gmail.com>2019-08-02 23:48:14 -0700
commita43c84e6ab34056262cc6b831afa01043936b343 (patch)
tree5eb166d706b0cb09ed94f3d3996755891f0fdc6d
parentbce8b66d516e906f6131d8a6dcae797def5288b6 (diff)
downloadgitlab-ce-a43c84e6ab34056262cc6b831afa01043936b343.tar.gz
Only track Redis calls if Peek is enabledsh-disable-redis-peek
In dev environments, Sidekiq was encountering the message: Circular dependency detected while autoloading constant Gitlab::Profiler This saves some overhead during normal usage.
-rw-r--r--changelogs/unreleased/sh-disable-redis-peek.yml5
-rw-r--r--lib/peek/views/redis_detailed.rb5
2 files changed, 10 insertions, 0 deletions
diff --git a/changelogs/unreleased/sh-disable-redis-peek.yml b/changelogs/unreleased/sh-disable-redis-peek.yml
new file mode 100644
index 00000000000..de86c0031c7
--- /dev/null
+++ b/changelogs/unreleased/sh-disable-redis-peek.yml
@@ -0,0 +1,5 @@
+---
+title: Only track Redis calls if Peek is enabled
+merge_request: 31438
+author:
+type: performance
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