Sha256: 8a974d6db32dad5d0b2657e83309472eaf698cf3e35bda4ff560fb54795b7c20
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true require 'elastic_apm/subscriber' module ElasticAPM # @api private class Railtie < Rails::Railtie config.elastic_apm = ActiveSupport::OrderedOptions.new Config::DEFAULTS.each { |option, value| config.elastic_apm[option] = value } initializer 'elastic_apm.initialize' do |app| config = Config.new(app.config.elastic_apm.merge(app: app)).tap do |c| # Prepend Rails.root to log_path if present if c.log_path && !c.log_path.start_with?('/') c.log_path = Rails.root.join(c.log_path) end end begin agent = ElasticAPM.start config if agent agent.instrumenter.subscriber = ElasticAPM::Subscriber.new(agent) app.middleware.insert 0, Middleware end rescue StandardError => e config.alert_logger.error format('Failed to start: %s', e.message) config.alert_logger.debug "Backtrace:\n" + e.backtrace.join("\n") end end config.after_initialize do require 'elastic_apm/spies/action_dispatch' end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
elastic-apm-2.5.0 | lib/elastic_apm/railtie.rb |
elastic-apm-2.4.0 | lib/elastic_apm/railtie.rb |
elastic-apm-2.3.1 | lib/elastic_apm/railtie.rb |