lib/honeybadger/init/rails.rb in honeybadger-2.0.0 vs lib/honeybadger/init/rails.rb in honeybadger-2.0.1

- old
+ new

@@ -10,17 +10,19 @@ end initializer 'honeybadger.install' do config = Config.new(local_config) if Honeybadger.start(config) - ::Rails.application.config.middleware.tap do |middleware| - middleware.insert(0, 'Honeybadger::Rack::ErrorNotifier', config) - middleware.insert_before('Honeybadger::Rack::ErrorNotifier', 'Honeybadger::Rack::UserFeedback', config) - middleware.insert_before('Honeybadger::Rack::UserFeedback', 'Honeybadger::Rack::UserInformer', config) + if config.feature?(:notices) && config[:'exceptions.enabled'] + ::Rails.application.config.middleware.tap do |middleware| + middleware.insert(0, 'Honeybadger::Rack::ErrorNotifier', config) + middleware.insert_before('Honeybadger::Rack::ErrorNotifier', 'Honeybadger::Rack::UserFeedback', config) + middleware.insert_before('Honeybadger::Rack::UserFeedback', 'Honeybadger::Rack::UserInformer', config) + end end - if config[:'traces.enabled'] + if config.feature?(:traces) && config[:'traces.enabled'] ActiveSupport::Notifications.subscribe('start_processing.action_controller') do |name, started, finished, id, data| Trace.create(id) end ActiveSupport::Notifications.subscribe('sql.active_record') do |*args| @@ -44,10 +46,10 @@ Trace.current.complete(event) end end end - if config[:'metrics.enabled'] + if config.feature?(:metrics) && config[:'metrics.enabled'] ActiveSupport::Notifications.subscribe('process_action.action_controller') do |*args| event = ActiveSupport::Notifications::Event.new(*args) status = event.payload[:exception] ? 500 : event.payload[:status] Agent.timing("app.request.#{status}", event.duration)