summaryrefslogtreecommitdiff
path: root/lib/peek/views/redis_detailed.rb
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2019-07-26 14:03:00 +0100
committerSean McGivern <sean@gitlab.com>2019-07-26 14:37:26 +0100
commitad1c71663f7780838c7c90979419f3e3cf5ec580 (patch)
tree59443b9ea0f860511610acf181e1eadbc8c88d34 /lib/peek/views/redis_detailed.rb
parent55f99e930e1c147ec191a234ff4881ea7e70ea61 (diff)
downloadgitlab-ce-remove-peek-pg.tar.gz
Replace peek-pg with our own implementationremove-peek-pg
This uses an ActiveRecord subscriber to get queries and calculate the total query time from that. This means that the total will always be consistent with the queries in the table. It does however mean that we could potentially miss some queries that don't go through ActiveRecord. Making this change also allows us to unify the response JSON a little bit, making the frontend slightly simpler as a result.
Diffstat (limited to 'lib/peek/views/redis_detailed.rb')
-rw-r--r--lib/peek/views/redis_detailed.rb19
1 files changed, 1 insertions, 18 deletions
diff --git a/lib/peek/views/redis_detailed.rb b/lib/peek/views/redis_detailed.rb
index c61a1e91282..a64ea672895 100644
--- a/lib/peek/views/redis_detailed.rb
+++ b/lib/peek/views/redis_detailed.rb
@@ -42,27 +42,10 @@ module Peek
'redis'
end
- def detail_store
- ::Gitlab::SafeRequestStore['redis_call_details'] ||= []
- end
-
private
- def duration
- detail_store.map { |entry| entry[:duration] }.sum # rubocop:disable CodeReuse/ActiveRecord
- end
-
- def calls
- detail_store.count
- end
-
- def call_details
- detail_store
- end
-
def format_call_details(call)
- call.merge(cmd: format_command(call[:cmd]),
- duration: (call[:duration] * 1000).round(3))
+ super.merge(cmd: format_command(call[:cmd]))
end
def format_command(cmd)