Giter Site home page Giter Site logo

airbrake / airbrake Goto Github PK

View Code? Open in Web Editor NEW
963.0 54.0 390.0 2.75 MB

The official Airbrake library for Ruby applications

Home Page: https://airbrake.io

License: MIT License

Ruby 97.92% HTML 2.08%
airbrake crash-reporting error-monitoring ruby rails capistrano resque apm delayed-job logger

airbrake's Introduction

Airbrake

Build Status Code Climate Gem Version Documentation Status Downloads Reviewed by Hound

Introduction

Airbrake is an online tool that provides robust exception tracking in any of your Ruby applications. In doing so, it allows you to easily review errors, tie an error to an individual piece of code, and trace the cause back to recent changes. The Airbrake dashboard provides easy categorization, searching, and prioritization of exceptions so that when errors occur, your team can quickly determine the root cause.

Key features

The Airbrake Dashboard

This library is built on top of Airbrake Ruby. The difference between Airbrake and Airbrake Ruby is that the airbrake gem is just a collection of integrations with frameworks or other libraries. The airbrake-ruby gem is the core library that performs exception sending and other heavy lifting.

Normally, you just need to depend on this gem, select the integration you are interested in and follow the instructions for it. If you develop a pure frameworkless Ruby application or embed Ruby and don't need any of the listed integrations, you can depend on the airbrake-ruby gem and ignore this gem entirely.

The list of integrations that are available in this gem includes:

Deployment tracking:

Installation

Bundler

Add the Airbrake gem to your Gemfile:

gem 'airbrake'

Manual

Invoke the following command from your terminal:

gem install airbrake

Configuration

Rails

Integration

To integrate Airbrake with your Rails application, you need to know your project id and project key. Set AIRBRAKE_PROJECT_ID & AIRBRAKE_PROJECT_KEY environment variables with your project's values and generate the Airbrake config:

export AIRBRAKE_PROJECT_ID=<PROJECT ID>
export AIRBRAKE_PROJECT_KEY=<PROJECT KEY>

rails g airbrake

Heroku add-on users can omit specifying the key and the id. Heroku add-on's environment variables will be used (Heroku add-on docs):

rails g airbrake

This command will generate the Airbrake configuration file under config/initializers/airbrake.rb. Make sure that this file is checked into your version control system. This is enough to start Airbraking.

In order to configure the library according to your needs, open up the file and edit it. The full list of supported configuration options is available online.

To test the integration, invoke a special Rake task that we provide:

rake airbrake:test

In case of success, a test exception should appear in your dashboard.

The notify_airbrake controller helpers

The Airbrake gem defines two helper methods available inside Rails controllers: #notify_airbrake and #notify_airbrake_sync. If you want to notify Airbrake from your controllers manually, it's usually a good idea to prefer them over Airbrake.notify, because they automatically add information from the Rack environment to notices. #notify_airbrake is asynchronous, while #notify_airbrake_sync is synchronous (waits for responses from the server and returns them). The list of accepted arguments is identical to Airbrake.notify.

Additional features: user reporting, sophisticated API

The library sends all uncaught exceptions automatically, attaching the maximum possible amount information that can help you to debug errors. The Airbrake gem is capable of reporting information about the currently logged in user (id, email, username, etc.), if you use an authentication library such as Devise. The library also provides a special API for manual error reporting. The description of the API is available online.

Automatic integration with Rake tasks and Rails runner

Additionally, the Rails integration offers automatic exception reporting in any Rake tasks[link] and Rails runner.

Integration with filter_parameters

If you want to reuse Rails.application.config.filter_parameters in Airbrake you can configure your notifier the following way:

# config/initializers/airbrake.rb
Airbrake.configure do |c|
  c.blocklist_keys = Rails.application.config.filter_parameters
end

There are a few important details:

  1. You must load filter_parameter_logging.rb before the Airbrake config
  2. If you use Lambdas to configure filter_parameters, you need to convert them to Procs. Otherwise you will get ArgumentError
  3. If you use Procs to configure filter_parameters, the procs must return an Array of keys compatible with the Airbrake allowlist/blocklist option (String, Symbol, Regexp)

Consult the example application, which was created to show how to configure filter_parameters.

filter_parameters dot notation warning

The dot notation introduced in rails/pull/13897 for filter_parameters (e.g. a key like credit_card.code) is unsupported for performance reasons. Instead, simply specify the code key. If you have a strong opinion on this, leave a comment in the dedicated issue.

Logging

In new Rails apps, by default, all the Airbrake logs are written into log/airbrake.log. In older versions we used to write to wherever Rails.logger writes. If you wish to upgrade your app to the new behaviour, please configure your logger the following way:

c.logger = Airbrake::Rails.logger

Sinatra

To use Airbrake with Sinatra, simply require the gem, configure it and use our Rack middleware.

# myapp.rb
require 'sinatra/base'
require 'airbrake'

Airbrake.configure do |c|
  c.project_id = 113743
  c.project_key = 'fd04e13d806a90f96614ad8e529b2822'

  # Display debug output.
  c.logger.level = Logger::DEBUG
end

class MyApp < Sinatra::Base
  use Airbrake::Rack::Middleware

  get('/') { 1/0 }
end

run MyApp.run!

To run the app, add a file called config.ru to the same directory and invoke rackup from your console.

# config.ru
require_relative 'myapp'

That's all! Now you can send a test request to localhost:9292 and check your project's dashboard for a new error.

curl localhost:9292

Rack

To send exceptions to Airbrake from any Rack application, simply use our Rack middleware, and configure the notifier.

require 'airbrake'
require 'airbrake/rack'

Airbrake.configure do |c|
  c.project_id = 113743
  c.project_key = 'fd04e13d806a90f96614ad8e529b2822'
end

use Airbrake::Rack::Middleware

Note: be aware that by default the library doesn't filter any parameters, including user passwords. To filter out passwords add a filter.

Appending information from Rack requests

If you want to append additional information from web requests (such as HTTP headers), define a special filter such as:

Airbrake.add_filter do |notice|
  next unless (request = notice.stash[:rack_request])
  notice[:params][:remoteIp] = request.env['REMOTE_IP']
end

The notice object carries a real Rack::Request object in its stash. Rack requests will always be accessible through the :rack_request stash key.

Optional Rack request filters

The library comes with optional predefined builders listed below.

RequestBodyFilter

RequestBodyFilter appends Rack request body to the notice. It accepts a length argument, which tells the filter how many bytes to read from the body.

By default, up to 4096 bytes is read:

Airbrake.add_filter(Airbrake::Rack::RequestBodyFilter.new)

