diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 21:07:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 21:07:55 +0300 |
commit | 603c7d4cac5e28bc1c75e50c23ed2cbe56f1aafc (patch) | |
tree | 907f5b8ee1b6f5aad396e95e3327a08400b9e8ea /lib/peek | |
parent | 120f4aaedc8fe830a3f572491d240d8ee6addefb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/peek')
-rw-r--r-- | lib/peek/views/detailed_view.rb | 2 | ||||
-rw-r--r-- | lib/peek/views/redis_detailed.rb | 38 |
2 files changed, 1 insertions, 39 deletions
diff --git a/lib/peek/views/detailed_view.rb b/lib/peek/views/detailed_view.rb index 4f3eddaf11b..389f5301079 100644 --- a/lib/peek/views/detailed_view.rb +++ b/lib/peek/views/detailed_view.rb @@ -17,7 +17,7 @@ module Peek end def detail_store - ::Gitlab::SafeRequestStore["#{key}_call_details"] ||= [] + ::Gitlab::SafeRequestStore["#{key}_call_details".to_sym] ||= [] end private diff --git a/lib/peek/views/redis_detailed.rb b/lib/peek/views/redis_detailed.rb index 14cabd62025..79845044d75 100644 --- a/lib/peek/views/redis_detailed.rb +++ b/lib/peek/views/redis_detailed.rb @@ -1,39 +1,5 @@ # frozen_string_literal: true -require 'redis' - -module Gitlab - module Peek - module RedisInstrumented - def call(*args, &block) - start = Time.now - super(*args, &block) - ensure - duration = (Time.now - start) - add_call_details(duration, args) - end - - private - - def add_call_details(duration, args) - return unless Gitlab::PerformanceBar.enabled_for_request? - # redis-rb passes an array (e.g. [:get, key]) - return unless args.length == 1 - - detail_store << { - cmd: args.first, - duration: duration, - backtrace: ::Gitlab::BacktraceCleaner.clean_backtrace(caller) - } - end - - def detail_store - ::Gitlab::SafeRequestStore['redis_call_details'] ||= [] - end - end - end -end - module Peek module Views class RedisDetailed < DetailedView @@ -63,7 +29,3 @@ module Peek end end end - -class Redis::Client - prepend Gitlab::Peek::RedisInstrumented -end |