summaryrefslogtreecommitdiff
path: root/lib/peek
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-03-13 14:42:46 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-03-13 14:42:46 +0000
commit8f73ddd896dad7bd66d9c96dafcc4311ce272447 (patch)
treec518c1f90b7caa7ad66c537c1ed1ddf1a480bbfb /lib/peek
parentdfed7b4575cfe5990a2675b41a9a88d52b97b265 (diff)
parent582447d9ae0074e0843c60df92d7c2ab09b23c80 (diff)
downloadgitlab-ce-8f73ddd896dad7bd66d9c96dafcc4311ce272447.tar.gz
Merge branch '43805-list-gitaly-calls-and-arguments-in-the-performance-bar' into 'master'
Resolve "List Gitaly calls and arguments in the performance bar" Closes #43805 See merge request gitlab-org/gitlab-ce!17564
Diffstat (limited to 'lib/peek')
-rw-r--r--lib/peek/views/gitaly.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/peek/views/gitaly.rb b/lib/peek/views/gitaly.rb
index d519d8e86fa..ab35f7a2258 100644
--- a/lib/peek/views/gitaly.rb
+++ b/lib/peek/views/gitaly.rb
@@ -10,11 +10,29 @@ module Peek
end
def results
- { duration: formatted_duration, calls: calls }
+ {
+ duration: formatted_duration,
+ calls: calls,
+ details: details
+ }
end
private
+ def details
+ ::Gitlab::GitalyClient.list_call_details
+ .values
+ .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