summaryrefslogtreecommitdiff
path: root/lib/peek
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2017-10-18 13:26:00 +0200
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2017-10-23 10:14:41 +0300
commit5e2a748bb71f09cd662f10e5b3de6155c9c742ac (patch)
treea04d019203b954fda6dc050c880f61e7b41e31df /lib/peek
parent220a5c375972462a3c583a106c5ca4c8a2138267 (diff)
downloadgitlab-ce-5e2a748bb71f09cd662f10e5b3de6155c9c742ac.tar.gz
Add Gitaly data to the Peek performance bar
Diffstat (limited to 'lib/peek')
-rw-r--r--lib/peek/views/gitaly.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/peek/views/gitaly.rb b/lib/peek/views/gitaly.rb
new file mode 100644
index 00000000000..d519d8e86fa
--- /dev/null
+++ b/lib/peek/views/gitaly.rb
@@ -0,0 +1,34 @@
+module Peek
+ module Views
+ class Gitaly < View
+ def duration
+ ::Gitlab::GitalyClient.query_time
+ end
+
+ def calls
+ ::Gitlab::GitalyClient.get_request_count
+ end
+
+ def results
+ { duration: formatted_duration, calls: calls }
+ end
+
+ private
+
+ def formatted_duration
+ ms = duration * 1000
+ if ms >= 1000
+ "%.2fms" % ms
+ else
+ "%.0fms" % ms
+ end
+ end
+
+ def setup_subscribers
+ subscribe 'start_processing.action_controller' do
+ ::Gitlab::GitalyClient.query_time = 0
+ end
+ end
+ end
+ end
+end