Commit 5771114f authored by Jacob Vosmaer's avatar Jacob Vosmaer

Rename metric to 'rails queue duration'

parent 6ec2730f
...@@ -12,7 +12,7 @@ if Gitlab::Metrics.enabled? ...@@ -12,7 +12,7 @@ if Gitlab::Metrics.enabled?
Gitlab::Application.configure do |config| Gitlab::Application.configure do |config|
config.middleware.use(Gitlab::Metrics::RackMiddleware) config.middleware.use(Gitlab::Metrics::RackMiddleware)
config.middleware.use(Gitlab::Middleware::ProxyFlightTime) config.middleware.use(Gitlab::Middleware::RailsQueueDuration)
end end
Sidekiq.configure_server do |config| Sidekiq.configure_server do |config|
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
module Gitlab module Gitlab
module Middleware module Middleware
class ProxyFlightTime class RailsQueueDuration
def initialize(app) def initialize(app)
@app = app @app = app
end end
...@@ -14,7 +14,7 @@ module Gitlab ...@@ -14,7 +14,7 @@ module Gitlab
proxy_start = env['HTTP_GITLAB_WORHORSE_PROXY_START'].presence proxy_start = env['HTTP_GITLAB_WORHORSE_PROXY_START'].presence
if trans && proxy_start if trans && proxy_start
# Time in milliseconds since gitlab-workhorse started the request # 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) trans.set(:rails_queue_duration, Time.now.to_f * 1_000 - proxy_start.to_f / 1_000_000)
end end
@app.call(env) @app.call(env)
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::Middleware::ProxyFlightTime do describe Gitlab::Middleware::RailsQueueDuration do
let(:app) { double(:app) } let(:app) { double(:app) }
let(:middleware) { described_class.new(app) } let(:middleware) { described_class.new(app) }
let(:env) { {} } let(:env) { {} }
...@@ -23,7 +23,7 @@ describe Gitlab::Middleware::ProxyFlightTime do ...@@ -23,7 +23,7 @@ describe Gitlab::Middleware::ProxyFlightTime do
it 'sets proxy_flight_time and calls the app when the header is present' do it 'sets proxy_flight_time and calls the app when the header is present' do
env['HTTP_GITLAB_WORHORSE_PROXY_START'] = '123' env['HTTP_GITLAB_WORHORSE_PROXY_START'] = '123'
expect(transaction).to receive(:set).with(:proxy_flight_time, an_instance_of(Float)) expect(transaction).to receive(:set).with(:rails_queue_duration, an_instance_of(Float))
expect(middleware.call(env)).to eq('yay') expect(middleware.call(env)).to eq('yay')
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment