From d30576c5a7197b167d1f2c472361dd4ce77b8262 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Tue, 6 Mar 2018 14:02:18 +0000 Subject: Add Gitaly call details to the performance bar The same as the SQL queries, show the details of Gitaly calls in the performance bar, as a modal that can be opened in the same way. --- lib/peek/views/gitaly.rb | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'lib/peek/views') diff --git a/lib/peek/views/gitaly.rb b/lib/peek/views/gitaly.rb index d519d8e86fa..79851640318 100644 --- a/lib/peek/views/gitaly.rb +++ b/lib/peek/views/gitaly.rb @@ -10,11 +10,28 @@ module Peek end def results - { duration: formatted_duration, calls: calls } + { + duration: formatted_duration, + calls: calls, + details: details + } end private + def details + ::Gitlab::GitalyClient.call_details + .sort { |a, b| b[:duration] <=> a[:duration] } + .map(&method(:format_call_details)) + end + + def format_call_details(call) + pretty_request = call[:request].reject { |k, v| v.blank? }.to_h.pretty_inspect + + call.merge(duration: (call[:duration] * 1000).round(3), + request: pretty_request) + end + def formatted_duration ms = duration * 1000 if ms >= 1000 -- cgit v1.2.3