From 4d925f2147884812e349031a19f0d7ced9d5fdaf Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 28 Dec 2015 18:00:32 +0100 Subject: Move InfluxDB settings to ApplicationSetting --- config/gitlab.yml.example | 21 --------------------- config/initializers/metrics.rb | 13 ++++++++++--- 2 files changed, 10 insertions(+), 24 deletions(-) (limited to 'config') diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index da6d4005da6..79fc7423b31 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -449,26 +449,9 @@ production: &base # # Ban an IP for one hour (3600s) after too many auth attempts # bantime: 3600 - metrics: - host: localhost - enabled: false - # The name of the InfluxDB database to store metrics in. - database: gitlab - # Credentials to use for logging in to InfluxDB. - # username: - # password: - # The amount of InfluxDB connections to open. - # pool_size: 16 - # The timeout of a connection in seconds. - # timeout: 10 - # The minimum amount of milliseconds a method call has to take before it's - # tracked. Defaults to 10. - # method_call_threshold: 10 development: <<: *base - metrics: - enabled: false test: <<: *base @@ -511,10 +494,6 @@ test: user_filter: '' group_base: 'ou=groups,dc=example,dc=com' admin_group: '' - metrics: - enabled: false staging: <<: *base - metrics: - enabled: false diff --git a/config/initializers/metrics.rb b/config/initializers/metrics.rb index a47d2bf59a6..2e4908192a1 100644 --- a/config/initializers/metrics.rb +++ b/config/initializers/metrics.rb @@ -32,10 +32,17 @@ if Gitlab::Metrics.enabled? ) Gitlab::Metrics::Instrumentation. - instrument_class_hierarchy(ActiveRecord::Base) do |_, method| - loc = method.source_location + instrument_class_hierarchy(ActiveRecord::Base) do |klass, method| + # Instrumenting the ApplicationSetting class can lead to an infinite + # loop. Since the data is cached any way we don't really need to + # instrument it. + if klass == ApplicationSetting + false + else + loc = method.source_location - loc && loc[0].start_with?(models) && method.source =~ regex + loc && loc[0].start_with?(models) && method.source =~ regex + end end end -- cgit v1.2.1