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.
This commit is contained in:
parent
bce8b66d51
commit
a43c84e6ab
2 changed files with 10 additions and 0 deletions
5
changelogs/unreleased/sh-disable-redis-peek.yml
Normal file
5
changelogs/unreleased/sh-disable-redis-peek.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Only track Redis calls if Peek is enabled
|
||||
merge_request: 31438
|
||||
author:
|
||||
type: performance
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue