# encoding: utf-8 require 'one_apm/inst/transaction_base' require 'one_apm/inst/rack/rack' require 'one_apm/inst/rack/rack_builder' LibraryDetection.defer do named :rack depends_on do defined?(::Rack) && defined?(::Rack::Builder) end executes do OneApm::Manager.logger.info 'Installing deferred Rack instrumentation' class ::Rack::Builder class << self attr_accessor :_oa_deferred_detection_ran end self._oa_deferred_detection_ran = false include ::OneApm::Agent::Instrumentation::RackBuilder alias_method :to_app_without_oneapm, :to_app alias_method :to_app, :to_app_with_oneapm_deferred_library_detection unless OneApm::Manager.config[:disable_rack_middleware] OneApm::Manager.logger.info 'Installing Rack::Builder middleware instrumentation' alias_method :run_without_oneapm, :run alias_method :run, :run_with_oneapm alias_method :use_without_oneapm, :use alias_method :use, :use_with_oneapm end end end end