Commit f7a590dd authored by nmilojevic1's avatar nmilojevic1

Remove check if db_duration_s is present

- Fix specs for lograge
parent 82142591
......@@ -15,7 +15,7 @@ unless Gitlab::Runtime.sidekiq?
data[:db_duration_s] = Gitlab::Utils.ms_to_round_sec(data.delete(:db)) if data[:db]
data[:view_duration_s] = Gitlab::Utils.ms_to_round_sec(data.delete(:view)) if data[:view]
data[:duration_s] = Gitlab::Utils.ms_to_round_sec(data.delete(:duration)) if data[:duration]
data.merge!(::Gitlab::Metrics::Subscribers::ActiveRecord.db_counter_payload) if data[:db_duration_s]
data.merge!(::Gitlab::Metrics::Subscribers::ActiveRecord.db_counter_payload)
data
end
......
......@@ -169,22 +169,11 @@ RSpec.describe 'lograge', type: :request do
expect(log_data).to include("db_count" => 1, "db_write_count" => 0, "db_cached_count" => 0)
end
end
context 'with db payload' do
before do
event.payload.except!(:db_runtime)
end
it 'does not include db counters', :request_store do
subscriber.process_action(event)
expect(log_data).not_to include("db_count" => 0, "db_write_count" => 0, "db_cached_count" => 0)
end
end
end
context 'when RequestStore is disabled' do
context 'with db payload' do
it 'includes db counters' do
it 'does not include db counters' do
ActiveRecord::Base.connection.execute('SELECT pg_sleep(0.1);')
subscriber.process_action(event)
......
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