diff options
author | Jacob Vosmaer <jacob@gitlab.com> | 2016-05-25 15:28:21 +0300 |
---|---|---|
committer | Jacob Vosmaer <jacob@gitlab.com> | 2016-05-25 15:28:21 +0300 |
commit | 3c785a761c162745fc26a4fa8b8aeb347b943840 (patch) | |
tree | f80e3c0c16388a67d48b1fad9e19dd9a4ac23fc1 /lib | |
parent | 897273d17974e414501c4152182a7cb634602d1b (diff) |
Send data to InfluxDB instead of stdout
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/middleware/proxy_timing.rb | 10 |
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 |