diff --git a/lib/gitlab/metrics.rb b/lib/gitlab/metrics.rb index 8039e8e9e9d989a22a1c42f9af7b2926b15926bf..9470633b065be709b4ad8347c4a92b774e0363f6 100644 --- a/lib/gitlab/metrics.rb +++ b/lib/gitlab/metrics.rb @@ -9,12 +9,16 @@ module Gitlab # etc). This ensures the application is able to boot up even when the # migrations have not been executed. def self.settings - ApplicationSetting.current || { - metrics_pool_size: 16, - metrics_timeout: 10, - metrics_enabled: false, - metrics_method_call_threshold: 10 - } + if ApplicationSetting.table_exists? and curr = ApplicationSetting.current + curr + else + { + metrics_pool_size: 16, + metrics_timeout: 10, + metrics_enabled: false, + metrics_method_call_threshold: 10 + } + end end def self.pool_size diff --git a/spec/lib/gitlab/metrics_spec.rb b/spec/lib/gitlab/metrics_spec.rb index ebc69f8a75fb6aca94e20ab9c30804c24925148d..944642909aaea0f539ddb36a9999612949ebd45f 100644 --- a/spec/lib/gitlab/metrics_spec.rb +++ b/spec/lib/gitlab/metrics_spec.rb @@ -29,7 +29,7 @@ describe Gitlab::Metrics do it 'returns an Array containing a file path and line number' do file, line = described_class.last_relative_application_frame - expect(line).to eq(30) + expect(line).to eq(__LINE__ - 2) expect(file).to eq('spec/lib/gitlab/metrics_spec.rb') end end