From 935f913165b91467a70d9ba2b0ea29fad467db9d Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Mon, 11 Apr 2016 17:42:12 +0200 Subject: Instrument Banzai code --- config/initializers/metrics.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'config') diff --git a/config/initializers/metrics.rb b/config/initializers/metrics.rb index a9fc38fb04a..1b445bbbd10 100644 --- a/config/initializers/metrics.rb +++ b/config/initializers/metrics.rb @@ -75,6 +75,29 @@ if Gitlab::Metrics.enabled? config.instrument_methods(const) config.instrument_instance_methods(const) end + + # Instruments all Banzai filters + Dir[Rails.root.join('lib', 'banzai', 'filter', '*.rb')].each do |file| + klass = File.basename(file, File.extname(file)).camelize + const = Banzai::Filter.const_get(klass) + + config.instrument_methods(const) + config.instrument_instance_methods(const) + end + + config.instrument_methods(Banzai::ReferenceExtractor) + config.instrument_instance_methods(Banzai::ReferenceExtractor) + + config.instrument_methods(Banzai::Renderer) + config.instrument_methods(Banzai::Querying) + + [Issuable, Mentionable, Participable].each do |klass| + config.instrument_instance_methods(klass) + config.instrument_instance_methods(klass::ClassMethods) + end + + config.instrument_methods(Gitlab::ReferenceExtractor) + config.instrument_instance_methods(Gitlab::ReferenceExtractor) end GC::Profiler.enable -- cgit v1.2.1