summaryrefslogtreecommitdiff
path: root/config/initializers
diff options
context:
space:
mode:
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/metrics.rb13
1 files changed, 10 insertions, 3 deletions
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