diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /spec/support/shared_examples/metrics | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'spec/support/shared_examples/metrics')
-rw-r--r-- | spec/support/shared_examples/metrics/active_record_subscriber_shared_examples.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/spec/support/shared_examples/metrics/active_record_subscriber_shared_examples.rb b/spec/support/shared_examples/metrics/active_record_subscriber_shared_examples.rb index 7bf2456c548..1b110ab02b5 100644 --- a/spec/support/shared_examples/metrics/active_record_subscriber_shared_examples.rb +++ b/spec/support/shared_examples/metrics/active_record_subscriber_shared_examples.rb @@ -16,7 +16,9 @@ RSpec.shared_examples 'store ActiveRecord info in RequestStore' do |db_role| db_primary_duration_s: record_query ? 0.002 : 0, db_replica_cached_count: 0, db_replica_count: 0, - db_replica_duration_s: 0.0 + db_replica_duration_s: 0.0, + db_primary_wal_count: record_wal_query ? 1 : 0, + db_replica_wal_count: 0 ) elsif db_role == :replica expect(described_class.db_counter_payload).to eq( @@ -28,7 +30,9 @@ RSpec.shared_examples 'store ActiveRecord info in RequestStore' do |db_role| db_primary_duration_s: 0.0, db_replica_cached_count: record_cached_query ? 1 : 0, db_replica_count: record_query ? 1 : 0, - db_replica_duration_s: record_query ? 0.002 : 0 + db_replica_duration_s: record_query ? 0.002 : 0, + db_replica_wal_count: record_wal_query ? 1 : 0, + db_primary_wal_count: 0 ) else expect(described_class.db_counter_payload).to eq( @@ -66,6 +70,12 @@ RSpec.shared_examples 'record ActiveRecord metrics in a metrics transaction' do expect(transaction).not_to receive(:increment).with("gitlab_transaction_db_#{db_role}_cached_count_total".to_sym, 1) if db_role end + if record_wal_query + expect(transaction).to receive(:increment).with("gitlab_transaction_db_#{db_role}_wal_count_total".to_sym, 1) if db_role + else + expect(transaction).not_to receive(:increment).with("gitlab_transaction_db_#{db_role}_wal_count_total".to_sym, 1) if db_role + end + subscriber.sql(event) end |