airbrake 3.1.6 → 3.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +116 -0
- data/LICENSE +61 -0
- data/README.md +28 -478
- data/README_FOR_HEROKU_ADDON.md +13 -5
- data/Rakefile +26 -103
- data/TESTED_AGAINST +6 -0
- data/airbrake.gemspec +13 -14
- data/features/metal.feature +27 -12
- data/features/rack.feature +59 -59
- data/features/rails.feature +79 -100
- data/features/rails_with_js_notifier.feature +9 -21
- data/features/rake.feature +6 -4
- data/features/sinatra.feature +32 -6
- data/features/step_definitions/file_steps.rb +4 -0
- data/features/step_definitions/rack_steps.rb +9 -5
- data/features/step_definitions/rails_application_steps.rb +46 -278
- data/features/step_definitions/rake_steps.rb +16 -11
- data/features/support/airbrake_shim.rb.template +0 -2
- data/features/support/aruba.rb +5 -0
- data/features/support/env.rb +12 -6
- data/features/support/rails.rb +30 -73
- data/features/support/rake/Rakefile +1 -2
- data/features/user_informer.feature +12 -19
- data/generators/airbrake/airbrake_generator.rb +1 -1
- data/lib/airbrake.rb +9 -8
- data/lib/airbrake/cli/project_factory.rb +6 -3
- data/lib/airbrake/configuration.rb +7 -0
- data/lib/airbrake/notice.rb +52 -3
- data/lib/airbrake/rack.rb +16 -7
- data/lib/airbrake/rails/action_controller_catcher.rb +5 -3
- data/lib/airbrake/rails/controller_methods.rb +6 -6
- data/lib/airbrake/rails/error_lookup.rb +4 -2
- data/lib/airbrake/rails/javascript_notifier.rb +7 -3
- data/lib/airbrake/rails/middleware.rb +65 -0
- data/lib/airbrake/rails3_tasks.rb +16 -21
- data/lib/airbrake/railtie.rb +9 -16
- data/lib/airbrake/rake_handler.rb +2 -2
- data/lib/airbrake/sender.rb +57 -6
- data/lib/airbrake/shared_tasks.rb +24 -11
- data/lib/airbrake/sinatra.rb +34 -0
- data/lib/airbrake/user_informer.rb +9 -0
- data/lib/airbrake/version.rb +1 -1
- data/lib/rails/generators/airbrake/airbrake_generator.rb +10 -10
- data/{test/airbrake_2_3.xsd → resources/airbrake_2_4.xsd} +1 -0
- data/resources/airbrake_3_0.json +52 -0
- data/test/catcher_test.rb +198 -240
- data/test/configuration_test.rb +2 -0
- data/test/helper.rb +123 -53
- data/test/notice_test.rb +45 -1
- data/test/sender_test.rb +63 -32
- metadata +60 -79
- data/MIT-LICENSE +0 -22
- data/SUPPORTED_RAILS_VERSIONS +0 -38
- data/TESTING.md +0 -41
- data/features/step_definitions/metal_steps.rb +0 -23
- data/features/support/terminal.rb +0 -107
- data/lib/airbrake/extensions/blank.rb +0 -73
- data/lib/airbrake/rails/middleware/exceptions_catcher.rb +0 -33
data/CHANGELOG
CHANGED
@@ -1,3 +1,118 @@
|
|
1
|
+
Version 3.1.7 - 2013-01-28 13:35:10 +0100
|
2
|
+
===============================================================================
|
3
|
+
|
4
|
+
Adam Duke (1):
|
5
|
+
fix an error if not using ActionController::Base
|
6
|
+
|
7
|
+
Ben Arent (2):
|
8
|
+
Update to Readme.md
|
9
|
+
2013! woot.
|
10
|
+
|
11
|
+
Cory Kaufman-Schofield (1):
|
12
|
+
Use https for rake airbrake:test if force_ssl set to true (fixes #145)
|
13
|
+
|
14
|
+
Dmitry Medvinsky (1):
|
15
|
+
Fix notifier API URL as per Airbrake docs
|
16
|
+
|
17
|
+
George Ogata (1):
|
18
|
+
Ignore ActionController::UnknownHttpMethod by default.
|
19
|
+
|
20
|
+
Hrvoje Šimić (59):
|
21
|
+
move dependencies from Gemfile
|
22
|
+
CI test only for 3.0.0 for now
|
23
|
+
use appraisal
|
24
|
+
use aruba instead of home-grown terminal
|
25
|
+
fix *ALL* the tests!
|
26
|
+
remove bundler version
|
27
|
+
support all major rails versions for now
|
28
|
+
add bundler dependency
|
29
|
+
destroy rvmrc
|
30
|
+
update appraisals
|
31
|
+
add task for bundling bundler
|
32
|
+
remove gemfile locks
|
33
|
+
update appraisals
|
34
|
+
clean up README
|
35
|
+
logo is not needed in README
|
36
|
+
update the integration tests
|
37
|
+
update testing instructions
|
38
|
+
use CircleCI for continuous integration
|
39
|
+
update rake default task
|
40
|
+
mark heroku tests as wip for now
|
41
|
+
Clean up the rake task
|
42
|
+
stop cluttering STDOUT with trace of rake tasks
|
43
|
+
update supported rails versions
|
44
|
+
send framework info
|
45
|
+
use specific version of builder
|
46
|
+
update appraisals
|
47
|
+
revert "use specific version of builder"
|
48
|
+
remove hard dependency on girl_friday
|
49
|
+
update thoughtbot logo
|
50
|
+
update test suite to newer Rails versions
|
51
|
+
unfreezing version
|
52
|
+
More description about development environments
|
53
|
+
make sure we don't set env["airbrake.error_id"] for async notices
|
54
|
+
stop extending Object, use ActiveSupport instead
|
55
|
+
blank? instead of nil? || empty?
|
56
|
+
move XSD schema to resources
|
57
|
+
enable sending to new JSON API (#163)
|
58
|
+
define headers in Sender
|
59
|
+
ignore gemfile.locks
|
60
|
+
make sending to new JSON API disabled by default (#163)
|
61
|
+
don't use named groups in regexes, they are ruby 1.9 only (#162)
|
62
|
+
make sure we close the body even if exception occurs (closes #153)
|
63
|
+
Rails::Application::Configuration.force_ssl is undefined for Rails 3.0.x
|
64
|
+
update the test suite
|
65
|
+
update the default rake task
|
66
|
+
add the ability to pass a single feature to rake test task
|
67
|
+
tests support Rack::BodyProxy now
|
68
|
+
use rails 4 compatible routes in tests
|
69
|
+
remove unnecessary local variables
|
70
|
+
stop with monkeypatchig of Rails exception middleware
|
71
|
+
style fixes
|
72
|
+
require the new middleware in tests
|
73
|
+
better handler for adding Heroku deploy hooks (#167)
|
74
|
+
support multiple apps in Heroku deploy hooks task (#166)
|
75
|
+
read every available parameter for deploy hook from ENV (#168)
|
76
|
+
fallback to reading API key from ENV for deploy hooks
|
77
|
+
freshen up Heroku readme
|
78
|
+
set username and revision from Heroku variables (#168)
|
79
|
+
automatically get remote origin for deploy hooks (#168)
|
80
|
+
|
81
|
+
Joel Friedlaender (1):
|
82
|
+
configuring development environments
|
83
|
+
|
84
|
+
Jon Evans (1):
|
85
|
+
Use "get" instead of "match" for verify route
|
86
|
+
|
87
|
+
Josh Goebel (1):
|
88
|
+
clean_rack_request_data should also filter out "action_dispatch.secret_token" to prevent passing a Rails applications secret token
|
89
|
+
|
90
|
+
Kyle Wilkinson (1):
|
91
|
+
Fix broken gemspec with missing file names. MIT-LICENSE is now just called LICENSE and there is no TESTING.md
|
92
|
+
|
93
|
+
Manuel Meurer (1):
|
94
|
+
Use Airbrake.notify_or_ignore instead of just Airbrake.notify in notify_airbrake controller method
|
95
|
+
|
96
|
+
Marko Šiftar (3):
|
97
|
+
better Sinatra handling
|
98
|
+
fix typo
|
99
|
+
add framework info for Sinatra and Rack
|
100
|
+
|
101
|
+
Morgan Mikel McDaris (3):
|
102
|
+
fixed the heroku airbrake.rb generation
|
103
|
+
fixed the heroku airbrake.rb generation
|
104
|
+
made supported versions into a link
|
105
|
+
|
106
|
+
Pedro Nascimento (1):
|
107
|
+
Allow virtual attributes to be used in user data instead of just attributes.
|
108
|
+
|
109
|
+
Ryan Souza (1):
|
110
|
+
Prettier rake exception actions
|
111
|
+
|
112
|
+
cielavenir (1):
|
113
|
+
airbrake_javascript_notifier_options should be externalized
|
114
|
+
|
115
|
+
|
1
116
|
Version 3.1.6 - 2012-10-23 21:15:50 +0200
|
2
117
|
===============================================================================
|
3
118
|
|
@@ -942,3 +1057,4 @@ Nick Quaranto (3):
|
|
942
1057
|
|
943
1058
|
|
944
1059
|
|
1060
|
+
|
data/LICENSE
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
This product includes jquery written by John Resig
|
2
|
+
and distributed under an MIT license.
|
3
|
+
See https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt
|
4
|
+
|
5
|
+
Copyright (c) 2011 John Resig, http://jquery.com/
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
8
|
+
a copy of this software and associated documentation files (the
|
9
|
+
"Software"), to deal in the Software without restriction, including
|
10
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
11
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
+
permit persons to whom the Software is furnished to do so, subject to
|
13
|
+
the following conditions:
|
14
|
+
|
15
|
+
The above copyright notice and this permission notice shall be
|
16
|
+
included in all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
22
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
23
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
24
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
25
|
+
|
26
|
+
|
27
|
+
All other components of this product are
|
28
|
+
Copyright (c) 2007-2013 Exceptional Software Inc DBA Airbrake.io. All rights reserved.
|
29
|
+
|
30
|
+
Subject to the terms of this notice, Exceptional Software Inc grants you a
|
31
|
+
nonexclusive, nontransferable license, without the right to
|
32
|
+
sublicense, to (a) install and execute one copy of these files on any
|
33
|
+
number of workstations owned or controlled by you and (b) distribute
|
34
|
+
verbatim copies of these files to third parties. As a condition to the
|
35
|
+
foregoing grant, you must provide this notice along with each copy you
|
36
|
+
distribute and you must not remove, alter, or obscure this notice. All
|
37
|
+
other use, reproduction, modification, distribution, or other
|
38
|
+
exploitation of these files is strictly prohibited, except as may be set
|
39
|
+
forth in a separate written license agreement between you and Exceptional
|
40
|
+
Software Inc. The terms of any such license agreement will control over this
|
41
|
+
notice. The license stated above will be automatically terminated and
|
42
|
+
revoked if you exceed its scope or violate any of the terms of this
|
43
|
+
notice.
|
44
|
+
|
45
|
+
This License does not grant permission to use the trade names,
|
46
|
+
trademarks, service marks, or product names of Exceptional Software Inc,
|
47
|
+
DBA Airbrake, Exceptional, Airbrake.io, Exceptional.io except as
|
48
|
+
required for reasonable and customary use in describing the origin
|
49
|
+
of this file and reproducing the content of this notice. You may
|
50
|
+
not mark or brand this file with any trade name, trademarks,
|
51
|
+
servicemarks, or product names other than the original brand
|
52
|
+
(if any)provided by Exceptional.
|
53
|
+
|
54
|
+
Unless otherwise expressly agreed by Exceptional Software Inc, in a
|
55
|
+
separate written license agreement, these files are provided AS IS,
|
56
|
+
WITHOUT WARRANTY OF ANY KIND, including without any implied warranties
|
57
|
+
of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, or NON-INFRINGEMENT.
|
58
|
+
As a condition to your use of these files, you are solely responsible for
|
59
|
+
such use. Exceptional Software Inc will have no liability to you for direct,
|
60
|
+
indirect, consequential, incidental, special, or punitive damages or
|
61
|
+
for lost profits or data.
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ Help
|
|
11
11
|
|
12
12
|
For help with using Airbrake and this notifier visit [our support site](http://help.airbrake.io).
|
13
13
|
|
14
|
-
For SSL verification see the [Resources](https://github.com/airbrake/airbrake/blob/master/resources/README.md).
|
14
|
+
For **SSL** verification see the [Resources](https://github.com/airbrake/airbrake/blob/master/resources/README.md).
|
15
15
|
|
16
16
|
Rails Installation
|
17
17
|
------------------
|
@@ -31,6 +31,15 @@ That's it!
|
|
31
31
|
|
32
32
|
The generator creates a file under `config/initializers/airbrake.rb` configuring Airbrake with your API key. This file should be checked into your version control system so that it is deployed to your staging and production environments.
|
33
33
|
|
34
|
+
The default behaviour of the gem is to only operate in Rails environments that are NOT **development**, **test** & **cucumber**.
|
35
|
+
|
36
|
+
You can change this by altering this array:
|
37
|
+
|
38
|
+
config.development_environments = ["development", "test", "cucumber", "custom"]
|
39
|
+
|
40
|
+
Set it to empty array and it will report errors on all environments.
|
41
|
+
|
42
|
+
|
34
43
|
### Rails 2.x
|
35
44
|
|
36
45
|
Add the airbrake gem to your app. In config/environment.rb:
|
@@ -52,499 +61,40 @@ every server you deploy to has the gem installed or your application won't start
|
|
52
61
|
|
53
62
|
The generator creates a file under `config/initializers/airbrake.rb` configuring Airbrake with your API key. This file should be checked into your version control system so that it is deployed to your staging and production environments.
|
54
63
|
|
55
|
-
|
56
|
-
|
57
|
-
If you're currently using the plugin version (if you have a
|
58
|
-
vendor/plugins/hoptoad_notifier directory, you are), you'll need to perform a
|
59
|
-
few extra steps when upgrading to the gem version.
|
60
|
-
|
61
|
-
Add the airbrake gem to your app. In config/environment.rb:
|
62
|
-
|
63
|
-
config.gem 'airbrake'
|
64
|
-
|
65
|
-
Remove the plugin:
|
66
|
-
|
67
|
-
rm -rf vendor/plugins/hoptoad_notifier
|
68
|
-
|
69
|
-
Make sure the following line DOES NOT appear in your ApplicationController file:
|
70
|
-
|
71
|
-
include HoptoadNotifier::Catcher
|
72
|
-
|
73
|
-
If it does, remove it. The new catcher is automatically included by the gem
|
74
|
-
version of Airbrake.
|
75
|
-
|
76
|
-
Before running the airbrake generator, you need to find your project's API key.
|
77
|
-
Log in to your account at airbrake.io, and click on the "Projects" button.
|
78
|
-
Then, find your project in the list, and click on its name. In the left-hand
|
79
|
-
column, you'll see an "Edit this project" button. Click on that to get your
|
80
|
-
project's API key. If you accidentally use your personal API auth_token,
|
81
|
-
you will get API key not found errors, and exceptions will not be stored
|
82
|
-
by the Airbrake service.
|
83
|
-
|
84
|
-
Then from your project's RAILS_ROOT, run:
|
85
|
-
|
86
|
-
rake gems:install
|
87
|
-
script/generate airbrake --api-key your_key_here
|
88
|
-
|
89
|
-
Once installed, you should vendor the airbrake gem.
|
90
|
-
|
91
|
-
rake gems:unpack GEM=airbrake
|
92
|
-
|
93
|
-
As always, if you choose not to vendor the airbrake gem, make sure
|
94
|
-
every server you deploy to has the gem installed or your application won't
|
95
|
-
start.
|
96
|
-
|
97
|
-
### Upgrading from Earlier Versions of the Hoptoad Gem (with config.gem)
|
98
|
-
|
99
|
-
If you're currently using the gem version of the hoptoad_notifier and have
|
100
|
-
a version of Rails that uses config.gem (in the 2.x series), there is
|
101
|
-
a step or two that you need to do to upgrade. First, you need to remove
|
102
|
-
the old version of the gem from vendor/gems:
|
103
|
-
|
104
|
-
rm -rf vendor/gems/hoptoad_notifier-X.X.X
|
105
|
-
|
106
|
-
Then you must remove the hoptoad_notifier_tasks.rake file from lib:
|
107
|
-
|
108
|
-
rm lib/tasks/hoptoad_notifier_tasks.rake
|
109
|
-
|
110
|
-
You can then continue to install normally. If you don't remove the rake file,
|
111
|
-
you will be unable to unpack this gem (Rails will think it's part of the
|
112
|
-
framework).
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
You can test that Airbrake is working in your production environment by using
|
117
|
-
this rake task (from RAILS_ROOT):
|
118
|
-
|
119
|
-
rake airbrake:test
|
120
|
-
|
121
|
-
If everything is configured properly, that task will send a notice to Airbrake
|
122
|
-
which will be visible immediately.
|
123
|
-
|
124
|
-
### Removing hoptoad_notifier
|
125
|
-
|
126
|
-
in your ApplicationController, REMOVE this line:
|
127
|
-
|
128
|
-
include HoptoadNotifiable
|
129
|
-
|
130
|
-
In your config/environment* files, remove all references to HoptoadNotifier
|
131
|
-
|
132
|
-
Remove the vendor/plugins/hoptoad_notifier directory.
|
133
|
-
|
134
|
-
### Remove hoptoad_notifier plugin
|
135
|
-
|
136
|
-
Remove the vendor/plugins/hoptoad_notifier directory before installing the gem, or run:
|
137
|
-
|
138
|
-
script/plugin remove hoptoad_notifier
|
139
|
-
|
140
|
-
Non-rails apps using Bundler
|
141
|
-
----------------------------
|
142
|
-
There is an undocumented dependency in `activesupport` where the `i18n` gem is
|
143
|
-
required only if the core classes extensions are used (`active_support/core_ext`).
|
144
|
-
This can lead to a confusing `LoadError` exception when using Airbrake. Until
|
145
|
-
this is fixed in `activesupport` the workaround is to add `i18n` to the Gemfile
|
146
|
-
for your Sinatra/Rack/pure ruby application:
|
147
|
-
|
148
|
-
gem 'i18n'
|
149
|
-
gem 'airbrake'
|
150
|
-
|
151
|
-
Rack
|
152
|
-
----
|
153
|
-
|
154
|
-
In order to use airbrake in a non-Rails rack app, just load
|
155
|
-
airbrake, configure your API key, and use the Airbrake::Rack
|
156
|
-
middleware:
|
157
|
-
|
158
|
-
require 'rack'
|
159
|
-
require 'airbrake'
|
160
|
-
|
161
|
-
Airbrake.configure do |config|
|
162
|
-
config.api_key = 'my_api_key'
|
163
|
-
end
|
164
|
-
|
165
|
-
app = Rack::Builder.app do
|
166
|
-
run lambda { |env| raise "Rack down" }
|
167
|
-
end
|
168
|
-
|
169
|
-
use Airbrake::Rack
|
170
|
-
run app
|
171
|
-
|
172
|
-
Sinatra
|
173
|
-
-------
|
174
|
-
|
175
|
-
Using airbrake in a Sinatra app is just like a Rack app:
|
176
|
-
|
177
|
-
require 'sinatra'
|
178
|
-
require 'airbrake'
|
179
|
-
|
180
|
-
Airbrake.configure do |config|
|
181
|
-
config.api_key = 'my api key'
|
182
|
-
end
|
183
|
-
|
184
|
-
use Airbrake::Rack
|
185
|
-
|
186
|
-
get '/' do
|
187
|
-
raise "Sinatra has left the building"
|
188
|
-
end
|
189
|
-
|
190
|
-
Usage
|
191
|
-
-----
|
192
|
-
|
193
|
-
For the most part, Airbrake works for itself.
|
194
|
-
|
195
|
-
It intercepts the exception middleware calls, sends notifications and continues the middleware call chain.
|
196
|
-
|
197
|
-
If you want to log arbitrary things which you've rescued yourself from a
|
198
|
-
controller, you can do something like this:
|
199
|
-
|
200
|
-
...
|
201
|
-
rescue => ex
|
202
|
-
notify_airbrake(ex)
|
203
|
-
flash[:failure] = 'Encryptions could not be rerouted, try again.'
|
204
|
-
end
|
205
|
-
...
|
206
|
-
|
207
|
-
The `#notify_airbrake` call will send the notice over to Airbrake for later
|
208
|
-
analysis. While in your controllers you use the `notify_airbrake` method, anywhere
|
209
|
-
else in your code, use `Airbrake.notify`.
|
210
|
-
|
211
|
-
To perform custom error processing after Airbrake has been notified, define the
|
212
|
-
instance method `#rescue_action_in_public_without_airbrake(exception)` in your
|
213
|
-
controller.
|
214
|
-
|
215
|
-
Rake Tasks
|
216
|
-
----------
|
217
|
-
Do you want Airbrake to report exceptions that happen inside a rake task?
|
218
|
-
|
219
|
-
Airbrake.configure do |config|
|
220
|
-
...
|
221
|
-
config.rescue_rake_exceptions = true
|
222
|
-
end
|
223
|
-
|
224
|
-
Informing the User
|
225
|
-
------------------
|
226
|
-
|
227
|
-
The airbrake gem is capable of telling the user information about the error that just happened
|
228
|
-
via the user_information option. They can give this error number in bug reports, for example.
|
229
|
-
By default, if your 500.html contains the text
|
230
|
-
|
231
|
-
<!-- AIRBRAKE ERROR -->
|
232
|
-
|
233
|
-
then that comment will be replaced with the text "Airbrake Error [errnum]". You can modify the text
|
234
|
-
of the informer by setting `config.user_information`. Airbrake will replace "{{ error_id }}" with the
|
235
|
-
ID of the error that is returned from Airbrake.
|
236
|
-
|
237
|
-
Airbrake.configure do |config|
|
238
|
-
...
|
239
|
-
config.user_information = "<p>Tell the devs that it was <strong>{{ error_id }}</strong>'s fault.</p>"
|
240
|
-
end
|
241
|
-
|
242
|
-
You can also turn the middleware that handles this completely off by setting `config.user_information` to false.
|
243
|
-
|
244
|
-
Note that this feature is reading the error id from `env['airbrake.error_id']`. When the exception is caught
|
245
|
-
automatically in a controller, Airbrake sets that value. If you're, however, calling the Airbrake methods like
|
246
|
-
`Airbrake#notify` or `Airbrake#notify_or_ignore`, please make sure you set that value. So the proper way of calling the
|
247
|
-
"manual" methods would be `env['airbrake.error_id'] = Airbrake.notify_or_ignore(...)`.
|
248
|
-
|
249
|
-
Current user information
|
64
|
+
Supported frameworks
|
250
65
|
------------------------
|
251
|
-
Airbrake provides information about the current logged in user, so you
|
252
|
-
can easily determine the user who experienced the error in your app.
|
253
|
-
|
254
|
-
It uses `current_user` and `current_member` to identify the
|
255
|
-
authenticated user, where `current_user` takes precendence.
|
256
|
-
|
257
|
-
If you use different naming, please add the following lines to your
|
258
|
-
controller:
|
259
|
-
|
260
|
-
alias_method :current_duck, :current_user
|
261
|
-
helper_method :current_duck
|
262
|
-
|
263
|
-
Voila! You'll get information about a duck that experienced a crash of
|
264
|
-
your app.
|
265
|
-
|
266
|
-
By default Airbrake collects the following attributes:
|
267
|
-
* id
|
268
|
-
* name
|
269
|
-
* username
|
270
|
-
* email
|
271
|
-
|
272
|
-
You can also customize attributes that will be collected
|
273
|
-
|
274
|
-
Airbrake.configure do |config|
|
275
|
-
...
|
276
|
-
# collect only user ids
|
277
|
-
config.user_attributes = [:id] # ["id"] also works
|
278
|
-
end
|
279
|
-
|
280
|
-
Asynchronous notifications with Airbrake
|
281
|
-
----------------------------------------
|
282
|
-
When your user experiences error using your application, it gets sent to
|
283
|
-
Airbrake server. This introduces a considerable latency in the response.
|
284
|
-
|
285
|
-
Asynchronous notification sending deals with this problem. Airbrake uses
|
286
|
-
[girl_friday](https://github.com/mperham/girl_friday) to achieve this
|
287
|
-
. (thanks Mike)
|
288
|
-
|
289
|
-
It's disabled by default and you can enable it in your Airbrake
|
290
|
-
configuration.
|
291
|
-
|
292
|
-
Airbrake.configure do |config|
|
293
|
-
...
|
294
|
-
config.async = true
|
295
|
-
end
|
296
|
-
|
297
|
-
*Note that this feature is enabled with JRuby 1.6+, Rubinius 2.0+ and*
|
298
|
-
*Ruby 1.9+. It does not support Ruby 1.8 because of its poor threading*
|
299
|
-
*support.*
|
300
|
-
|
301
|
-
For implementing custom asynchronous notice delivery, send a block to `config.async`. It
|
302
|
-
receives `notice` param. Pass it to `Airbrake.sender.send_to_airbrake` method
|
303
|
-
to do actual delivery. In this way it's possible to move Airbrake notification
|
304
|
-
even in background worker(e.g. Resque or Sidekiq).
|
305
|
-
|
306
|
-
# Thread-based asynchronous send
|
307
|
-
Airbrake.configure do |config|
|
308
|
-
...
|
309
|
-
config.async do |notice|
|
310
|
-
Thread.new { Airbrake.sender.send_to_airbrake(notice) }
|
311
|
-
end
|
312
|
-
end
|
313
|
-
|
314
|
-
# Resque-like configuration
|
315
|
-
Airbrake.configure do |config|
|
316
|
-
...
|
317
|
-
config.async do |notice|
|
318
|
-
Resque.enqueue(AirbrakeDeliveryWorker, notice)
|
319
|
-
end
|
320
|
-
end
|
321
|
-
|
322
|
-
Tracking deployments in Airbrake
|
323
|
-
--------------------------------
|
324
|
-
|
325
|
-
Paying Airbrake plans support the ability to track deployments of your application in Airbrake.
|
326
|
-
By notifying Airbrake of your application deployments, all errors are resolved when a deploy occurs,
|
327
|
-
so that you'll be notified again about any errors that reoccur after a deployment.
|
328
|
-
|
329
|
-
Additionally, it's possible to review the errors in Airbrake that occurred before and after a deploy.
|
330
|
-
|
331
|
-
When Airbrake is installed as a gem, you need to add
|
332
|
-
|
333
|
-
require 'airbrake/capistrano'
|
334
|
-
|
335
|
-
to your deploy.rb
|
336
|
-
|
337
|
-
If you don't use Capistrano, then you can use the following rake task from your
|
338
|
-
deployment process to notify Airbrake:
|
339
|
-
|
340
|
-
rake airbrake:deploy TO=#{rails_env} REVISION=#{current_revision} REPO=#{repository} USER=#{local_user}
|
341
|
-
|
342
|
-
Going beyond exceptions
|
343
|
-
-----------------------
|
344
|
-
|
345
|
-
You can also pass a hash to `Airbrake.notify` method and store whatever you want,
|
346
|
-
not just an exception. And you can also use it anywhere, not just in
|
347
|
-
controllers:
|
348
|
-
|
349
|
-
begin
|
350
|
-
params = {
|
351
|
-
# params that you pass to a method that can throw an exception
|
352
|
-
}
|
353
|
-
my_unpredicable_method(params)
|
354
|
-
rescue => e
|
355
|
-
Airbrake.notify_or_ignore(
|
356
|
-
:error_class => "Special Error",
|
357
|
-
:error_message => "Special Error: #{e.message}",
|
358
|
-
:parameters => params
|
359
|
-
)
|
360
|
-
end
|
361
|
-
|
362
|
-
While in your controllers you use the `notify_airbrake` method, anywhere else in
|
363
|
-
your code, use `Airbrake.notify`. Airbrake will get all the information
|
364
|
-
about the error itself. As for a hash, these are the keys you should pass:
|
365
|
-
|
366
|
-
* `:error_class` - Use this to group similar errors together. When Airbrake catches an exception it sends the class name of that exception object.
|
367
|
-
* `:error_message` - This is the title of the error you see in the errors list. For exceptions it is "#{exception.class.name}: #{exception.message}"
|
368
|
-
* `:parameters` - While there are several ways to send additional data to Airbrake, passing a Hash as :parameters as in the example above is the most common use case. When Airbrake catches an exception in a controller, the actual HTTP client request parameters are sent using this key.
|
369
|
-
|
370
|
-
Airbrake merges the hash you pass with these default options:
|
371
|
-
|
372
|
-
{
|
373
|
-
:api_key => Airbrake.api_key,
|
374
|
-
:error_message => 'Notification',
|
375
|
-
:backtrace => caller,
|
376
|
-
:parameters => {},
|
377
|
-
:session => {}
|
378
|
-
}
|
379
|
-
|
380
|
-
You can override any of those parameters.
|
381
|
-
|
382
|
-
### Sending shell environment variables when "Going beyond exceptions"
|
383
|
-
|
384
|
-
One common request we see is to send shell environment variables along with
|
385
|
-
manual exception notification. We recommend sending them along with CGI data
|
386
|
-
or Rack environment (:cgi_data or :rack_env keys, respectively.)
|
387
|
-
|
388
|
-
See Airbrake::Notice#initialize in lib/airbrake/notice.rb for
|
389
|
-
more details.
|
390
66
|
|
391
|
-
|
392
|
-
---------
|
67
|
+
See **[TESTED_AGAINST](https://github.com/airbrake/airbrake/blob/master/TESTED_AGAINST)** for a full list of frameworks and versions we test against.
|
393
68
|
|
394
|
-
|
395
|
-
this feature when you are so apathetic to certain errors that you don't want
|
396
|
-
them even logged.
|
397
|
-
|
398
|
-
This filter will only be applied to automatic notifications, not manual
|
399
|
-
notifications (when #notify is called directly).
|
400
|
-
|
401
|
-
Airbrake ignores the following exceptions by default:
|
402
|
-
|
403
|
-
ActiveRecord::RecordNotFound
|
404
|
-
ActionController::RoutingError
|
405
|
-
ActionController::InvalidAuthenticityToken
|
406
|
-
CGI::Session::CookieStore::TamperedWithCookie
|
407
|
-
ActionController::UnknownAction
|
408
|
-
AbstractController::ActionNotFound
|
409
|
-
Mongoid::Errors::DocumentNotFound
|
410
|
-
|
411
|
-
|
412
|
-
To ignore errors in addition to those, specify their names in your Airbrake
|
413
|
-
configuration block.
|
414
|
-
|
415
|
-
Airbrake.configure do |config|
|
416
|
-
config.api_key = '1234567890abcdef'
|
417
|
-
config.ignore << "ActiveRecord::IgnoreThisError"
|
418
|
-
end
|
419
|
-
|
420
|
-
To ignore *only* certain errors (and override the defaults), use the #ignore_only attribute.
|
421
|
-
|
422
|
-
Airbrake.configure do |config|
|
423
|
-
config.api_key = '1234567890abcdef'
|
424
|
-
config.ignore_only = ["ActiveRecord::IgnoreThisError"] # or [] to ignore no exceptions.
|
425
|
-
end
|
426
|
-
|
427
|
-
To ignore certain user agents, add in the #ignore_user_agent attribute as a
|
428
|
-
string or regexp:
|
429
|
-
|
430
|
-
Airbrake.configure do |config|
|
431
|
-
config.api_key = '1234567890abcdef'
|
432
|
-
config.ignore_user_agent << /Ignored/
|
433
|
-
config.ignore_user_agent << 'IgnoredUserAgent'
|
434
|
-
end
|
435
|
-
|
436
|
-
To ignore exceptions based on other conditions, use #ignore_by_filter:
|
437
|
-
|
438
|
-
Airbrake.configure do |config|
|
439
|
-
config.api_key = '1234567890abcdef'
|
440
|
-
config.ignore_by_filter do |exception_data|
|
441
|
-
true if exception_data[:error_class] == "RuntimeError"
|
442
|
-
end
|
443
|
-
end
|
444
|
-
|
445
|
-
To replace sensitive information sent to the Airbrake service with [FILTERED] use #params_filters:
|
446
|
-
|
447
|
-
Airbrake.configure do |config|
|
448
|
-
config.api_key = '1234567890abcdef'
|
449
|
-
config.params_filters << "credit_card_number"
|
450
|
-
end
|
451
|
-
|
452
|
-
Note that, when rescuing exceptions within an ActionController method,
|
453
|
-
airbrake will reuse filters specified by #filter_parameter_logging.
|
454
|
-
|
455
|
-
Testing
|
456
|
-
-------
|
457
|
-
|
458
|
-
When you run your tests, you might notice that the Airbrake service is recording
|
459
|
-
notices generated using #notify when you don't expect it to. You can
|
460
|
-
use code like this in your test_helper.rb or spec_helper.rb files to redefine
|
461
|
-
that method so those errors are not reported while running tests.
|
462
|
-
|
463
|
-
module Airbrake
|
464
|
-
def self.notify(exception, opts = {})
|
465
|
-
# do nothing.
|
466
|
-
end
|
467
|
-
end
|
468
|
-
|
469
|
-
Proxy Support
|
470
|
-
-------------
|
471
|
-
|
472
|
-
The notifier supports using a proxy, if your server is not able to directly reach the Airbrake servers. To configure the proxy settings, added the following information to your Airbrake configuration block.
|
473
|
-
|
474
|
-
Airbrake.configure do |config|
|
475
|
-
config.proxy_host = proxy.host.com
|
476
|
-
config.proxy_port = 4038
|
477
|
-
config.proxy_user = foo # optional
|
478
|
-
config.proxy_pass = bar # optional
|
479
|
-
|
480
|
-
Logging
|
481
|
-
------------
|
482
|
-
|
483
|
-
Airbrake uses the logger from your Rails application by default, presumably STDOUT. If you don't like Airbrake scribbling to your
|
484
|
-
standard output, just pass another `Logger` instance inside your configuration:
|
485
|
-
|
486
|
-
Airbrake.configure do |config|
|
487
|
-
...
|
488
|
-
config.logger = Logger.new("path/to/your/log/file")
|
489
|
-
end
|
490
|
-
|
491
|
-
Supported Rails versions
|
69
|
+
Airbrake wiki pages
|
492
70
|
------------------------
|
71
|
+
Our wiki contains a lot of additional information about Airbrake configuration. Please browse the wiki when finished reading this
|
72
|
+
README:
|
493
73
|
|
494
|
-
|
495
|
-
Rails.
|
496
|
-
|
497
|
-
Please open up a support ticket ( http://help.airbrake.io ) or submit a new github issue
|
498
|
-
if you're using a version of Rails that is listed above and the notifier is
|
499
|
-
not working properly.
|
500
|
-
|
501
|
-
Javascript Notifer
|
502
|
-
------------------
|
503
|
-
|
504
|
-
To automatically include the Javascript node on every page, use this helper method from your layouts:
|
505
|
-
|
506
|
-
<%= airbrake_javascript_notifier %>
|
507
|
-
|
508
|
-
It's important to insert this very high in the markup, above all other javascript. Example:
|
509
|
-
|
510
|
-
<!DOCTYPE html>
|
511
|
-
<html>
|
512
|
-
<head>
|
513
|
-
<meta charset="utf8">
|
514
|
-
<%= airbrake_javascript_notifier %>
|
515
|
-
<!-- more javascript -->
|
516
|
-
</head>
|
517
|
-
<body>
|
518
|
-
...
|
519
|
-
</body>
|
520
|
-
</html>
|
74
|
+
https://github.com/airbrake/airbrake/wiki
|
521
75
|
|
522
|
-
|
76
|
+
Development
|
77
|
+
-----------
|
523
78
|
|
524
|
-
|
525
|
-
If you want to receive them into a separate Airbrake project, specify its
|
526
|
-
API key in the `js_api_key` option.
|
79
|
+
We use [Appraisals](https://github.com/thoughtbot/appraisal) to run the tests.
|
527
80
|
|
528
|
-
|
81
|
+
To run the test suite on your machine, you need to run the following commands:
|
529
82
|
|
530
|
-
|
83
|
+
bundle
|
84
|
+
bundle exec rake appraisal:install
|
531
85
|
|
532
|
-
|
533
|
-
# ...
|
534
|
-
config.development_environments = []
|
535
|
-
end
|
86
|
+
After this, you're ready to run the suite with:
|
536
87
|
|
537
|
-
|
538
|
-
-----------
|
88
|
+
bundle exec rake
|
539
89
|
|
540
|
-
|
90
|
+
This will include cucumber features we use to fully test the integration.
|
541
91
|
|
542
92
|
Credits
|
543
93
|
-------
|
544
94
|
|
545
|
-
![thoughtbot](
|
95
|
+
![thoughtbot](https://secure.gravatar.com/avatar/a95a04df2dae60397c38c9bd04492c53)
|
546
96
|
|
547
|
-
Airbrake is maintained and funded by [airbrake.io](http://airbrake.io)
|
97
|
+
Airbrake is maintained and funded by [airbrake.io](http://airbrake.io).
|
548
98
|
|
549
99
|
Thank you to all [the contributors](https://github.com/airbrake/airbrake/contributors)!
|
550
100
|
|
@@ -553,4 +103,4 @@ The names and logos for Airbrake, thoughtbot are trademarks of their respective
|
|
553
103
|
License
|
554
104
|
-------
|
555
105
|
|
556
|
-
Airbrake is Copyright © 2008-2012 Airbrake.
|
106
|
+
Airbrake is Copyright © 2008-2012 Airbrake.
|