summaryrefslogtreecommitdiff
path: root/lib/peek
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2018-03-06 14:02:18 +0000
committerSean McGivern <sean@gitlab.com>2018-03-13 12:58:00 +0000
commitd30576c5a7197b167d1f2c472361dd4ce77b8262 (patch)
tree46de5962c850ad92d3f0c63e49db538a8c1e329a /lib/peek
parent1bab4dcffc73f8a2aca90d363a6365e71722c535 (diff)
downloadgitlab-ce-d30576c5a7197b167d1f2c472361dd4ce77b8262.tar.gz
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.
Diffstat (limited to 'lib/peek')
-rw-r--r--lib/peek/views/gitaly.rb19
1 files changed, 18 insertions, 1 deletions
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