You can redefine how many bytes to read by passing an Integer argument to the filter. For example, read up to 512 bytes:

Airbrake.add_filter(Airbrake::Rack::RequestBodyFilter.new(512))

Sending custom route breakdown performance

Arbitrary code performance instrumentation

For every route in your app Airbrake collects performance breakdown statistics. If you need to monitor a specific operation, you can capture your own breakdown:

def index
  Airbrake::Rack.capture_timing('operation name') do
    call_operation(...)
  end

  call_other_operation
end

That will benchmark call_operation and send performance information to Airbrake, to the corresponding route (under the 'operation name' label).

Method performance instrumentation

Alternatively, you can measure performance of a specific method:

class UsersController
  extend Airbrake::Rack::Instrumentable

  def index
    call_operation(...)
  end
  airbrake_capture_timing :index
end

Similarly to the previous example, performance information of the index method will be sent to Airbrake.

Sidekiq

We support Sidekiq v2+. The configurations steps for them are identical. Simply require our integration and you're done:

require 'airbrake/sidekiq'

If you required Sidekiq before Airbrake, then you don't even have to require anything manually and it should just work out-of-box.

Airbrake::Sidekiq::RetryableJobsFilter

By default, Airbrake notifies of all errors, including reoccurring errors during a retry attempt. To filter out these errors and only get notified when Sidekiq has exhausted its retries you can add the RetryableJobsFilter:

Airbrake.add_filter(Airbrake::Sidekiq::RetryableJobsFilter.new)

The filter accepts an optional max_retries parameter. When set, it configures the amount of allowed job retries that won't trigger an Airbrake notification. Normally, this parameter is configured by the job itself but this setting takes the highest precedence and forces the value upon all jobs, so be careful when you use it. By default, it's not set.

Airbrake.add_filter(
  Airbrake::Sidekiq::RetryableJobsFilter.new(max_retries: 10)
)

ActiveJob

No additional configuration is needed. Simply ensure that you have configured your Airbrake notifier with your queue adapter.

Resque

Simply require the Resque integration:

require 'airbrake/resque'

Integrating with Rails applications

If you're working with Resque in the context of a Rails application, create a new initializer in config/initializers/resque.rb with the following content:

# config/initializers/resque.rb
require 'airbrake/resque'
Resque::Failure.backend = Resque::Failure::Airbrake

Now you're all set.

General integration

Any Ruby app using Resque can be integrated with Airbrake. If you can require the Airbrake gem after Resque, then there's no need to require airbrake/resque anymore:

require 'resque'
require 'airbrake'

Resque::Failure.backend = Resque::Failure::Airbrake

If you're unsure, just configure it similar to the Rails approach. If you use multiple backends, then continue reading the needed configuration steps in the Resque wiki (it's fairly straightforward).

DelayedJob

Simply require our integration and you're done:

require 'airbrake/delayed_job'

If you required DelayedJob before Airbrake, then you don't even have to require anything manually and it should just work out-of-box.

Shoryuken

Simply require our integration and you're done:

require 'airbrake/shoryuken'

If you required Shoryuken before Airbrake, then you don't even have to require anything manually and it should just work out-of-box.

Sneakers

Simply require our integration and you're done:

require 'airbrake/sneakers'

If you required Sneakers before Airbrake, then you don't even have to require anything manually and it should just work out-of-box.

ActionCable

The ActionCable integration sends errors occurring in ActionCable actions and subscribed/unsubscribed events. If you use Rails with ActionCable, there's nothing to do, it's already loaded. If you use ActionCable outside Rails, simply require it:

require 'airbrake/rails/action_cable'

Rake

Airbrake offers Rake tasks integration, which is used by our Rails integration[link]. To integrate Airbrake in any project, just require the gem in your Rakefile, if it hasn't been required and configure the notifier.

# Rakefile
require 'airbrake'

Airbrake.configure do |c|
  c.project_id = 113743
  c.project_key = 'fd04e13d806a90f96614ad8e529b2822'
end

task :foo do
  1/0
end

Logger

If you want to convert your log messages to Airbrake errors, you can use our integration with Ruby's Logger class from stdlib. All you need to do is to wrap your logger in Airbrake's decorator class:

require 'airbrake/logger'

# Create a normal logger
logger = Logger.new($stdout)

# Wrap it
logger = Airbrake::AirbrakeLogger.new(logger)

Now you can use the logger object exactly the same way you use it. For example, calling fatal on it will both log your message and send it to the Airbrake dashboard:

logger.fatal('oops')

The Logger class will attempt to utilize the default Airbrake notifier to deliver messages. It's possible to redefine it via #airbrake_notifier:

# Assign your own notifier.
logger.airbrake_notifier = Airbrake::NoticeNotifier.new

Airbrake severity level

In order to reduce the noise from the Logger integration it's possible to configure Airbrake severity level. For example, if you want to send only fatal messages from Logger, then configure it as follows:

# Send only fatal messages to Airbrake, ignore anything below this level.
logger.airbrake_level = Logger::FATAL

By default, airbrake_level is set to Logger::WARN, which means it sends warnings, errors and fatal error messages to Airbrake.

Configuring Airbrake logger integration with a Rails application

In order to configure a production logger with Airbrake integration, simply overwrite Rails.logger with a wrapped logger in an after_initialize callback:

# config/environments/production.rb
config.after_initialize do
  # Standard logger with Airbrake integration:
  # https://github.com/airbrake/airbrake#logger
  Rails.logger = Airbrake::AirbrakeLogger.new(Rails.logger)
end

Configuring Rails APM SQL query stats when using Rails engines

By default, the library collects Rails SQL performance stats. For standard Rails apps no extra configuration is needed. However if your app uses Rails engines, you need to take an additional step to make sure that the file and line information is present for queries being executed in the engine code.

Specifically, you need to make sure that your Rails.backtrace_cleaner has a silencer that doesn't silence engine code (will be silenced by default). For example, if your engine is called blorgh and its main directory is in the root of your project, you need to extend the default silencer provided with Rails and add the path to your engine:

# config/initializers/backtrace_silencers.rb

# Delete default silencer(s).
Rails.backtrace_cleaner.remove_silencers!

# Define custom silencer, which adds support for the "blorgh" engine
Rails.backtrace_cleaner.add_silencer do |line|
  app_dirs_pattern = %r{\A/?(app|config|lib|test|blorgh|\(\w*\))}
  !app_dirs_pattern.match?(line)
end

Plain Ruby scripts

Airbrake supports any type of Ruby applications including plain Ruby scripts. If you want to integrate your script with Airbrake, you don't have to use this gem. The Airbrake Ruby gem provides all the needed tooling.

Deploy tracking

By notifying Airbrake of your application deployments, all errors are resolved when a deploy occurs, so that you'll be notified again about any errors that reoccur after a deployment. Additionally, it's possible to review the errors in Airbrake that occurred before and after a deploy.

There are several ways to integrate deployment tracking with your application, that are described below.

Capistrano

The library supports Capistrano v2 and Capistrano v3. In order to configure deploy tracking with Capistrano simply require our integration from your Capfile:

# Capfile
require 'airbrake/capistrano'

If you use Capistrano 3, define the after :finished hook, which executes the deploy notification task (Capistrano 2 doesn't require this step).

# config/deploy.rb
namespace :deploy do
  after :finished, 'airbrake:deploy'
end

If you version your application, you can set the :app_version variable in config/deploy.rb, so that information will be attached to your deploy.

# config/deploy.rb
set :app_version, '1.2.3'

Rake task

A Rake task can accept several arguments shown in the table below:

Key Required Default Example
ENVIRONMENT No Rails.env production
USERNAME No nil john
REPOSITORY No nil https://github.com/airbrake/airbrake
REVISION No nil 38748467ea579e7ae64f7815452307c9d05e05c5
VERSION No nil v2.0

In Rails

Simply invoke rake airbrake:deploy and pass needed arguments:

rake airbrake:deploy USERNAME=john ENVIRONMENT=production REVISION=38748467 REPOSITORY=https://github.com/airbrake/airbrake

Anywhere

Make sure to require the library Rake integration in your Rakefile.

# Rakefile
require 'airbrake/rake/tasks'

Then, invoke it like shown in the example for Rails.

Supported Rubies

  • CRuby >= 2.6.0
  • JRuby >= 9k

Contact

In case you have a problem, question or a bug report, feel free to:

License

The project uses the MIT License. See LICENSE.md for details.

Development & testing

In order to run the test suite, first of all, clone the repo, and install dependencies with Bundler.

git clone https://github.com/airbrake/airbrake.git
cd airbrake
bundle

Next, run unit tests.

bundle exec rake

In order to test integrations with frameworks and other libraries, install their dependencies with help of the following command:

bundle exec appraisal install

To run integration tests for a specific framework, use the appraisal command.

bundle exec appraisal rails-4.2 rake spec:integration:rails
bundle exec appraisal sinatra rake spec:integration:sinatra

Pro tip: GitHub Actions config has the list of all the integration tests and commands to invoke them.

airbrake's People

Contributors

alif avatar benarent avatar benjaminoakes avatar brianhawley avatar crazyvipa avatar dependabot-preview[bot] avatar dependabot[bot] avatar dvdplm avatar gabebw avatar grosser avatar hardbap avatar jferris avatar joshk avatar joshuaclayton avatar jpsilvashy avatar kimrgrey avatar kyrylo avatar leonid-shevtsov avatar marten avatar midn avatar mike-burns avatar mjankowski avatar mmcdaris avatar qrush avatar schmidt avatar sgray avatar shifi avatar shime avatar tristandunn avatar usiegj00 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

airbrake's Issues

Calling Airbrake.notify(hash) raises a NoMethodError

In the README, the usage for Airbrake.notify is:

Airbrake.notify(
  :error_class   => "Special Error",
  :error_message => "Special Error: #{e.message}",
  :parameters    => params
)

However, running this raises a NoMethodError:

NoMethodError: undefined method `backtrace' for #<Hash:0x0000000674a008>

The correct usage for Airbrake.notify requires a first argument, the exception to notify about. This can be nil.

Airbrake.notify(exception_or_nil, {
  :error_class   => "Special Error",
  :error_message => "Special Error: #{e.message}",
  :parameters    => params
})

There's also a test case in test/notifier_test.rb, "create and send a notice for a hash", that attempts to call Airbrake.notify with only a hash argument. I'm setting up the test suite now to confirm that this fails, but I can't see how it could be passing.

If I'm correct, I think the documentation needs to be updated to reflect the mandatory first argument to Airbrake.notify, and the test case needs to be removed.

Link to the source code from Rubygems.org

Hi,

It'd be quite useful to add a "Source" link from the Rubygems.org page.

Right now there is only a "Homepage" link, pointing to airbrake.io (wich redirects me to my errors if I'm logged in).

Thanks

BTW : the v3.0.6 is not pushed yet to rubygems.org. I guess it's on its way, but in case it has been forgotten here is a gentle reminder ;-)

Support Rails 3.1 and 3.2

Your official rails supported versions file in the root does not list any Rails 3.1 or 3.2 versions.

Cannot display error message from a rake task (rake, version 0.9.2)

$HOME/.rvm/gems/ruby-1.9.3-preview1/gems/airbrake-3.0.2/lib/airbrake/rake_handler.rb:12:in 
`display_error_message_with_airbrake': undefined method `rescue_rake_exceptions'
for nil:NilClass (NoMethodError)

OS: Ubuntu
Ruby: 1.9.3-preview1
Rake: version 0.9.2
Airbrake: 3.0.2

builder method to_xs breaks when using 1.8.7

I submitted a pull request to jimweirich's builder (3.0.0), but in the meantime the bug causes the airbrake gem to break in 1.8.7
[2011-11-11 11:14:49] ERROR ArgumentError: wrong number of arguments (1 for 0)
691 /Users/elise/.rvm/gems/ruby-1.8.7-p352@ppi/gems/builder-3.0.0/lib/builder/xmlbase.rb:135:in to_xs' 692 /Users/elise/.rvm/gems/ruby-1.8.7-p352@ppi/gems/builder-3.0.0/lib/builder/xmlbase.rb:135:in_escape'
693 /Users/elise/.rvm/gems/ruby-1.8.7-p352@ppi/gems/builder-3.0.0/lib/builder/xmlbase.rb:140:in _escape_quote' 694 /Users/elise/.rvm/gems/ruby-1.8.7-p352@ppi/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:320:in_attr_value'
695 /Users/elise/.rvm/gems/ruby-1.8.7-p352@ppi/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:308:in _insert_attributes' 696 /Users/elise/.rvm/gems/ruby-1.8.7-p352@ppi/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:306:ineach'
697 /Users/elise/.rvm/gems/ruby-1.8.7-p352@ppi/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:306:in _insert_attributes' 698 /Users/elise/.rvm/gems/ruby-1.8.7-p352@ppi/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:284:in_special'
699 /Users/elise/.rvm/gems/ruby-1.8.7-p352@ppi/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:250:in instruct!' 700 /Users/elise/.rvm/gems/ruby-1.8.7-p352@ppi/gems/airbrake-3.0.5/lib/airbrake/notice.rb:113:into_xml'

Hopefully this fix will be pulled in soon, if you could then update your dependencies that would be great.

Deploy notification rake task not working on Heroku Cedar

Running rake airbrake:heroku:add_deploy_notification produces the following output:

Running:
heroku addons:add deployhooks:http url="http://airbrake.io/deploys.txt?deploy[rails_env]=For Cedar apps, use: `heroku run console`&api_key=For Cedar apps, use: `heroku run console`"

Invalid gemspec using airbrake in ruby 1.8.7 installation

It appears the airbrake gem has been built on ruby 1.9. This causes problems using the gem in a 1.8.7 installation. The problem and workaround is documented in the following RubyGems issue:

http://help.rubygems.org/discussions/problems/575-invalid-gemspec-with-invalid-date-format-in-specification

The fix is to force syck when building the airbrake gem:

YAML::ENGINE.yamler = 'syck'

This would make live easier for ruby 1.8.7 users who want to upgrade from hoptoad_notifier to airbrake.

Gem releases should be tagged

It looks like there have been no Git tags for releases since v3.0.2. Tags make it a lot easier to see what exactly has changed between specific releases.

Rails 2.3 with bundler

You should mention that for rails 2.3 with bundler in Gemfile I need to add:

gem 'airbrake', :require => 'airbrake/rails'

otherwise I got error uninitialized constant Airbrake::Rails

Local rake isn't the same as remote one

In my config/deploy.rb, I have the following:

set :rvm, "/usr/local/rvm/bin/rvm"
set :ruby_version do
  File.read(File.expand_path("../../.rvmrc", __FILE__)).chomp.split.last
end
set :rake, "#{rvm} #{ruby_version} ruby bundle exec rake"

Airbrake fails the deploy with an ugly message because it tries to run the Rake task locally, but is using the remote Rake instance.

Solutions:

  • Use remote rake to run the task
  • Use a :local_rake instead, which I've found referenced elsewhere, but can't find anymore.

Certificate check fails during airbrake:deploy hook

So it appears that if there is no ca bundle found at the OpenSSL default location AND you have airbrake configured with secure = true, it fails the certificate check and it cause the deploy hook to fail.

The logic for handling this should be the same as for the send_to_airbrake method. These two pieces of could should call the same method so that this issue doesn't come up again when there are changes made. Also the user should be allowed to pass in the path of their ca bundle. Maybe I will fork and submit the changes.

Airbrake should use error_message over exception name in notify()?

More of an improvement rather than a bug, but it seems extremely counter-intuitive for the error message to be overwritten with a simple stringification of the exception class when I'm explicitly passing in :error_message in opts (in addition to the exception thrown). I imagine this may be useful for other people as well.

AirBrake fails to report exception on EY cluster

I set up a cluster environment on EngineYard with 1 application server (the Application Master)
This means that the Application Master runs HAProxy as well as nginx+unicorn to run rails.
When a request comes it goes to HAproxy which in turn calls Unicorn to get the response.

This breaks the AirBrake reporting because request.local? is TRUE so airbrake_local_request? is always True when it should be False.
The following code is in controller_method.rb:

def notify_airbrake(hash_or_exception)
        unless airbrake_local_request?
          Airbrake.notify(hash_or_exception, airbrake_request_data)
        end
      end

      def airbrake_local_request?
        if defined?(::Rails.application.config)
          ::Rails.application.config.consider_all_requests_local || request.local?
        else
          consider_all_requests_local || local_request?
        end
      end

Any idea how to properly patch this issue?

Rails generator (still) breaks Capistrano deployment

As documented in this discussion from July 2010, requiring ./config/boot in Capistrano's deploy.rb effectively breaks the deployment ("could not find any strategy named `[any strategy]'").

Removing the line require './config/boot' from deploy.rb makes everything work again.

I am wondering why this is still in the generator? Would you accept a pull request that removes the line?

503 for next request after error

1: request page with error. ok, airbrake submits error.
2: request another page. status code 503.
3: reload same page. ok.

Running on Heroku but had same issue on nginx/passenger.

from heroku logs:

2011-10-18T12:01:08+00:00 heroku[router]: GET url dyno=web.1 queue=0 wait=0ms service=115ms status=200 bytes=76680
2011-10-18T12:01:11+00:00 app[web.1]:
2011-10-18T12:01:11+00:00 app[web.1]: ** [Airbrake] Success: Net::HTTPOK
2011-10-18T12:01:11+00:00 app[web.1]: ** [Airbrake] Environment Info: [Ruby: 1.9.2] [Rails: 3.1.1] [Env: production]
2011-10-18T12:01:11+00:00 app[web.1]: ** [Airbrake] Response from Airbrake:
2011-10-18T12:01:11+00:00 app[web.1]:
2011-10-18T12:01:11+00:00 app[web.1]:
2011-10-18T12:01:11+00:00 app[web.1]: x
2011-10-18T12:01:11+00:00 app[web.1]: x
2011-10-18T12:01:11+00:00 app[web.1]: x
2011-10-18T12:01:11+00:00 app[web.1]:
2011-10-18T12:01:11+00:00 app[web.1]:
2011-10-18T12:01:11+00:00 app[web.1]:
2011-10-18T12:01:11+00:00 app[web.1]: ArgumentError (invalid date):
2011-10-18T12:01:11+00:00 app[web.1]: controller.rb:4:in `index'
2011-10-18T12:01:11+00:00 app[web.1]:
2011-10-18T12:01:11+00:00 app[web.1]:
2011-10-18T12:01:11+00:00 heroku[router]: GET url/manage dyno=web.1 queue=0 wait=0ms service=586ms status=500 bytes=728
2011-10-18T12:01:12+00:00 app[web.1]: !! Unexpected error while processing request: deadlock; recursive locking

Rails 3: No errors reported on errors occurring in the middleware stack

In Rails 3, errors occuring higher earlier in the middleware stack (e.g. in the ActiveRecord session store) do not get reported. This is because Rails 3 has no ActionController::Failsafe middleware, causing the Airbrake::Rack middleware to be inserted near the end of the middleware stack.

ArgumentError: wrong number of arguments (0 for 1)

hello

airbrake run good on my app in production i recieve errors but in other environment.

i dont see the real error i see always the same error

what can I do?

many regards,

ArgumentError: wrong number of arguments (0 for 1)

Where:
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/templates/rescues/_request_and_response.erb, line 24

URL:
http://staging.dvdpost.be/fr/products/111111111111111
Backtrace:
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/templates/rescues/_request_and_response.erb:24:in response' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/templates/rescues/_request_and_response.erb:24:in_run_erb_47home47webapps47dvdpostapp47staging47shared47bundle47ruby47146847gems47actionpack452463461147lib47action_controller47templates47rescues47_request_and_response46erb'
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_view/renderable.rb:34:in send' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_view/renderable.rb:34:inrender'
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_view/base.rb:306:in with_template' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_view/renderable.rb:30:inrender'
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_view/renderable_partial.rb:20:in render' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/benchmarking.rb:26:inbenchmark'
[GEM_ROOT]/gems/activesupport-2.3.11/lib/active_support/core_ext/benchmark.rb:17:in ms' /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/1.8/benchmark.rb:308:inrealtime'
[GEM_ROOT]/gems/activesupport-2.3.11/lib/active_support/core_ext/benchmark.rb:17:in ms' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/benchmarking.rb:26:inbenchmark'
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_view/renderable_partial.rb:19:in render' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_view/template.rb:205:inrender_template'
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_view/base.rb:265:in render' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/templates/rescues/template_error.erb:21:in_run_erb_47home47webapps47dvdpostapp47staging47shared47bundle47ruby47146847gems47actionpack452463461147lib47action_controller47templates47rescues47template_error46erb'
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_view/renderable.rb:34:in send' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_view/renderable.rb:34:inrender'
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_view/base.rb:306:in with_template' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_view/renderable.rb:30:inrender'
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_view/template.rb:205:in render_template' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_view/base.rb:265:inrender'
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/rescue.rb:134:in rescue_action_locally_without_airbrake' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/rescue.rb:152:inrescue_action_without_handler'
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/rescue.rb:74:in rescue_action' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/base.rb:532:insend'
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/base.rb:532:in process_without_filters' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/filters.rb:606:inprocess'
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/rescue.rb:65:in call_with_exception' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/dispatcher.rb:90:indispatch'
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/dispatcher.rb:121:in _call' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/dispatcher.rb:130 [GEM_ROOT]/gems/warden-1.0.4/lib/warden/manager.rb:35:incall'
[GEM_ROOT]/gems/warden-1.0.4/lib/warden/manager.rb:35:in call' [GEM_ROOT]/gems/warden-1.0.4/lib/warden/manager.rb:34:incatch'
[GEM_ROOT]/gems/warden-1.0.4/lib/warden/manager.rb:34:in call' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/string_coercion.rb:25:incall'
[GEM_ROOT]/gems/rack-1.1.2/lib/rack/head.rb:9:in call' [GEM_ROOT]/gems/rack-1.1.2/lib/rack/methodoverride.rb:24:incall'
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/params_parser.rb:15:in call' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/session/abstract_store.rb:177:incall'
[GEM_ROOT]/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:29:in call' [GEM_ROOT]/gems/activerecord-2.3.11/lib/active_record/connection_adapters/abstract/query_cache.rb:34:incache'
[GEM_ROOT]/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:9:in cache' [GEM_ROOT]/gems/activerecord-2.3.11/lib/active_record/query_cache.rb:28:incall'
[GEM_ROOT]/gems/activerecord-2.3.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in call' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/failsafe.rb:26:incall'
[GEM_ROOT]/gems/rack-1.1.2/lib/rack/lock.rb:11:in call' [GEM_ROOT]/gems/rack-1.1.2/lib/rack/lock.rb:11:insynchronize'
[GEM_ROOT]/gems/rack-1.1.2/lib/rack/lock.rb:11:in call' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/dispatcher.rb:114:incall'
[GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/reloader.rb:34:in run' [GEM_ROOT]/gems/actionpack-2.3.11/lib/action_controller/dispatcher.rb:108:incall'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/rack/request_handler.rb:96:in process_request' /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_request_handler.rb:513:inaccept_and_process_next_request'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_request_handler.rb:274:in main_loop' /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/classic_rails/application_spawner.rb:321:instart_request_handler'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in send' /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/classic_rails/application_spawner.rb:275:inhandle_spawn_application'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/utils.rb:479:in safe_fork' /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/classic_rails/application_spawner.rb:270:inhandle_spawn_application'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:357:in __send__' /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:357:in server_main_loop'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:206:instart_synchronously' /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:180:in start'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/classic_rails/application_spawner.rb:149:instart' /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:219:in spawn_rails_application'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb:132:inlookup_or_add' /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:214:in spawn_rails_application'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb:82:insynchronize' /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server_collection.rb:79:in synchronize'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:213:inspawn_rails_application' /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:132:in spawn_application'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb:275:inhandle_spawn_application' /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:357:in send'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:357:inserver_main_loop' /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb:206:in start_synchronously'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/passenger-3.0.9/helper-scripts/passenger-spawn-server:99

Airbrake does not appear compatible with builder 3.0.0

Airbrake has an unbounded dependency on builder which causes 3.0.0 to be pulled in if the project doesn't already have a restriction. Unfortunately, buidler 3.0.0 has a problem when Airbrake.notify() is called:

#<ArgumentError: wrong number of arguments (1 for 0)>
vendor/bundle/jruby/1.8/gems/builder-3.0.0/lib/builder/xmlbase.rb:135:in `_escape' 
vendor/bundle/jruby/1.8/gems/builder-3.0.0/lib/builder/xmlbase.rb:140:in `_escape_quote' 
vendor/bundle/jruby/1.8/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:320:in `_attr_value'  
vendor/bundle/jruby/1.8/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:308:in `_insert_attributes' 
org/jruby/RubyArray.java:1603:in `each' 
vendor/bundle/jruby/1.8/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:306:in `_insert_attributes'
vendor/bundle/jruby/1.8/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:284:in `_special'  
vendor/bundle/jruby/1.8/gems/builder-3.0.0/lib/builder/xmlmarkup.rb:250:in `instruct!'  
vendor/bundle/jruby/1.8/gems/airbrake-3.0.5/lib/airbrake/notice.rb:113:in `to_xml'  
vendor/bundle/jruby/1.8/gems/airbrake-3.0.5/lib/airbrake.rb:134:in `send_notice'  
vendor/bundle/jruby/1.8/gems/airbrake-3.0.5/lib/airbrake.rb:103:in `notify' 

This is seen with airbrake 3.0.5 in a vanilla jruby app (no rails, sinatra, etc) in jruby 1.8 mode (i.e. no --1.9 parameter passed).

Routing errors with Airbrake 3.1.0

Not sure what happened in 3.1.0 but now getting a bunch of issues with routing. Anytime I hit what should be a 404 page, the system returns a 500 error.

Deploy notification is not working (exception)

Hi,

I'm using engine yard and I receive this message on every deploy:

/data/app/shared/bundled_gems/ruby/1.9.1/gems/airbrake-3.0.4/lib/airbrake.rb:134:in `send_notice': undefined method `send_to_airbrake' for nil:NilClass (NoMethodError)
    from /data/app/shared/bundled_gems/ruby/1.9.1/gems/airbrake-3.0.4/lib/airbrake.rb:103:in `notify'
    from /data/app/shared/bundled_gems/ruby/1.9.1/gems/airbrake-3.0.4/lib/airbrake/rake_handler.rb:15:in `display_error_message_with_airbrake'
    from /data/app/shared/bundled_gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:138:in `rescue in standard_exception_handling'
    from /data/app/shared/bundled_gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:128:in `standard_exception_handling'
    from /data/app/shared/bundled_gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
    from /data/app/shared/bundled_gems/ruby/1.9.1/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
    from /data/app/shared/bundled_gems/ruby/1.9.1/bin/rake:19:in `load'
    from /data/app/shared/bundled_gems/ruby/1.9.1/bin/rake:19:in `<main>'

Using 3.0.4:

gem 'airbrake', '3.0.4'

After restart hook:

# notify airbrake about deploy
# see more: http://help.airbrakeapp.com/kb/api-2/deploy-tracking
notify_deploy_environments = %w(staging production)
notify_deploy_roles        = %w(solo app_master)

if notify_deploy_environments.include?(@configuration[:environment]) && notify_deploy_roles.include?(node['instance_role'])
  run "cd #{release_path} && bundle exec rake hoptoad:deploy TO=#{@configuration[:environment].strip} REVISION=#{@configuration[:revision].strip} USER=`whoami` REPO=#{@configuration[:repo].strip}"
end

I've missed something?

failure with Airbrake takes down entire app

related to: #17

when the SSL misconfiguration error is thrown for that hoptoad, it bubbles up the exception. We use hoptoad in a lot of cases to notify us when something happened but we then swallow the error and continue on...and right now it is brining things to a sudden halt.

The SSL misconfiguration issue aside, this concerns me because it means the app is dependent upon a 3rd party system to function; this isn't fire and forget but fire and hope Airbrake doesn't fail or take 5 seconds to return. I would be very interested in working with you all to convert this over to a separate thread that doesn't get in the way of the application. If you are open to that let me know!

thanks

with ssl certificate fails to verify

with config.secure = true I get:

rake aborted!
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
/Users/betelgeuse/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:586:in `connect'
/Users/betelgeuse/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:586:in `connect'
/Users/betelgeuse/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:553:in `do_start'
/Users/betelgeuse/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:542:in `start'
/Users/betelgeuse/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:1035:in `__request__'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rest-client-1.6.1/lib/restclient/net_http_ext.rb:17:in `request'
/Users/betelgeuse/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/net/http.rb:845:in `post'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/airbrake-3.0.4/lib/airbrake/sender.rb:44:in `send_to_airbrake'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/airbrake-3.0.4/lib/airbrake.rb:134:in `send_notice'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/airbrake-3.0.4/lib/airbrake.rb:110:in `notify_or_ignore'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/airbrake-3.0.4/lib/airbrake/rails/action_controller_catcher.rb:17:in `rescue_action_in_public'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/airbrake-3.0.4/lib/airbrake/tasks.rb:50:in `rescue_action'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.11/lib/action_controller/rescue.rb:162:in `perform_action_without_flash'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.11/lib/action_controller/flash.rb:151:in `perform_action'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.11/lib/action_controller/base.rb:532:in `send'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.11/lib/action_controller/base.rb:532:in `process_without_filters'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/actionpack-2.3.11/lib/action_controller/filters.rb:606:in `process'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/airbrake-3.0.4/lib/airbrake/tasks.rb:80
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/Users/betelgeuse/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/gems/rake-0.8.7/bin/rake:31
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/bin/rake:19:in `load'
/Users/betelgeuse/.rvm/gems/ree-1.8.7-2011.03/bin/rake:19

This happens on both OS X and on Heroku.

javascript notifier probably doesn't need to document.write

Rather than

(function(){
    var notifierJsScheme = (("https:" == document.location.protocol) ? "https://" : "http://");
    document.write(unescape("%3Cscript src='" + notifierJsScheme + "airbrake.io/javascripts/notifier.js' type='text/javascript'%3E%3C/script%3E"));
  })();

It would probably be preferrable to use a scheme-less URL:

<script src="//airbrake.io/javascripts/notifier.js" type="text/javascript"></script>

afaik, it's well supported for JS (less so for stylesheets) - but don't take my word for that!

airbrake_javascript_notifier outputs empty string

I included <%= airbrake_javascript_notifier %> near the top of my layout file per your instructions. This results only in an empty line added to the head section.

I did not forget the = sign. I verified that I added it to the correct layout file.

What am I doing wrong?

Error: undefined method `render' when adding airbrake_javascript_notifier

When I add airbrake_javascript_notifier in my application layout, I got the following error.

undefined method 'render' for #Hash:0x0000012a4064d0

airbrake (3.0.9) lib/airbrake/rails/javascript_notifier.rb:33:in 'airbrake_javascript_notifier'
actionpack (3.2.3) lib/abstract_controller/helpers.rb:53:in 'airbrake_javascript_notifier'
app/views/layouts/application.html.haml:5:in '_app_views_layouts_application_html_haml__3110745671750612654_2493003200'

I traced the javascript_notifier.rb:33 where the error occured and figured out what the problem is.

If there's an instance value @template in my controller, that raise the error.
After I changed the instance value name, I don't get the error.

3.0.5 breaks Airbrake.notify(hash)

This commit breaks Airbrake.notify when called with a hash.

Example:

ruby-1.9.2-p180 :001 > require 'airbrake'
 => true 
ruby-1.9.2-p180 :002 > Airbrake.notify({})
NoMethodError: undefined method `backtrace' for {}:Hash
    from /Users/msepcot/.rvm/gems/ruby-1.9.2-p180/gems/airbrake-3.0.5/lib/airbrake/notice.rb:223:in `from_exception'
    from /Users/msepcot/.rvm/gems/ruby-1.9.2-p180/gems/airbrake-3.0.5/lib/airbrake/notice.rb:208:in `exception_attribute'
    from /Users/msepcot/.rvm/gems/ruby-1.9.2-p180/gems/airbrake-3.0.5/lib/airbrake/notice.rb:96:in `initialize'
    from /Users/msepcot/.rvm/gems/ruby-1.9.2-p180/gems/airbrake-3.0.5/lib/airbrake.rb:142:in `new'
    from /Users/msepcot/.rvm/gems/ruby-1.9.2-p180/gems/airbrake-3.0.5/lib/airbrake.rb:142:in `build_notice_for'
    from /Users/msepcot/.rvm/gems/ruby-1.9.2-p180/gems/airbrake-3.0.5/lib/airbrake.rb:103:in `notify'
    from (irb):2
    from /Users/msepcot/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>'

In test/notifier_test.rb "create and send a notice for a hash" stubs out the Airbrake::Notice#new which hides the error. In 3.0.4 and below, build_notice_for only set :exception when the argument did not respond to a to_hash call. With 3.0.5, :exception is always set, which is causing the above error to be raised when the argument is a hash.

rake airbrake:test fails with ActionController::RoutingError

When I run bundle exec rake airbrake:test --trace I get this:

** Invoke airbrake:test (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute airbrake:test
Configuration:
                  api_key: "[my-api-key]"
        backtrace_filters: [#<Proc:0x000001051f3708@/Users/vesan/.rvm/gems/ruby-1.
 development_environments: []
       development_lookup: true
         environment_name: "development"
                     host: "airbrakeapp.com"
        http_open_timeout: 2
        http_read_timeout: 5
                   ignore: ["ActiveRecord::RecordNotFound", "ActionController::Rou
        ignore_by_filters: []
        ignore_user_agent: []
            notifier_name: "Airbrake Notifier"
             notifier_url: "http://airbrakeapp.com"
         notifier_version: "3.0.2"
           params_filters: ["password", "password_confirmation"]
             project_root: #<Pathname:/Volumes/Kisko/project/code>
                     port: 80
                 protocol: "http"
               proxy_host: nil
               proxy_pass: nil
               proxy_port: nil
               proxy_user: nil
                   secure: false
                framework: "Rails: 3.0.9"
         user_information: "Airbrake Error {{error_id}}"
   rescue_rake_exceptions: nil
Setting up the Controller.
Processing request.


Started GET "/verify" for  at 2011-09-02 16:53:19 +0300

ActionController::RoutingError (No route matches "/verify"):

Before that I have added gem "airbrake", "3.0.2" to Gemfile & run bundle & run script/rails generate airbrake --api-key [my-api-key].

What could cause this kind of behaviour?

Undocumented dependency on i18n gem when activesupport >= 3.0 is used

Activesupport 3 doesnt list i18n as a dependency because it's not activated unless active_support/core_ext is imported. This means that an import of airbrake after including it in a project Gemfile that does not already use activesupport will cause a LoadError, triggering an attempt to load 'activesupport' which will also fail.

This is quite confusing as it makes it look like the airbrake gem requires activesupport 2 rather than showing that i18n merely needs to be added to the bundle.

I'm not sure whether it makes sense to add i18n as a dependency of airbrake (probably not), but it should at least be called out somewhere in the documentation for usage for non-rails apps.

Use faraday to allow EM HTTP backends

I've run into a case where I have an EventMachine app that doesn't want to block while delivering Airbrake notices. Normally, I fix this by queuing the notice. However, this app is very thin and doesn't require messaging for anything else. It would be really heavy to run queueing infrastructure just for the occasional exception notice.

The obvious solution is for Airbrake to use faraday so that the backend can be switched from net_http to em-synchrony. However, this introduces a dependency that you may be trying to avoid. Is that the case or would you accept a patch?

rescue_action_in_public_without_airbrake not being called

I need some help with this rescue_action_in_public_without_airbrake method.

In my application controller, I have

def render_500
    render :template => "shared/500", :layout => 'application', :status => 500
end

def rescue_action_in_public_without_airbrake(exception)
    render_500
end

Exceptions are logged in airbrake just fine, but looks like rescue_action_in_public_without_airbrake is never called.

What am I missing?

'RAILS_ENV' in rake task

Hi,

The rails environment is missing inside the 'airbrake:deploy' rake task. In lib/airbrake/capistrano.rb I would add RAILS_ENV=#{rails_env} at the end of line 17. Does that sound right?

Thanks,
Bastien

new gem release please

It's been a while since an airbrake gem has been released. I think with the changes that have happened to head that a new release ought to happen soon. How about it? I especially want this commit which I believe has been merged.

Async notifications

I'd like to use airbrake notifications for successful requests (i.e. alert us for cases where an underlying component failed, but we have an appropriate fall-back response for the user). Since airbrake requests are synchronous, this introduces considerable latency on the request.

A toggle for an async sender would be awesome.

Also, if this is something that isn't likely to be on the cards any time soon, what's the right approach to implement it myself? Implement a new Airbrake::Sender?

Airbrake.notify not working

Neither
Airbrake.notify(:error_class => "Special Error", :error_message => "Special Error: Yo!", :parameters => {})
nor
Airbrake.notify(:api_key => Airbrake.configuration.api_key, :error_class => "Special Error", :error_message => "Special Error: Yo!", :parameters => {})

work. It returns nil and there is no exception report in my account. On the other hand rake airbrake:test runs perfectly fine.

I even tried adding config.development_lookup = true just in case to the air brake initializer without success.

Deploy Capistrano task (airbrake:deploy) does not work when using RVM capistrano integration + Bundler

Specifically the generated command:

rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'ree-1.8.7-2011.12' -c 'cd /path/to/application/releases/20120208194411; rake RAILS_ENV=acceptance airbrake:deploy TO=acceptance REVISION=<GIT_SHA> [email protected]:<GIT_ACCOUNT>/<REPO>.git USER=<DEPLOY_USER>'

RVM is integrated into the deploy file as follows

$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require 'rvm/capistrano'
set(:rvm_ruby_string) { "#{rvm_ruby}@#{rvm_gemset}" }

Thanks

Rack exceptions do not consider ignored user agents

As the title suggests, exceptions rescued within the Rack middleware do not take the config.ignore_user_agent into account.

I'm currently working around this through the following (ugly) initializer patch, but hopefully a cleaner solution will make its way into an upcoming release.

module Airbrake
  class Notice
    alias :airbrake_ignore? :ignore?

    def ignore?
      user_agent = args[:rack_env] ? args[:rack_env]['HTTP_USER_AGENT'] : nil
      ignore_user_agent = Airbrake.configuration.ignore_user_agent.flatten.any? { |ua| ua === user_agent }

      ignore_user_agent || airbrake_ignore?
    end
  end
end

Log exception on endpoint failure

When hitting the failure conditional, all I get is something like:

[2012-03-12 15:35:31] ERROR:  ** [Airbrake] Failure: Net::HTTPBadGateway
[2012-03-12 15:35:31]  INFO:  ** [Airbrake] Environment Info: [Ruby: 1.9.3] [Rails: 3.1.4] [Env: staging]
[2012-03-12 15:35:31]  INFO:  ** [Airbrake] Response from Airbrake: 
...

This should probably include the exception or notice that originally was supposed to be sent to airbrake so that we can debug causes of failure even when airbrake is down/unresponsive

Using bundler while running 'deploy:notify_airbrake'

Hello!

Running deploy:notify_airbrake from within Capistrano should not invoke rake directly, but use bundle exec rake ....
Having both rake 0.9.2 and 0.8.7 installed and version 0.8.7 locked in Gemfile produces following error:

You have already activated rake 0.9.2, but your Gemfile requires rake 0.8.7. Consider using bundle exec.

Root of this issue was well described by Yehuda Katz.

Airbrake.notify doesn't work

I tested the following on 'rails console'.

  Airbrake.notify(
    :error_class   => "MailChimp Error",
    :error_message => "MailChimp Error: Failed to subscribe #{user.email}",
    :parameters    => {:result => result}
  ) 

It keeps returning nil. And I don't get any exception sent to Airbrake.

But when its running on Rails, the normal error messages all work and do get to Airbrake. What am I doing wrong?

Should use notify_or_ignore in Rake handler

Hi there -

We've run into an annoying issue with Airbrake when used in conjunction with Heroku and the Hirefire add-on. Basically Hirefire auto-scales your worker and web dynos in response to load and DelayedJob queue depth. It terminates the jobs using signals when load drops below a configurable threshold.

This produced a flood of SignalExceptions being emitted into our application's Airbrake project and overwhelmed our rate limit. I attempted to add SignalException to the list of ignored exceptions, but it did not have any effect.

After drilling in further, I found that this is because the Rake handler uses Airbrake.notify directly instead of Airbrake.notify_or_ignore, thus side-stepping the ignore configuration.

Pull request forthcoming that fixes this issue.

Cheers,
Blake

Encoding::CompatibilityError: incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string)

Airbrake is trying to pass a non-UTF8 encoded URL to Rails' escape_javascript method causing crash.
Arguably, the fix should be in Rails if it's providing the URL in this format in the first place.

lib/patches/javascript_helper.rb:9:in gsub' lib/patches/javascript_helper.rb:9:inescape_javascript'
[GEM_ROOT]/gems/airbrake-3.0.9/lib/templates/javascript_notifier.erb:13:in __mnt_apps_website_bundle_ruby_______gems_airbrake_______lib_templates_javascript_notifier_erb__542784891_120765660' [GEM_ROOT]/gems/actionpack-3.1.4/lib/action_view/template.rb:144:inblock in render'
[GEM_ROOT]/gems/activesupport-3.1.4/lib/active_support/notifications.rb:55:in instrument' [GEM_ROOT]/gems/actionpack-3.1.4/lib/action_view/template.rb:142:inrender'
[GEM_ROOT]/gems/newrelic_rpm-3.3.3/lib/new_relic/agent/method_tracer.rb:491:in block in render_with_trace_Custom_view_self_virtual_path_render' [GEM_ROOT]/gems/newrelic_rpm-3.3.3/lib/new_relic/agent/method_tracer.rb:242:intrace_execution_scoped'
[GEM_ROOT]/gems/newrelic_rpm-3.3.3/lib/new_relic/agent/method_tracer.rb:486:in render_with_trace_Custom_view_self_virtual_path_render' [GEM_ROOT]/gems/actionpack-3.1.4/lib/action_view/renderer/template_renderer.rb:40:inblock (2 levels) in render_template'
[GEM_ROOT]/gems/actionpack-3.1.4/lib/action_view/renderer/abstract_renderer.rb:33:in block in instrument' [GEM_ROOT]/gems/activesupport-3.1.4/lib/active_support/notifications.rb:53:inblock in instrument'
[GEM_ROOT]/gems/activesupport-3.1.4/lib/active_support/notifications/instrumenter.rb:21:in instrument' [GEM_ROOT]/gems/activesupport-3.1.4/lib/active_support/notifications.rb:53:ininstrument'
[GEM_ROOT]/gems/actionpack-3.1.4/lib/action_view/renderer/abstract_renderer.rb:33:in instrument' [GEM_ROOT]/gems/actionpack-3.1.4/lib/action_view/renderer/template_renderer.rb:39:inblock in render_template'
[GEM_ROOT]/gems/actionpack-3.1.4/lib/action_view/renderer/template_renderer.rb:47:in render_with_layout' [GEM_ROOT]/gems/actionpack-3.1.4/lib/action_view/renderer/template_renderer.rb:38:inrender_template'
[GEM_ROOT]/gems/actionpack-3.1.4/lib/action_view/renderer/template_renderer.rb:12:in block in render' [GEM_ROOT]/gems/actionpack-3.1.4/lib/action_view/renderer/abstract_renderer.rb:22:inwrap_formats'
[GEM_ROOT]/gems/actionpack-3.1.4/lib/action_view/renderer/template_renderer.rb:9:in render' [GEM_ROOT]/gems/actionpack-3.1.4/lib/action_view/renderer/renderer.rb:36:inrender_template'
[GEM_ROOT]/gems/actionpack-3.1.4/lib/action_view/renderer/renderer.rb:17:in render' [GEM_ROOT]/gems/actionpack-3.1.4/lib/abstract_controller/rendering.rb:120:in_render_template'
[GEM_ROOT]/gems/actionpack-3.1.4/lib/action_controller/metal/streaming.rb:250:in _render_template' [GEM_ROOT]/gems/actionpack-3.1.4/lib/abstract_controller/rendering.rb:114:inrender_to_body'
[GEM_ROOT]/gems/actionpack-3.1.4/lib/action_controller/metal/renderers.rb:30:in render_to_body' [GEM_ROOT]/gems/actionpack-3.1.4/lib/action_controller/metal/compatibility.rb:43:inrender_to_body'
[GEM_ROOT]/gems/actionpack-3.1.4/lib/abstract_controller/rendering.rb:107:in render_to_string' [GEM_ROOT]/gems/actionpack-3.1.4/lib/action_controller/metal/rendering.rb:23:inrender_to_string'
[GEM_ROOT]/gems/actionpack-3.1.4/lib/abstract_controller/helpers.rb:53:in `airbrake_javascript_notifier'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.