Commit a43c84e6 authored by Stan Hu's avatar Stan Hu

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.
parent bce8b66d
---
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment