summaryrefslogtreecommitdiff
path: root/config/initializers/zz_metrics.rb
diff options
context:
space:
mode:
Diffstat (limited to 'config/initializers/zz_metrics.rb')
-rw-r--r--config/initializers/zz_metrics.rb39
1 files changed, 0 insertions, 39 deletions
diff --git a/config/initializers/zz_metrics.rb b/config/initializers/zz_metrics.rb
index e352ff5090a..25e4ec0d483 100644
--- a/config/initializers/zz_metrics.rb
+++ b/config/initializers/zz_metrics.rb
@@ -162,45 +162,6 @@ if Gitlab::Metrics.enabled? && !Rails.env.test? && !(Rails.env.development? && d
config.middleware.use(Gitlab::Metrics::ElasticsearchRackMiddleware)
end
- # This instruments all methods residing in app/models that (appear to) use any
- # of the ActiveRecord methods. This has to take place _after_ initializing as
- # for some unknown reason calling eager_load! earlier breaks Devise.
- Gitlab::Application.config.after_initialize do
- # We should move all the logic of this file to somewhere else
- # and require it after `Rails.application.initialize!` in `environment.rb` file.
- models_path = Rails.root.join('app', 'models').to_s
-
- Dir.glob("**/*.rb", base: models_path).sort.each do |file|
- require_dependency file
- end
-
- regex = Regexp.union(
- ActiveRecord::Querying.public_instance_methods(false).map(&:to_s)
- )
-
- Gitlab::Metrics::Instrumentation
- .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_path) && method.source =~ regex
- end
- end
-
- # Ability is in app/models, is not an ActiveRecord model, but should still
- # be instrumented.
- Gitlab::Metrics::Instrumentation.instrument_methods(Ability)
- end
-
- Gitlab::Metrics::Instrumentation.configure do |config|
- instrument_classes(config)
- end
-
GC::Profiler.enable
module TrackNewRedisConnections