summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2016-05-25 14:28:21 +0200
committerJacob Vosmaer <jacob@gitlab.com>2016-05-25 14:28:21 +0200
commit3c785a761c162745fc26a4fa8b8aeb347b943840 (patch)
treef80e3c0c16388a67d48b1fad9e19dd9a4ac23fc1
parent897273d17974e414501c4152182a7cb634602d1b (diff)
downloadgitlab-ce-3c785a761c162745fc26a4fa8b8aeb347b943840.tar.gz
Send data to InfluxDB instead of stdout
-rw-r--r--lib/gitlab/middleware/proxy_timing.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/gitlab/middleware/proxy_timing.rb b/lib/gitlab/middleware/proxy_timing.rb
index 9094d6b1e7d..b276eef90a8 100644
--- a/lib/gitlab/middleware/proxy_timing.rb
+++ b/lib/gitlab/middleware/proxy_timing.rb
@@ -10,11 +10,13 @@ module Gitlab
end
def call(env)
- proxy_start = env['HTTP_GITLAB_WORHORSE_PROXY_START'].to_f / 1_000_000_000
- if proxy_start > 0
- # send measurement
- puts "\n\n\n#{(Time.now - proxy_start).to_f}\n\n\n"
+ trans = Gitlab::Metrics.current_transaction
+ proxy_start = env['HTTP_GITLAB_WORHORSE_PROXY_START'].presence
+ if trans && proxy_start
+ # Time in milliseconds since gitlab-workhorse started the request
+ trans.set(:proxy_flight_time, Time.now.to_f * 1_000 - proxy_start.to_f / 1_000_000)
end
+
@app.call(env)
end
end