lib/elastic_apm/railtie.rb in elastic-apm-2.6.1 vs lib/elastic_apm/railtie.rb in elastic-apm-2.7.0
- old
+ new
@@ -21,19 +21,24 @@
app.middleware.insert 0, Middleware
end
end
config.after_initialize do
- require 'elastic_apm/spies/action_dispatch'
+ if ElasticAPM.running? &&
+ !ElasticAPM.agent.config.disabled_spies.include?('action_dispatch')
+ require 'elastic_apm/spies/action_dispatch'
+ end
end
private
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
def start(config)
if (reason = should_skip?(config))
- config.alert_logger.info "Skipping because: #{reason}. " \
- "Start manually with `ElasticAPM.start'"
+ unless config.disable_start_message?
+ config.alert_logger.info "Skipping because: #{reason}. " \
+ "Start manually with `ElasticAPM.start'"
+ end
return
end
ElasticAPM.start(config).tap do |agent|
attach_subscriber(agent)