From 5771114f9b5dba9c17b273a5dec0ef6900f6da9d Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 26 May 2016 17:53:21 +0200 Subject: Rename metric to 'rails queue duration' --- .../gitlab/middleware/proxy_flight_time_spec.rb | 31 ---------------------- .../gitlab/middleware/rails_queue_duration_spec.rb | 31 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 31 deletions(-) delete mode 100644 spec/lib/gitlab/middleware/proxy_flight_time_spec.rb create mode 100644 spec/lib/gitlab/middleware/rails_queue_duration_spec.rb (limited to 'spec') diff --git a/spec/lib/gitlab/middleware/proxy_flight_time_spec.rb b/spec/lib/gitlab/middleware/proxy_flight_time_spec.rb deleted file mode 100644 index f59166d5c29..00000000000 --- a/spec/lib/gitlab/middleware/proxy_flight_time_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -require 'spec_helper' - -describe Gitlab::Middleware::ProxyFlightTime do - let(:app) { double(:app) } - let(:middleware) { described_class.new(app) } - let(:env) { {} } - let(:transaction) { double(:transaction) } - - before { expect(app).to receive(:call).with(env).and_return('yay') } - - describe '#call' do - it 'calls the app when metrics are disabled' do - expect(Gitlab::Metrics).to receive(:current_transaction).and_return(nil) - expect(middleware.call(env)).to eq('yay') - end - - context 'when metrics are enabled' do - before { allow(Gitlab::Metrics).to receive(:current_transaction).and_return(transaction) } - - it 'calls the app when metrics are enabled but no timing header is found' do - expect(middleware.call(env)).to eq('yay') - end - - it 'sets proxy_flight_time and calls the app when the header is present' do - env['HTTP_GITLAB_WORHORSE_PROXY_START'] = '123' - expect(transaction).to receive(:set).with(:proxy_flight_time, an_instance_of(Float)) - expect(middleware.call(env)).to eq('yay') - end - end - end -end diff --git a/spec/lib/gitlab/middleware/rails_queue_duration_spec.rb b/spec/lib/gitlab/middleware/rails_queue_duration_spec.rb new file mode 100644 index 00000000000..fd6f684db0c --- /dev/null +++ b/spec/lib/gitlab/middleware/rails_queue_duration_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +describe Gitlab::Middleware::RailsQueueDuration do + let(:app) { double(:app) } + let(:middleware) { described_class.new(app) } + let(:env) { {} } + let(:transaction) { double(:transaction) } + + before { expect(app).to receive(:call).with(env).and_return('yay') } + + describe '#call' do + it 'calls the app when metrics are disabled' do + expect(Gitlab::Metrics).to receive(:current_transaction).and_return(nil) + expect(middleware.call(env)).to eq('yay') + end + + context 'when metrics are enabled' do + before { allow(Gitlab::Metrics).to receive(:current_transaction).and_return(transaction) } + + it 'calls the app when metrics are enabled but no timing header is found' do + expect(middleware.call(env)).to eq('yay') + end + + it 'sets proxy_flight_time and calls the app when the header is present' do + env['HTTP_GITLAB_WORHORSE_PROXY_START'] = '123' + expect(transaction).to receive(:set).with(:rails_queue_duration, an_instance_of(Float)) + expect(middleware.call(env)).to eq('yay') + end + end + end +end -- cgit v1.2.1