airbrake 3.1.6 → 11.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +7 -0
  2. data/lib/airbrake.rb +23 -150
  3. data/lib/airbrake/capistrano.rb +6 -42
  4. data/lib/airbrake/capistrano/capistrano2.rb +40 -0
  5. data/lib/airbrake/capistrano/capistrano3.rb +23 -0
  6. data/lib/airbrake/delayed_job.rb +66 -0
  7. data/lib/airbrake/logger.rb +103 -0
  8. data/lib/airbrake/rack.rb +30 -45
  9. data/lib/airbrake/rack/context_filter.rb +65 -0
  10. data/lib/airbrake/rack/http_headers_filter.rb +44 -0
  11. data/lib/airbrake/rack/http_params_filter.rb +27 -0
  12. data/lib/airbrake/rack/instrumentable.rb +136 -0
  13. data/lib/airbrake/rack/middleware.rb +102 -0
  14. data/lib/airbrake/rack/request_body_filter.rb +33 -0
  15. data/lib/airbrake/rack/request_store.rb +34 -0
  16. data/lib/airbrake/rack/route_filter.rb +51 -0
  17. data/lib/airbrake/rack/session_filter.rb +25 -0
  18. data/lib/airbrake/rack/user.rb +74 -0
  19. data/lib/airbrake/rack/user_filter.rb +25 -0
  20. data/lib/airbrake/rails.rb +25 -31
  21. data/lib/airbrake/rails/action_cable.rb +35 -0
  22. data/lib/airbrake/rails/action_cable/notify_callback.rb +22 -0
  23. data/lib/airbrake/rails/action_controller.rb +40 -0
  24. data/lib/airbrake/rails/action_controller_notify_subscriber.rb +32 -0
  25. data/lib/airbrake/rails/action_controller_performance_breakdown_subscriber.rb +51 -0
  26. data/lib/airbrake/rails/action_controller_route_subscriber.rb +33 -0
  27. data/lib/airbrake/rails/active_job.rb +50 -0
  28. data/lib/airbrake/rails/active_record.rb +36 -0
  29. data/lib/airbrake/rails/active_record_subscriber.rb +46 -0
  30. data/lib/airbrake/rails/app.rb +78 -0
  31. data/lib/airbrake/rails/backtrace_cleaner.rb +23 -0
  32. data/lib/airbrake/rails/curb.rb +32 -0
  33. data/lib/airbrake/rails/event.rb +81 -0
  34. data/lib/airbrake/rails/excon_subscriber.rb +25 -0
  35. data/lib/airbrake/rails/http.rb +14 -0
  36. data/lib/airbrake/rails/http_client.rb +16 -0
  37. data/lib/airbrake/rails/net_http.rb +18 -0
  38. data/lib/airbrake/rails/railtie.rb +151 -0
  39. data/lib/airbrake/rails/typhoeus.rb +16 -0
  40. data/lib/airbrake/rake.rb +65 -0
  41. data/lib/airbrake/rake/tasks.rb +112 -0
  42. data/lib/airbrake/resque.rb +61 -0
  43. data/lib/airbrake/shoryuken.rb +54 -0
  44. data/lib/airbrake/sidekiq.rb +55 -0
  45. data/lib/airbrake/sidekiq/retryable_jobs_filter.rb +53 -0
  46. data/lib/airbrake/sneakers.rb +72 -0
  47. data/lib/airbrake/version.rb +5 -1
  48. data/lib/generators/airbrake_generator.rb +25 -0
  49. data/lib/generators/airbrake_initializer.rb.erb +80 -0
  50. metadata +206 -259
  51. data/CHANGELOG +0 -944
  52. data/Gemfile +0 -3
  53. data/Guardfile +0 -6
  54. data/INSTALL +0 -20
  55. data/MIT-LICENSE +0 -22
  56. data/README.md +0 -556
  57. data/README_FOR_HEROKU_ADDON.md +0 -94
  58. data/Rakefile +0 -223
  59. data/SUPPORTED_RAILS_VERSIONS +0 -38
  60. data/TESTING.md +0 -41
  61. data/airbrake.gemspec +0 -40
  62. data/bin/airbrake +0 -12
  63. data/features/metal.feature +0 -18
  64. data/features/rack.feature +0 -60
  65. data/features/rails.feature +0 -272
  66. data/features/rails_with_js_notifier.feature +0 -97
  67. data/features/rake.feature +0 -27
  68. data/features/sinatra.feature +0 -29
  69. data/features/step_definitions/file_steps.rb +0 -10
  70. data/features/step_definitions/metal_steps.rb +0 -23
  71. data/features/step_definitions/rack_steps.rb +0 -23
  72. data/features/step_definitions/rails_application_steps.rb +0 -478
  73. data/features/step_definitions/rake_steps.rb +0 -17
  74. data/features/support/airbrake_shim.rb.template +0 -16
  75. data/features/support/env.rb +0 -18
  76. data/features/support/matchers.rb +0 -35
  77. data/features/support/rails.rb +0 -201
  78. data/features/support/rake/Rakefile +0 -68
  79. data/features/support/terminal.rb +0 -107
  80. data/features/user_informer.feature +0 -63
  81. data/generators/airbrake/airbrake_generator.rb +0 -94
  82. data/generators/airbrake/lib/insert_commands.rb +0 -34
  83. data/generators/airbrake/lib/rake_commands.rb +0 -24
  84. data/generators/airbrake/templates/airbrake_tasks.rake +0 -25
  85. data/generators/airbrake/templates/capistrano_hook.rb +0 -6
  86. data/generators/airbrake/templates/initializer.rb +0 -6
  87. data/install.rb +0 -1
  88. data/lib/airbrake/backtrace.rb +0 -108
  89. data/lib/airbrake/cli/client.rb +0 -68
  90. data/lib/airbrake/cli/options.rb +0 -41
  91. data/lib/airbrake/cli/printer.rb +0 -30
  92. data/lib/airbrake/cli/project.rb +0 -17
  93. data/lib/airbrake/cli/project_factory.rb +0 -36
  94. data/lib/airbrake/cli/runner.rb +0 -48
  95. data/lib/airbrake/cli/validator.rb +0 -8
  96. data/lib/airbrake/configuration.rb +0 -311
  97. data/lib/airbrake/extensions/blank.rb +0 -73
  98. data/lib/airbrake/notice.rb +0 -390
  99. data/lib/airbrake/rails/action_controller_catcher.rb +0 -30
  100. data/lib/airbrake/rails/controller_methods.rb +0 -87
  101. data/lib/airbrake/rails/error_lookup.rb +0 -33
  102. data/lib/airbrake/rails/javascript_notifier.rb +0 -47
  103. data/lib/airbrake/rails/middleware/exceptions_catcher.rb +0 -33
  104. data/lib/airbrake/rails3_tasks.rb +0 -98
  105. data/lib/airbrake/railtie.rb +0 -48
  106. data/lib/airbrake/rake_handler.rb +0 -71
  107. data/lib/airbrake/sender.rb +0 -128
  108. data/lib/airbrake/shared_tasks.rb +0 -47
  109. data/lib/airbrake/tasks.rb +0 -83
  110. data/lib/airbrake/user_informer.rb +0 -27
  111. data/lib/airbrake_tasks.rb +0 -64
  112. data/lib/rails/generators/airbrake/airbrake_generator.rb +0 -100
  113. data/lib/templates/javascript_notifier.erb +0 -15
  114. data/lib/templates/rescue.erb +0 -91
  115. data/rails/init.rb +0 -1
  116. data/resources/README.md +0 -34
  117. data/resources/ca-bundle.crt +0 -3376
  118. data/script/integration_test.rb +0 -38
  119. data/test/airbrake_2_3.xsd +0 -88
  120. data/test/airbrake_tasks_test.rb +0 -170
  121. data/test/backtrace_test.rb +0 -162
  122. data/test/capistrano_test.rb +0 -34
  123. data/test/catcher_test.rb +0 -333
  124. data/test/configuration_test.rb +0 -233
  125. data/test/helper.rb +0 -263
  126. data/test/javascript_notifier_test.rb +0 -51
  127. data/test/logger_test.rb +0 -79
  128. data/test/notice_test.rb +0 -490
  129. data/test/notifier_test.rb +0 -276
  130. data/test/rack_test.rb +0 -58
  131. data/test/rails_initializer_test.rb +0 -36
  132. data/test/recursion_test.rb +0 -10
  133. data/test/sender_test.rb +0 -288
  134. data/test/user_informer_test.rb +0 -29
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gemspec
data/Guardfile DELETED
@@ -1,6 +0,0 @@
1
- guard :test do
2
- watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
3
- watch(%r{^test/.+_test\.rb$})
4
- watch('test/helper.rb') { "test" }
5
- end
6
-
data/INSTALL DELETED
@@ -1,20 +0,0 @@
1
- === Configuration
2
-
3
- You should have something like this in config/initializers/airbrake.rb.
4
-
5
- Airbrake.configure do |config|
6
- config.api_key = '1234567890abcdef'
7
- end
8
-
9
- (Please note that this configuration should be in a global configuration, and
10
- is *not* environment-specific. Airbrake is smart enough to know what errors are
11
- caused by what environments, so your staging errors don't get mixed in with
12
- your production errors.)
13
-
14
- You can test that Airbrake is working in your production environment by using
15
- this rake task (from RAILS_ROOT):
16
-
17
- rake airbrake:test
18
-
19
- If everything is configured properly, that task will send a notice to Airbrake
20
- which will be visible immediately.
@@ -1,22 +0,0 @@
1
- Copyright (c) 2007 - 2012, Exceptional DBA Airbrake.io
2
-
3
- Permission is hereby granted, free of charge, to any person
4
- obtaining a copy of this software and associated documentation
5
- files (the "Software"), to deal in the Software without
6
- restriction, including without limitation the rights to use,
7
- copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the
9
- Software is furnished to do so, subject to the following
10
- conditions:
11
-
12
- The above copyright notice and this permission notice shall be
13
- included in all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
- OTHER DEALINGS IN THE SOFTWARE.
data/README.md DELETED
@@ -1,556 +0,0 @@
1
- Airbrake
2
- ========
3
-
4
- This is the notifier gem for integrating apps with [Airbrake](http://airbrake.io).
5
-
6
- When an uncaught exception occurs, Airbrake will POST the relevant data
7
- to the Airbrake server specified in your environment.
8
-
9
- Help
10
- ----
11
-
12
- For help with using Airbrake and this notifier visit [our support site](http://help.airbrake.io).
13
-
14
- For SSL verification see the [Resources](https://github.com/airbrake/airbrake/blob/master/resources/README.md).
15
-
16
- Rails Installation
17
- ------------------
18
-
19
- ### Rails 3.x
20
-
21
- Add the airbrake gem to your Gemfile. In Gemfile:
22
-
23
- gem "airbrake"
24
-
25
- Then from your project's RAILS_ROOT, and in your development environment, run:
26
-
27
- bundle install
28
- rails generate airbrake --api-key your_key_here
29
-
30
- That's it!
31
-
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
-
34
- ### Rails 2.x
35
-
36
- Add the airbrake gem to your app. In config/environment.rb:
37
-
38
- config.gem 'airbrake'
39
-
40
- or if you are using bundler:
41
-
42
- gem 'airbrake', :require => 'airbrake/rails'
43
-
44
- Then from your project's RAILS_ROOT, and in your development environment, run:
45
-
46
- rake gems:install
47
- rake gems:unpack GEM=airbrake
48
- script/generate airbrake --api-key your_key_here
49
-
50
- As always, if you choose not to vendor the airbrake gem, make sure
51
- every server you deploy to has the gem installed or your application won't start.
52
-
53
- 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
-
55
- ### Upgrading From Earlier Versions of Airbrake
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
250
- ------------------------
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
-
391
- Filtering
392
- ---------
393
-
394
- You can specify a whitelist of errors that Airbrake will not report on. Use
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
492
- ------------------------
493
-
494
- See SUPPORTED_RAILS_VERSIONS for a list of official supported versions of
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>
521
-
522
- This helper will automatically use the API key, host, and port specified in the configuration.
523
-
524
- The Javascript notifier tends to send much more notifications than the base Rails project.
525
- If you want to receive them into a separate Airbrake project, specify its
526
- API key in the `js_api_key` option.
527
-
528
- config.js_api_key = 'another-projects-api-key'
529
-
530
- To test the Javascript notifier in development environment, overwrite (temporarily) the development_environments option:
531
-
532
- Airbrake.configure do |config|
533
- # ...
534
- config.development_environments = []
535
- end
536
-
537
- Development
538
- -----------
539
-
540
- See TESTING.md for instructions on how to run the tests.
541
-
542
- Credits
543
- -------
544
-
545
- ![thoughtbot](http://thoughtbot.com/images/tm/logo.png)
546
-
547
- Airbrake is maintained and funded by [airbrake.io](http://airbrake.io)
548
-
549
- Thank you to all [the contributors](https://github.com/airbrake/airbrake/contributors)!
550
-
551
- The names and logos for Airbrake, thoughtbot are trademarks of their respective holders.
552
-
553
- License
554
- -------
555
-
556
- Airbrake is Copyright © 2008-2012 Airbrake. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.