cirandas.net

ref: master

config/initializers/rollbar.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
if Rails.env.production? && ENV['ROLLBAR_TOKEN'].present?
  Rollbar.configure do |config|
    config.access_token = ENV['ROLLBAR_TOKEN']

    config.exception_level_filters.merge!(
      'ActionController::InvalidCrossOriginRequest' => 'ignore',
      'AbstractController::ActionNotFound' => 'ignore',
      'ActionView::MissingTemplate' => 'ignore',
    )

    config.before_process << proc do |options|
      agent = options[:scope][:request][:headers]['User-Agent']
      raise Rollbar::Ignore if Browser.new(agent).bot?
    end if defined? Browser
  end
end