bugsnag 4.1.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 270f44756bef1cd0216474d1d63bed40fc4bfdb2
4
- data.tar.gz: c9848a9c9ab917581749ad1c1e5eb98b97c3c950
3
+ metadata.gz: 7108374ad36589c3f1f93ab360e5b44aa4c26931
4
+ data.tar.gz: a58b1d6d3b4947a1abd72d6cc39c4ef19a9f1ab1
5
5
  SHA512:
6
- metadata.gz: aa1811e86e5526cb984946fd2b8082bcdf5da3b48aaec1fc62e56f2396cd799b37a23fb35dad30baa771e4ae3824663b4a2551541e079e7ccb46aaa3f5812c1e
7
- data.tar.gz: 5fc7427a1f8475b38d8f599d73b624d71d69002c79806be5c133adc146bba0001c00778c0e548896870729c2971299156b2aea27e6965eecef076038784b18c7
6
+ metadata.gz: 4c835800cb05a0db5761f722617209c29db6d6cb798e60f39097a97a916771f682ca0f7ad659156d2e113d773d636e7801ddb2e964951c26fb7e4d12c91de029
7
+ data.tar.gz: 05cfe84b373975f308fe753b81e8d74a3cee221376d6e7feb6b65d2078cc22ddf05cd7da6ce4d445c37eb9932806d4744fd62202b471a11b49901fb302bceb0d
@@ -1,6 +1,14 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## 4.2.0 (17 Jun 2016)
5
+
6
+ ### Enhancements
7
+
8
+ * Add the name of the job class in context for Sidekiq and Resque errors
9
+ | [Johan Lundström](https://github.com/johanlunds)
10
+ | [#293](https://github.com/bugsnag/bugsnag-ruby/pull/293)
11
+
4
12
  ## 4.1.0 (11 May 2016)
5
13
 
6
14
  ### Enhancements
data/README.md CHANGED
@@ -1,353 +1,50 @@
1
- Bugsnag Notifier for Ruby <img src="https://travis-ci.org/bugsnag/bugsnag-ruby.svg?branch=master" alt="build status" class="build-status">
2
- =========================
1
+ # Bugsnag exception reporter for Ruby
2
+ [![build status](https://travis-ci.org/bugsnag/bugsnag-ruby.svg?branch=master)](https://travis-ci.org/bugsnag/bugsnag-ruby)
3
3
 
4
- The Bugsnag Notifier for Ruby gives you instant notification of exceptions
5
- thrown from your **Rails**, **Sinatra**, **Rack** or **plain Ruby** app.
4
+
5
+ The Bugsnag exception reporter for Ruby gives you instant notification of exceptions
6
+ thrown from your **[Rails](https://bugsnag.com/platforms/rails)**, **Sinatra**, **Rack** or **plain Ruby** app.
6
7
  Any uncaught exceptions will trigger a notification to be sent to your
7
8
  Bugsnag project.
8
9
 
9
- Capture Rails errors with Bugsnag's [Rails error monitoring](https://bugsnag.com/platforms/rails) solution. [Bugsnag](http://bugsnag.com) captures errors in real-time from your web,
10
- mobile and desktop applications, helping you to understand and resolve them
11
- as fast as possible. [Create a free account](http://bugsnag.com) to start
12
- capturing exceptions from your applications.
13
-
14
-
15
- Contents
16
- --------
17
-
18
- - [Getting Started](#getting-started)
19
- - [Installation](#installation)
20
- - [Rake Integration](#rake-integration)
21
- - [Sending a Test Notification](#sending-a-test-notification)
22
- - [Usage](#usage)
23
- - [Catching and Reporting Exceptions](#catching-and-reporting-exceptions)
24
- - [Sending Non-fatal Exceptions](#sending-non-fatal-exceptions)
25
- - [Deploy Tracking](#deploy-tracking)
26
- - [Callbacks](#callbacks)
27
- - [Configuration](https://github.com/bugsnag/bugsnag-ruby/tree/master/docs/Configuration.md)
28
- - [Notification Options](https://github.com/bugsnag/bugsnag-ruby/tree/master/docs/Notification Options.md)
29
- - [Demo Applications](#demo-applications)
30
- - [Support](#support)
31
- - [Contributing](#contributing)
32
- - [License](#license)
33
-
34
-
35
- Getting Started
36
- ---------------
37
-
38
-
39
- ### Installation
40
-
41
- 1. Add the `bugsnag` gem to your `Gemfile`
42
-
43
- ```ruby
44
- gem "bugsnag"
45
- ```
46
-
47
- 2. Install the gem
48
-
49
- ```shell
50
- bundle install
51
- ```
52
-
53
- 3. Configure the Bugsnag module with your API key.
54
-
55
- **Rails**: Use our generator
56
-
57
- ```shell
58
- rails generate bugsnag YOUR_API_KEY_HERE
59
- ```
60
-
61
- **Other Ruby/Rack/Sinatra apps**: Put this snippet in your initialization.
62
-
63
- ```ruby
64
- Bugsnag.configure do |config|
65
- config.api_key = "YOUR_API_KEY_HERE"
66
- end
67
- ```
68
-
69
- The Bugsnag module will read the `BUGSNAG_API_KEY` environment variable if
70
- you do not configure one automatically.
71
-
72
- ### Rake Integration
73
-
74
- Rake integration is automatically enabled in Rails 3/4/5 apps, so providing you
75
- load the environment in your Rake tasks you dont need to do anything to get Rake
76
- support. If you choose not to load your environment, you can manually configure
77
- Bugsnag with a `bugsnag.configure` block in the Rakefile.
78
-
79
- Bugsnag can automatically notify of all exceptions that happen in your rake
80
- tasks. In order to enable this, you need to `require "bugsnag/rake"` in your
81
- Rakefile, like so:
82
-
83
- ```ruby
84
- require File.expand_path('../config/application', __FILE__)
85
- require 'rake'
86
- require "bugsnag/rake"
87
-
88
- Bugsnag.configure do |config|
89
- config.api_key = "YOUR_API_KEY_HERE"
90
- end
91
-
92
- YourApp::Application.load_tasks
93
- ```
94
-
95
- > Note: We also configure Bugsnag in the Rakefile, so the tasks that do not load
96
- > the full environment can still notify Bugsnag.
97
-
98
- ### Sending a Test Notification
99
-
100
- To test that bugsnag is properly configured, you can use the `test_exception`
101
- rake task:
102
-
103
- ```bash
104
- rake bugsnag:test_exception
105
- ```
106
-
107
- A test exception will be sent to your bugsnag dashboard if everything is
108
- configured correctly.
109
-
110
- Usage
111
- -----
112
-
113
- ### Catching and Reporting Exceptions
114
-
115
- Bugsnag Ruby works out of the box with Rails, Sidekiq, Resque, DelayedJob (3+),
116
- Mailman, Rake and Rack. It should be easy to add support for other frameworks,
117
- either by sending a pull request here or adding a hook to those projects.
118
-
119
- #### Rack/Sinatra Apps
120
-
121
- Activate the Bugsnag Rack middleware
122
-
123
- ```ruby
124
- use Bugsnag::Rack
125
- ```
126
-
127
- **Sinatra**: Note that `raise_errors` must be enabled. If you are
128
- using custom error handlers, then you will need to notify Bugsnag
129
- explicitly:
130
-
131
- ```ruby
132
- error 500 do
133
- Bugsnag.auto_notify($!)
134
- erb :"errors/500"
135
- end
136
- ```
137
-
138
- #### Custom Ruby Scripts
139
-
140
- **Custom Ruby Scripts**: If you are running a standard ruby script,
141
- you can ensure that all exceptions are sent to Bugsnag by adding
142
- the following code to your app:
143
-
144
- ```ruby
145
- at_exit do
146
- if $!
147
- Bugsnag.notify($!)
148
- end
149
- end
150
- ```
151
-
152
- #### EventMachine Apps
153
-
154
- If your app uses [EventMachine](http://rubyeventmachine.com/) you'll need to
155
- manually notify Bugsnag of errors. There are two ways to do this in your
156
- EventMachine apps, first you should implement `EventMachine.error_handler`:
157
-
158
- ```ruby
159
- EventMachine.error_handler{|e|
160
- Bugsnag.notify(e)
161
- }
162
- ```
163
-
164
- If you want more fine-grained error handling, you can use the
165
- [errback](http://eventmachine.rubyforge.org/EventMachine/Deferrable.html#errback-instance_method)
166
- function, for example:
167
-
168
- ```ruby
169
- EventMachine::run do
170
- server = EventMachine::start_server('0.0.0.0', PORT, MyServer)
171
- server.errback {
172
- EM.defer do
173
- Bugsnag.notify(RuntimeError.new("Something bad happened"))
174
- end
175
- }
176
- end
177
- ```
178
-
179
- For this to work, include [Deferrable](http://eventmachine.rubyforge.org/EventMachine/Deferrable.html)
180
- in your `MyServer`, then whenever you want to raise an error, call `fail`.
181
-
182
- ### Sending Non-fatal Exceptions
183
-
184
- If you would like to send non-fatal exceptions to Bugsnag, you can call
185
- `Bugsnag.notify`:
186
-
187
- ```ruby
188
- Bugsnag.notify(RuntimeError.new("Something broke"))
189
- ```
190
-
191
- Additional information can be attached to a notification using a configuration
192
- block:
193
-
194
- ```ruby
195
- Bugsnag.notify(RuntimeError.new("Something broke")) do |notif|
196
- notif.severity = 'warning'
197
- end
198
- ```
199
-
200
- The complete list of available properties is available in
201
- [the documentation for the `Notification` object](https://github.com/bugsnag/bugsnag-ruby/blob/master/docs/Notification%20Options.md#notification-object)
202
-
203
- ### Callbacks
204
-
205
- The Bugsnag Notifier for Ruby provides its own middleware system, similar to
206
- the one used in Rack applications. Middleware allows you to execute code
207
- before and after an exception is sent to bugsnag.com, so you can do things
208
- such as:
209
-
210
- - Send application-specific information along with exceptions, eg. the name
211
- of the currently logged in user,
212
- - Write exception information to your internal logging system.
213
-
214
- To make your own middleware, create a class that looks like this:
215
-
216
- ```ruby
217
- class MyMiddleware
218
- def initialize(bugsnag)
219
- @bugsnag = bugsnag
220
- end
221
-
222
- def call(notification)
223
- # Your custom "before notify" code
224
-
225
- @bugsnag.call(notification)
226
-
227
- # Your custom "after notify" code
228
- end
229
- end
230
- ```
231
-
232
- You can then add your middleware to the middleware stack as follows:
233
-
234
- ```ruby
235
- Bugsnag.configure do |config|
236
- config.middleware.use MyMiddleware
237
- end
238
- ```
239
-
240
- You can also view the order of the currently activated middleware by running `rake bugsnag:middleware`.
241
-
242
- Check out Bugsnag's [built in middleware classes](https://github.com/bugsnag/bugsnag-ruby/tree/master/lib/bugsnag/middleware)
243
- for some real examples of middleware in action.
244
-
245
-
246
- Deploy Tracking
247
- ---------------
248
-
249
- Bugsnag allows you to track deploys of your apps. By sending the
250
- source revision or application version to bugsnag.com when you deploy a new
251
- version of your app, you'll be able to see which deploy each error was
252
- introduced in.
253
-
254
- ### Using Heroku
255
-
256
- You can easily add Bugsnag deploy tracking to your Heroku application by
257
- running the following command from your application's directory:
258
-
259
- ```shell
260
- $ bundle exec rake bugsnag:heroku:add_deploy_hook
261
- ```
262
-
263
- If you have multiple Heroku apps, you can specify which app to add the hook
264
- for as with the `HEROKU_APP` environment variable:
265
-
266
- ```shell
267
- $ bundle exec rake bugsnag:heroku:add_deploy_hook HEROKU_APP=my-app
268
- ```
269
-
270
- ### Using Capistrano
271
-
272
- If you use [capistrano](https://github.com/capistrano/capistrano) to deploy
273
- your apps, you can enable deploy tracking by adding the integration to your
274
- app's `deploy.rb`:
275
-
276
- ```ruby
277
- require "bugsnag/capistrano"
278
-
279
- set :bugsnag_api_key, "api_key_here"
280
- ```
281
-
282
- ### Using Rake
283
-
284
- If you aren't using capistrano, you can run the following rake command from
285
- your deploy scripts.
286
-
287
- ```shell
288
- rake bugsnag:deploy BUGSNAG_REVISION=source-control-revision BUGSNAG_RELEASE_STAGE=production BUGSNAG_API_KEY=api-key-here
289
- ```
290
-
291
- The bugsnag rake tasks will be automatically available for Rails 3/4
292
- apps, to make the rake tasks available in other apps, add the following to
293
- your `Rakefile`:
294
-
295
- ```ruby
296
- require "bugsnag/tasks"
297
- ```
298
-
299
- ### Configuring Deploy Tracking
300
-
301
- You can set the following environmental variables to override or specify
302
- additional deploy information:
303
-
304
- - **BUGSNAG_API_KEY** -
305
- Your Bugsnag API key (required).
306
- - **BUGSNAG_RELEASE_STAGE** -
307
- The release stage (eg, production, staging) currently being deployed.
308
- This is set automatically from your Bugsnag settings or rails/rack
309
- environment.
310
- - **BUGSNAG_REPOSITORY** -
311
- The repository from which you are deploying the code. This is set
312
- automatically if you are using capistrano.
313
- - **BUGSNAG_BRANCH** -
314
- The source control branch from which you are deploying the code.
315
- This is set automatically if you are using capistrano.
316
- - **BUGSNAG_REVISION** -
317
- The source control revision for the code you are currently deploying.
318
- This is set automatically if you are using capistrano.
319
- - **BUGSNAG_APP_VERSION** -
320
- The app version of the code you are currently deploying. Only set this
321
- if you tag your releases with [semantic version numbers](http://semver.org/)
322
- and deploy infrequently.
323
-
324
- For more information, check out the [deploy tracking api](https://bugsnag.com/docs/deploy-tracking-api)
325
- documentation.
326
-
327
-
328
- Demo Applications
329
- -----------------
330
-
331
- [There are demo applications that use the Bugsnag Ruby gem](https://github.com/bugsnag/bugsnag-example-apps/tree/master/apps/ruby):
332
- examples include Rails, Sinatra, Rack, Padrino integrations, etc.
333
-
334
-
335
- Support
336
- -------
337
-
338
- * [Additional Documentation](https://github.com/bugsnag/bugsnag-ruby/tree/master/docs)
10
+ ## Features
11
+
12
+ * Automatically report unhandled exceptions and crashes
13
+ * Report handled exceptions
14
+ * Attach user information to determine how many people are affected by a crash
15
+ * Send customized diagnostic data
16
+
17
+ ## Getting started
18
+
19
+ 1. [Create a Bugsnag account](https://bugsnag.com)
20
+ 2. Complete the instructions in the integration guide for your framework:
21
+ * [Rack](http://docs.bugsnag.com/platforms/ruby/rack)
22
+ * [Rails](http://docs.bugsnag.com/platforms/ruby/rails)
23
+ * [Rake](http://docs.bugsnag.com/platforms/ruby/rake)
24
+ * [Sidekiq](http://docs.bugsnag.com/platforms/ruby/sidekiq)
25
+ * [Other Ruby apps](http://docs.bugsnag.com/platforms/ruby/other)
26
+ * For [EventMachine](http://rubyeventmachine.com) integration, see [`bugsnag-em`](https://github.com/bugsnag/bugsnag-em)
27
+ 3. Relax!
28
+
29
+ ## Support
30
+
31
+ * Read the configuration reference:
32
+ * [Rack](http://docs.bugsnag.com/platforms/ruby/rack/configuration-options)
33
+ * [Rails](http://docs.bugsnag.com/platforms/ruby/rails/configuration-options)
34
+ * [Rake](http://docs.bugsnag.com/platforms/ruby/rake/configuration-options)
35
+ * [Sidekiq](http://docs.bugsnag.com/platforms/ruby/sidekiq/configuration-options)
36
+ * [Other Ruby apps](http://docs.bugsnag.com/platforms/ruby/other/configuration-options)
37
+ * Check out some [example apps integrated with Bugsnag](https://github.com/bugsnag/bugsnag-example-apps/tree/master/apps/ruby) using Rails, Sinatra, Padrino, and more.
339
38
  * [Search open and closed issues](https://github.com/bugsnag/bugsnag-ruby/issues?utf8=✓&q=is%3Aissue) for similar problems
340
39
  * [Report a bug or request a feature](https://github.com/bugsnag/bugsnag-ruby/issues/new)
341
40
 
41
+ ## Contributing
342
42
 
343
- Contributing
344
- ------------
345
-
346
- We'd love you to file issues and send pull requests. The [contributing guidelines](https://github.com/bugsnag/bugsnag-ruby/CONTRIBUTING.md) details the process of building and testing `bugsnag-ruby`, as well as the pull request process. Feel free to comment on [existing issues](https://github.com/bugsnag/bugsnag-ruby/issues) for clarification or starting points.
347
-
43
+ All contributors are welcome! For information on how to build, test
44
+ and release `bugsnag-ruby`, see our
45
+ [contributing guide](https://github.com/bugsnag/bugsnag-ruby/blob/master/CONTRIBUTING.md). Feel free to comment on [existing issues](https://github.com/bugsnag/bugsnag-ruby/issues) for clarification or starting points.
348
46
 
349
- License
350
- -------
47
+ ## License
351
48
 
352
49
  The Bugsnag ruby notifier is free software released under the MIT License.
353
50
  See [LICENSE.txt](LICENSE.txt) for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.1.0
1
+ 4.2.0
@@ -26,7 +26,7 @@ module Bugsnag
26
26
  end
27
27
 
28
28
  def save
29
- Bugsnag.auto_notify(exception, {:context => "resque##{queue}", :payload => payload, :delivery_method => :synchronous})
29
+ Bugsnag.auto_notify(exception, {:context => "#{payload['class']}@#{queue}", :payload => payload, :delivery_method => :synchronous})
30
30
  end
31
31
  end
32
32
  end
@@ -29,7 +29,7 @@ if ::Sidekiq::VERSION < '3'
29
29
  else
30
30
  ::Sidekiq.configure_server do |config|
31
31
  config.error_handlers << lambda do |ex, ctx|
32
- Bugsnag.auto_notify(ex, :sidekiq => ctx, :context => "sidekiq##{ctx['queue']}")
32
+ Bugsnag.auto_notify(ex, :sidekiq => ctx, :context => "#{ctx['class']}@#{ctx['queue']}")
33
33
  end
34
34
  end
35
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bugsnag
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-11 00:00:00.000000000 Z
11
+ date: 2016-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -115,9 +115,6 @@ files:
115
115
  - Rakefile
116
116
  - VERSION
117
117
  - bugsnag.gemspec
118
- - docs/Configuration.md
119
- - docs/Notification Options.md
120
- - docs/README.md
121
118
  - lib/bugsnag.rb
122
119
  - lib/bugsnag/capistrano.rb
123
120
  - lib/bugsnag/capistrano2.rb
@@ -1,242 +0,0 @@
1
- # `bugsnag-ruby` Configuration
2
-
3
- To configure additional Bugsnag settings, use the block syntax and set any
4
- settings you need on the `config` block variable. For example:
5
-
6
- ```ruby
7
- Bugsnag.configure do |config|
8
- config.api_key = "your-api-key-here"
9
- config.notify_release_stages = ["production", "development"]
10
- end
11
- ```
12
-
13
- ## Available Options
14
-
15
- ### `api_key`
16
-
17
- Your Bugsnag API key (required).
18
-
19
- ```ruby
20
- config.api_key = "your-api-key-here"
21
- ```
22
-
23
- ### `app_type`
24
-
25
- You can set the type of application executing the current code by using
26
- `app_type`:
27
-
28
- ```ruby
29
- config.app_type = "resque"
30
- ```
31
-
32
- This is usually used to represent if you are running in a Rails server, Sidekiq
33
- job or Rake task for example. Bugsnag will automatically detect most application
34
- types for you.
35
-
36
- ### `app_version`
37
-
38
- If you want to track in which versions of your application each exception
39
- happens, you can set `app_version`. This is set to `nil` by default.
40
-
41
- ```ruby
42
- config.app_version = "2.5.1"
43
- ```
44
-
45
- ### `auto_notify`
46
-
47
- By default, we will automatically notify Bugsnag of any fatal exceptions
48
- in your application. If you want to stop this from happening, you can set
49
- `auto_notify`:
50
-
51
- ```ruby
52
- config.auto_notify = false
53
- ```
54
-
55
- ### `endpoint`
56
-
57
- By default, we'll send crashes to *notify.bugsnag.com* to display them on
58
- your dashboard. If you are using *Bugsnag Enterprise* you'll need to set
59
- this to be your *Event Server* endpoint, for example:
60
-
61
- ```ruby
62
- config.endpoint = "bugsnag.example.com:49000"
63
- ```
64
-
65
- ### `ignore_classes`
66
-
67
- Sets for which exception classes we should not send exceptions to bugsnag.com.
68
-
69
- ```ruby
70
- config.ignore_classes << "ActiveRecord::StatementInvalid"
71
- ```
72
-
73
- You can also provide a lambda function here to ignore by other exception
74
- attributes or by a regex:
75
-
76
- ```ruby
77
- config.ignore_classes << lambda {|ex| ex.message =~ /timeout/}
78
- ```
79
-
80
- By default, `ignore_classes` contains the following:
81
-
82
- ```ruby
83
- [
84
- "ActiveRecord::RecordNotFound",
85
- "ActionController::RoutingError",
86
- "ActionController::InvalidAuthenticityToken",
87
- "CGI::Session::CookieStore::TamperedWithCookie",
88
- "ActionController::UnknownAction",
89
- "AbstractController::ActionNotFound"
90
- ]
91
- ```
92
-
93
- ### `ignore_user_agents`
94
-
95
- Sets an array of Regexps that can be used to ignore exceptions from
96
- certain user agents.
97
-
98
- ```ruby
99
- config.ignore_user_agents << %r{Chrome}
100
- ```
101
-
102
- By default, `ignore_user_agents` is empty, so exceptions caused by all
103
- user agents are reported.
104
-
105
- ### `logger`
106
-
107
- Sets which logger to use for Bugsnag log messages. In rails apps, this is
108
- automatically set to use `Rails.logger`, otherwise it will be set to
109
- `Logger.new(STDOUT)`.
110
-
111
- ### `middleware`
112
-
113
- Provides access to the middleware stack, see the
114
- [Bugsnag Middleware](#bugsnag-middleware) section below for details.
115
-
116
- ### `notify_release_stages`
117
-
118
- By default, we will notify Bugsnag of exceptions that happen in any
119
- `release_stage`. If you would like to change which release stages
120
- notify Bugsnag of exceptions you can set `notify_release_stages`:
121
-
122
- ```ruby
123
- config.notify_release_stages = ["production", "development"]
124
- ```
125
-
126
- ### `params_filters`
127
-
128
- Sets which keys should be filtered out from `params` hashes before sending
129
- them to Bugsnag. Use this if you want to ensure you don't send sensitive data
130
- such as passwords, and credit card numbers to our servers. You can add both
131
- strings and regular expressions to this array. When adding strings, keys which
132
- *contain* the string will be filtered. When adding regular expressions, any
133
- keys which *match* the regular expression will be filtered.
134
-
135
- ```ruby
136
- config.params_filters += ["credit_card_number", /^password$/]
137
- ```
138
-
139
- By default, `params_filters` is set to `[/authorization/i, /cookie/i,
140
- /password/i, /secret/i]`, and for rails apps, imports all values from
141
- `Rails.configuration.filter_parameters`.
142
-
143
- **Note:** Assigning (`=`) instead of appending (`+=`) to the default value will
144
- remove the default protections.
145
-
146
- <!-- Custom anchor for linking from alerts -->
147
- <div id="set-project-root"></div>
148
- ### `project_root`
149
-
150
- We mark stacktrace lines as `inProject` if they come from files inside your
151
- `project_root`. In rails apps this value is automatically set to `RAILS_ROOT`,
152
- otherwise you should set it manually:
153
-
154
- ```ruby
155
- config.project_root = "/var/www/myproject"
156
- ```
157
-
158
- ### `proxy_host`
159
-
160
- Sets the address of the HTTP proxy that should be used for requests to bugsnag.
161
-
162
- ```ruby
163
- config.proxy_host = "10.10.10.10"
164
- ```
165
-
166
- ### `proxy_password`
167
-
168
- Sets the password for the user that should be used to send requests to the HTTP proxy for requests to bugsnag.
169
-
170
- ```ruby
171
- config.proxy_password = "proxy_secret_password_here"
172
- ```
173
-
174
- ### `proxy_port`
175
-
176
- Sets the port of the HTTP proxy that should be used for requests to bugsnag.
177
-
178
- ```ruby
179
- config.proxy_port = 1089
180
- ```
181
-
182
- ### `proxy_user`
183
-
184
- Sets the user that should be used to send requests to the HTTP proxy for requests to bugsnag.
185
-
186
- ```ruby
187
- config.proxy_user = "proxy_user"
188
- ```
189
-
190
- ### `release_stage`
191
-
192
- If you would like to distinguish between errors that happen in different
193
- stages of the application release process (development, production, etc)
194
- you can set the `release_stage` that is reported to Bugsnag.
195
-
196
- ```ruby
197
- config.release_stage = "development"
198
- ```
199
-
200
- In rails apps this value is automatically set from `RAILS_ENV`, and in rack
201
- apps it is automatically set to `RACK_ENV`. Otherwise the default is
202
- "production".
203
-
204
- ### `send_environment`
205
-
206
- Bugsnag can transmit your rack environment to help diagnose issues. This environment
207
- can sometimes contain private information so Bugsnag does not transmit by default. To
208
- send your rack environment, set the `send_environment` option to `true`.
209
-
210
- ```ruby
211
- config.send_environment = true
212
- ```
213
-
214
- ### `send_code`
215
-
216
- Bugsnag automatically sends a small snippet of the code that crashed to help you diagnose
217
- even faster from within your dashboard. If you don't want to send this snippet you can
218
- set the `send_code` option to `false`.
219
-
220
- ```ruby
221
- config.send_code = false
222
- ```
223
-
224
- ### `timeout`
225
- By default the timeout for posting errors to Bugsnag is 15 seconds, to change this
226
- you can set the `timeout`:
227
-
228
- ```ruby
229
- config.timeout = 10
230
- ```
231
-
232
- ### `use_ssl`
233
-
234
- Enforces all communication with bugsnag.com be made via ssl. You can turn
235
- this off if necessary.
236
-
237
- ```ruby
238
- config.use_ssl = false
239
- ```
240
-
241
- By default, `use_ssl` is set to true.
242
-
@@ -1,269 +0,0 @@
1
- # `bugsnag-ruby` Notification Options
2
-
3
- It is often useful to send additional meta-data about your app, such as
4
- information about the currently logged in user, along with any
5
- exceptions, to help debug problems.
6
-
7
- * [Notification Object](#notification-object)
8
- - [Instance Methods](#instance-methods)
9
- - [`Bugsnag::MetaData` Exception Mixin](#exception-mixin)
10
- * [Handled Notification Options](#handled-notification-options)
11
- * [Framework-specific Configuration](#framework-specific-configuration)
12
- - [Rails Apps](#rails-apps)
13
- - [Rails API Apps](#rails-api-apps)
14
- - [Other Ruby Apps](#other-ruby-apps)
15
-
16
- ## Notification Object
17
-
18
- The notification object is passed to all [before bugsnag notify](#framework-specific-configuration)
19
- callbacks and is used to manipulate the error report before it is transmitted.
20
-
21
- ### Instance Methods
22
-
23
- #### `add_tab`
24
-
25
- Call add_tab on a notification object to add a tab to the error report so that
26
- it would appear on your dashboard.
27
-
28
- ```ruby
29
- notif.add_tab(:user_info, {
30
- name: current_user.name
31
- })
32
- ```
33
-
34
- The first parameter is the tab name that will appear in the error report and the
35
- second is the key, value list that will be displayed in the tab.
36
-
37
- #### `remove_tab`
38
-
39
- Removes a tab completely from the error report
40
-
41
- ```ruby
42
- notif.remove_tab(:request)
43
- ```
44
-
45
- #### `ignore!`
46
-
47
- Calling ignore! on a notification object will cause the notification to not be
48
- sent to bugsnag. This means that you can choose dynamically not to send an error
49
- depending on application state or the error itself.
50
-
51
- ```ruby
52
- notif.ignore! if foo == 'bar'
53
- ```
54
-
55
- #### `grouping_hash`
56
-
57
- Sets the grouping hash of the error report. All errors with the same grouping
58
- hash are grouped together. This is an advanced usage of the library and
59
- mis-using it will cause your errors not to group properly in your dashboard.
60
-
61
- ```ruby
62
- notif.grouping_hash = "#{exception.message}#{exception.class}"
63
- ```
64
-
65
- #### `severity`
66
-
67
- Set the severity of the error. Severity can be `error`, `warning` or `info`.
68
-
69
- ```ruby
70
- notif.severity = "error"
71
- ```
72
-
73
- #### `context`
74
-
75
- Set the context of the error report. This is notionally the location of the
76
- error and should be populated automatically. Context is displayed in the
77
- dashboard prominently.
78
-
79
- ```ruby
80
- notif.context = "billing"
81
- ```
82
-
83
- #### `user`
84
-
85
- You can set or read the user with the user property of the notification. The
86
- user will be a hash of `email`, `id` and `name`.
87
-
88
- ```ruby
89
- notif.user = {
90
- id: current_user.id,
91
- email: current_user.email,
92
- name: current_user.name
93
- }
94
- ```
95
-
96
- #### `exceptions`
97
-
98
- Allows you to read the exceptions that will be combined into the report.
99
-
100
- ```ruby
101
- puts "#{notif.exceptions.first.message} found!"
102
- ```
103
-
104
- #### `meta_data`
105
-
106
- Provides access to the meta_data in the error report.
107
-
108
- ```ruby
109
- notif.ignore! if notif.meta_data[:sidekiq][:retry_count] > 2
110
- ```
111
-
112
- ### Exception Mixin
113
-
114
- If you include the `Bugsnag::MetaData` module into your own exceptions, you can
115
- associate meta data with a particular exception.
116
-
117
- ```ruby
118
- class MyCustomException < Exception
119
- include Bugsnag::MetaData
120
- end
121
-
122
- exception = MyCustomException.new("It broke!")
123
- exception.bugsnag_meta_data = {
124
- :user_info => {
125
- name: current_user.name
126
- }
127
- }
128
-
129
- raise exception
130
- ```
131
-
132
- ## Handled Notification Options
133
-
134
- Non-fatal exception notifications can send additional metadata in when being
135
- sent via `Bugsnag.notify` including setting the severity and custom data.
136
-
137
- #### Severity
138
-
139
- You can set the severity of an error in Bugsnag by including the severity option when
140
- notifying bugsnag of the error,
141
-
142
- ```ruby
143
- Bugsnag.notify(RuntimeError.new("Something broke"), {
144
- :severity => "error",
145
- })
146
- ```
147
-
148
- Valid severities are `error`, `warning` and `info`.
149
-
150
- Severity is displayed in the dashboard and can be used to filter the error list.
151
- By default all crashes (or unhandled exceptions) are set to `error` and all
152
- `Bugsnag.notify` calls default to `warning`.
153
-
154
- #### Multiple projects
155
-
156
- If you want to divide errors into multiple Bugsnag projects, you can specify the API key as a parameter to `Bugsnag.notify`:
157
-
158
- ```ruby
159
- rescue => e
160
- Bugsnag.notify e, api_key: "your-api-key-here"
161
- end
162
- ```
163
-
164
- #### Custom Metadata
165
-
166
- You can also send additional meta-data with your exception:
167
-
168
- ```ruby
169
- Bugsnag.notify(RuntimeError.new("Something broke"), {
170
- :user => {
171
- :username => "bob-hoskins",
172
- :registered_user => true
173
- }
174
- })
175
- ```
176
-
177
- #### Custom Grouping via `grouping_hash`
178
-
179
- If you want to override Bugsnag's grouping algorithm, you can specify a grouping hash key as a parameter to `Bugsnag.notify`:
180
-
181
- ```ruby
182
- rescue => e
183
- Bugsnag.notify e, grouping_hash: "this-is-my-grouping-hash"
184
- end
185
- ```
186
-
187
- All errors with the same groupingHash will be grouped together within the bugsnag dashboard.
188
-
189
- ## Framework-specific Configuration
190
-
191
- ### Rails Apps
192
-
193
- By default Bugsnag includes some information automatically. For example, we
194
- send all the HTTP headers for requests. Additionally if you're using Warden or
195
- Devise, the id, name and email of the current user are sent.
196
-
197
- To send additional information, in any rails controller you can define a
198
- `before_bugsnag_notify` callback, which allows you to add this additional data
199
- by calling `add_tab` on the exception notification object. Please see the
200
- [Notification Object](#notification-object) for details on the notification
201
- parameter.
202
-
203
- ```ruby
204
- class MyController < ApplicationController
205
- # Define the filter
206
- before_bugsnag_notify :add_user_info_to_bugsnag
207
-
208
- # Your controller code here
209
-
210
- private
211
- def add_user_info_to_bugsnag(notif)
212
- # Set the user that this bug affected
213
- # Email, name and id are searchable on bugsnag.com
214
- notif.user = {
215
- email: current_user.email,
216
- name: current_user.name,
217
- id: current_user.id
218
- }
219
-
220
- # Add some app-specific data which will be displayed on a custom
221
- # "Diagnostics" tab on each error page on bugsnag.com
222
- notif.add_tab(:diagnostics, {
223
- product: current_product.name
224
- })
225
- end
226
- end
227
- ```
228
-
229
- ### Rails API Apps
230
-
231
- If you are building an API using the
232
- [rails-api](https://github.com/rails-api/rails-api) gem, your controllers will
233
- inherit from `ActionController::API` instead of `ActionController::Base`.
234
-
235
- In this case, the `before_bugsnag_notify` filter will not be automatically
236
- available in your controllers. In order to use it, you will need to include
237
- the module `Bugsnag::Rails::ControllerMethods`.
238
-
239
- ```ruby
240
- class ApplicationController < ActionController::API
241
-
242
- # Include module which defines the before_bugsnag_notify filter
243
- include Bugsnag::Rails::ControllerMethods
244
-
245
- # Other code here
246
- end
247
- ```
248
-
249
- ### Other Ruby Apps
250
-
251
- In other ruby apps, you can provide lambda functions to execute before any
252
- `Bugsnag.notify` calls as follows. Don't forget to clear the callbacks at the
253
- end of each request or session. In Rack applications like Sinatra, this is
254
- automatically done for you.
255
-
256
- ```ruby
257
- # Set a before notify callback
258
- Bugsnag.before_notify_callbacks << lambda {|notif|
259
- notif.add_tab(:user_info, {
260
- name: current_user.name
261
- })
262
- }
263
-
264
- # Your app code here
265
-
266
- # Clear the callbacks
267
- Bugsnag.before_notify_callbacks.clear
268
- ```
269
-
@@ -1,14 +0,0 @@
1
- # `bugsnag-ruby` Usage and Configuration
2
-
3
- ## [Configuration](Configuration.md)
4
-
5
- Bugsnag includes several configuration for better compatibility with your
6
- project and network settings.
7
-
8
- ## [Notification Options](Notification Options.md)
9
-
10
- It is often useful to send additional metadata about your app, such as
11
- information about the currently logged in user, along with any exceptions, to
12
- help debug problems. This document lists possible per-notification options as
13
- well as additional configuration available for different project types,
14
- including Rails, Rails API, and other frameworks.