def notify_init(agent_name, options)
      if options[:airbrake_endpoint] && options[:airbrake_api_key]
        unless require_succeeds?("airbrake-ruby")
          raise RuntimeError, "airbrake-ruby gem missing - required if airbrake options used in ErrorTracker"
        end

        @cgi_data = {
          :process    => $0,
          :pid        => Process.pid,
          :agent_name => agent_name
        }
        @cgi_data[:shard_id] = options[:shard_id] if options[:shard_id]
        @filter_params = (options[:filter_params] || []).map { |p| p.to_s }
        @notify_enabled = true

        return true if Airbrake.send(:configured?, :right_agent)

        Airbrake.configure(:right_agent) do |config|
          config.host = options[:airbrake_endpoint]
          config.project_id = options[:airbrake_api_key]
          config.project_key = options[:airbrake_api_key]
          config.root_directory = AgentConfig.root_dir
          config.environment = ENV['RAILS_ENV']
          config.app_version = CURRENT_SOURCE_SHA if defined?(CURRENT_SOURCE_SHA)
        end
      else
        @notify_enabled = false
      end

      true
    end
def notify_init(agent_name, options)
      if options[:airbrake_endpoint] && options[:airbrake_api_key]
        unless require_succeeds?("airbrake-ruby")
          raise RuntimeError, "airbrake-ruby gem missing - required if airbrake options used in ErrorTracker"
        end

        @cgi_data = {
          :process    => $0,
          :pid        => Process.pid,
          :agent_name => agent_name
        }
        @cgi_data[:shard_id] = options[:shard_id] if options[:shard_id]
        @filter_params = (options[:filter_params] || []).map { |p| p.to_s }
        @notify_enabled = true

        return true if Airbrake.send(:configured?, :right_agent)

        Airbrake.configure(:right_agent) do |config|
          config.host = options[:airbrake_endpoint]
          config.project_id = options[:airbrake_api_key]
          config.project_key = options[:airbrake_api_key]
          config.root_directory = AgentConfig.root_dir
          config.environment = ENV['RAILS_ENV']
          config.app_version = CURRENT_SOURCE_SHA if defined?(CURRENT_SOURCE_SHA)
        end
      else
        @notify_enabled = false
      end

      true
    end
Configure Airbrake for exception notification

 @param [String] agent_name uniquely identifying agent process on given server

 @option options [Integer, NilClass] :shard_id identifying shard of database in use
 @option options [Array<Symbol, String>] :filter_params names whose values are to be
   filtered when notifying
 @option options [String] :airbrake_endpoint URL for Airbrake for reporting exceptions
   to Errbit
 @option options [String] :airbrake_api_key for using the Airbrake API to access Errbit

 @return [TrueClass] always true

 @raise [RuntimeError] airbrake gem missing