honeybadger 3.1.0 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +298 -21
- data/TROUBLESHOOTING.md +27 -21
- data/lib/honeybadger/cli/deploy.rb +1 -1
- data/lib/honeybadger/config/defaults.rb +5 -0
- data/lib/honeybadger/plugins/rails.rb +4 -9
- data/lib/honeybadger/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f0a64f658caa8ec626ba0c4a4a8ce4d0f258145
|
4
|
+
data.tar.gz: 8def10b166ae16d0faeab0cf7ec4c10fb2596cf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb3be63b99e2fbb896b7ac9f8f57eadc7c9d4369f46e09661ec23121fb833ee5edb228376d9066e6f031718d00abdff5d8750115cb4530fefa0bde6e7a09e930
|
7
|
+
data.tar.gz: 2eed6f1df816b815b90a07be55d474bf2924294e15120c4b546bd16ff744319133943b3f7a2a2234a3e900abdcaa2e4dfa4960dd4ffafd33410f231fd2818b28
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,12 @@ adheres to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [3.1.1] - 2017-04-13
|
9
|
+
### Fixed
|
10
|
+
- `honeybadger deploy` cli command now reads default environment from
|
11
|
+
honeybadger.yml/environment variable.
|
12
|
+
- Fixed a conflict with the web-console gem.
|
13
|
+
|
8
14
|
## [3.1.0] - 2017-03-01
|
9
15
|
### Changed
|
10
16
|
- Exceptions encountered while loading/evaluating honeybadger.yml are now raised
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ When an uncaught exception occurs, Honeybadger will POST the relevant data to th
|
|
24
24
|
|
25
25
|
Rails and Sinatra are supported natively (install/configure the gem and you're done). For vanilla Rack apps, we provide a collection of middleware that must be installed manually.
|
26
26
|
|
27
|
-
To use Rails 2.x, you'll need to use an earlier version of the Honeybadger gem. [Go to version 1.x of the gem docs](https://github.com/honeybadger-io/honeybadger-ruby/blob/1.16-stable/docs/index.md).
|
27
|
+
To use Rails 2.x, you'll need to use an earlier version of the Honeybadger gem. [Go to version 1.x of the gem docs](https://github.com/honeybadger-io/honeybadger-ruby/blob/1.16-stable/docs/index.md).
|
28
28
|
|
29
29
|
Integrating with other libraries/frameworks is simple! [See the documentation](http://rubydoc.info/gems/honeybadger/) to learn about our public API, and see [Contributing](#contributing) to suggest a patch.
|
30
30
|
|
@@ -49,7 +49,7 @@ You can integrate honeybadger into any Ruby script via the `Honeybadger.notify`
|
|
49
49
|
|
50
50
|
## Getting Started
|
51
51
|
|
52
|
-
Honeybadger works out of the box with all popular Ruby frameworks. Installation is just a matter of including the gem and setting your API key. In this section, we'll cover the basics. More advanced installations are covered later.
|
52
|
+
Honeybadger works out of the box with all popular Ruby frameworks. Installation is just a matter of including the gem and setting your API key. In this section, we'll cover the basics. More advanced installations are covered later.
|
53
53
|
|
54
54
|
### 1. Install the gem
|
55
55
|
|
@@ -93,7 +93,7 @@ This step isn't necessary if you're using our [Heroku add-on](https://elements.h
|
|
93
93
|
|
94
94
|
#### Rails
|
95
95
|
|
96
|
-
You're done! Any rake tasks and job queues that load the Rails environment are also covered.
|
96
|
+
You're done! Any rake tasks and job queues that load the Rails environment are also covered.
|
97
97
|
|
98
98
|
For more info, check out our screencast on getting up and running with Honeybadger and Rails:
|
99
99
|
|
@@ -101,7 +101,7 @@ For more info, check out our screencast on getting up and running with Honeybadg
|
|
101
101
|
|
102
102
|
#### Sinatra
|
103
103
|
|
104
|
-
All you need to do is to include the honeybadger gem:
|
104
|
+
All you need to do is to include the honeybadger gem:
|
105
105
|
|
106
106
|
```ruby
|
107
107
|
# Always require Sinatra first.
|
@@ -139,10 +139,28 @@ use Honeybadger::Rack::ErrorNotifier
|
|
139
139
|
run app
|
140
140
|
```
|
141
141
|
|
142
|
+
#### Plain Ruby
|
142
143
|
|
143
|
-
|
144
|
+
To use Honeybadger without any of the automatic integrations, `require
|
145
|
+
honeybadger/ruby` instead of `require 'honeybadger'`:
|
144
146
|
|
145
|
-
|
147
|
+
```
|
148
|
+
require 'honeybadger/ruby'
|
149
|
+
|
150
|
+
begin
|
151
|
+
# Failing code
|
152
|
+
rescue => exception
|
153
|
+
Honeybadger.notify(exception)
|
154
|
+
end
|
155
|
+
```
|
156
|
+
|
157
|
+
All of the public API methods are still available, but none of the plugins,
|
158
|
+
framework integrations, or hooks are run. You will need to manually set up your
|
159
|
+
own middleware and hooks for error monitoring in whatever frameworks you use.
|
160
|
+
|
161
|
+
## Configuration
|
162
|
+
|
163
|
+
There are a few ways to configure the Honeybadger gem. You can use a YAML config file. You can use environment variables. You can use Ruby. Or you can use a combination of the three.
|
146
164
|
|
147
165
|
We put together a short video highligting a few of the most common configuration options:
|
148
166
|
|
@@ -151,7 +169,7 @@ We put together a short video highligting a few of the most common configuration
|
|
151
169
|
|
152
170
|
### YAML Configuration File
|
153
171
|
|
154
|
-
By default, Honeybadger looks for a `honeybadger.yml` configuration file in the root of your project, and then `config/honeybadger.yml` (in that order).
|
172
|
+
By default, Honeybadger looks for a `honeybadger.yml` configuration file in the root of your project, and then `config/honeybadger.yml` (in that order).
|
155
173
|
|
156
174
|
Here's what the simplest config file looks like:
|
157
175
|
|
@@ -167,7 +185,7 @@ Some configuration options are written in YAML as nested hashes. For example, he
|
|
167
185
|
```yaml
|
168
186
|
---
|
169
187
|
logging:
|
170
|
-
path: "/path/to/honeybadger.log"
|
188
|
+
path: "/path/to/honeybadger.log"
|
171
189
|
request:
|
172
190
|
filter_keys:
|
173
191
|
- "credit_card"
|
@@ -206,11 +224,22 @@ All configuration options can also be read from environment variables (ENV). To
|
|
206
224
|
export HONEYBADGER_LOGGING_PATH=/path/to/honeybadger.log
|
207
225
|
```
|
208
226
|
|
209
|
-
ENV options override other options read from framework or `honeybadger.yml` sources, so both can be used together.
|
227
|
+
ENV options override other options read from framework or `honeybadger.yml` sources, so both can be used together.
|
228
|
+
|
229
|
+
### Configuration via Ruby (programmatic)
|
230
|
+
|
231
|
+
To configure Honeybadger from Ruby, use `Honeybadger.configure`:
|
232
|
+
|
233
|
+
```ruby
|
234
|
+
Honeybadger.configure do |config|
|
235
|
+
config.api_key = 'project api key'
|
236
|
+
config.exceptions.ignore += [CustomError]
|
237
|
+
end
|
238
|
+
```
|
210
239
|
|
211
240
|
## Configuration Options
|
212
241
|
|
213
|
-
You can use any of the options below in your config file, or in the environment.
|
242
|
+
You can use any of the options below in your config file, or in the environment.
|
214
243
|
|
215
244
|
|
216
245
|
|
@@ -220,6 +249,7 @@ You can use any of the options below in your config file, or in the environment.
|
|
220
249
|
|`env` | String | The environment the app is running in. In Rails this defaults to `Rails.env`.<br/>_Default: `nil`_|
|
221
250
|
|`report_data` | Boolean | Enable/disable reporting of data. Defaults to false for "test", "development", and "cucumber" environments. <br>_Default: `true`_|
|
222
251
|
|`root` | String | The project's absolute root path.<br/>_Default: `Dir.pwd`_|
|
252
|
+
|`revision` | String | The project's git revision.<br/>_Default: revision detected from git_|
|
223
253
|
|`hostname` | String | The hostname of the current box.<br/>_Default: `Socket.gethostname`_|
|
224
254
|
|`backend` | String | An alternate backend to use for reporting data.<br/>_Default: `nil`_|
|
225
255
|
|`debug` | Boolean | Enables verbose debug logging.<br/>_Default: `false`_|
|
@@ -228,7 +258,7 @@ You can use any of the options below in your config file, or in the environment.
|
|
228
258
|
| `config_path` | String | The path of the honeybadger config file. Can only be set via the `$HONEYBADGER_CONFIG_PATH` environment variable |
|
229
259
|
|`development_environments` | Array | Environments which will not report data by default (use report_data to enable/disable explicitly).<br/>_Default: `["development", "test", "cucumber"]`_|
|
230
260
|
|`plugins` | Array | An optional list of plugins to load. Default is to load all plugins.<br/>_Default: `[]`_|
|
231
|
-
|`
|
261
|
+
|`skipped_plugins` | Array | An optional list of plugins to skip.<br/>_Default: `[]`_|
|
232
262
|
| | ||
|
233
263
|
|__LOGGING__ | ||
|
234
264
|
|`logging.path` | String | The path (absolute, or relative from config.root) to the log file. Defaults to the rails logger or STDOUT. To log to standard out, use 'STDOUT'.<br/>_Default: `nil`_|
|
@@ -271,15 +301,17 @@ You can use any of the options below in your config file, or in the environment.
|
|
271
301
|
| | ||
|
272
302
|
|__SIDEKIQ__ | ||
|
273
303
|
|`sidekiq.attempt_threshold` | Integer | The number of attempts before notifications will be sent.<br/>_Default: `0`_|
|
274
|
-
|`sidekiq.use_component` | Boolean | Automatically set the component to the class of the job. Helps with grouping.<br/>_Default: `
|
304
|
+
|`sidekiq.use_component` | Boolean | Automatically set the component to the class of the job. Helps with grouping.<br/>_Default: `true`_|
|
275
305
|
|__DELAYED JOB__ | ||
|
276
306
|
|`delayed_job.attempt_threshold` | Integer | The number of attempts before notifications will be sent.<br/>_Default: `0`_|
|
307
|
+
|__SHORYUKEN__ | ||
|
308
|
+
|`shoryuken.attempt_threshold` | Integer | The number of attempts before notifications will be sent.<br/>_Default: `0`_|
|
277
309
|
|__SINATRA__ | ||
|
278
310
|
|`sinatra.enabled` | Boolean | Enable Sinatra auto-initialization.<br/>_Default: `true`_|
|
279
311
|
|
280
|
-
## Public Methods
|
312
|
+
## Public Methods
|
281
313
|
|
282
|
-
> What follows is a summary of the gem's most commonly-used public methods. For a more authoritative list, read the [full API documentation](http://www.rubydoc.info/gems/honeybadger/Honeybadger).
|
314
|
+
> What follows is a summary of the gem's most commonly-used public methods. For a more authoritative list, read the [full API documentation](http://www.rubydoc.info/gems/honeybadger/Honeybadger/Agent).
|
283
315
|
|
284
316
|
|
285
317
|
### `Honeybadger.context()`: Set metadata to be sent if an exception occurs
|
@@ -306,6 +338,9 @@ end
|
|
306
338
|
|
307
339
|
# Clearing global context:
|
308
340
|
Honeybadger.context.clear!
|
341
|
+
|
342
|
+
# Fetching current context
|
343
|
+
Honeybadger.get_context
|
309
344
|
```
|
310
345
|
|
311
346
|
---
|
@@ -318,8 +353,8 @@ You normally won't have to use this method. Honeybadger detects and reports erro
|
|
318
353
|
#### Use this method if:
|
319
354
|
|
320
355
|
* You've rescued an exception, but still want to report it
|
321
|
-
* You need to report an exception outside of a supported framework.
|
322
|
-
* You want complete control over what exception data is sent to us.
|
356
|
+
* You need to report an exception outside of a supported framework.
|
357
|
+
* You want complete control over what exception data is sent to us.
|
323
358
|
|
324
359
|
|
325
360
|
#### Examples:
|
@@ -329,7 +364,27 @@ You normally won't have to use this method. Honeybadger detects and reports erro
|
|
329
364
|
begin
|
330
365
|
fail 'oops'
|
331
366
|
rescue => exception
|
332
|
-
Honeybadger.notify(exception)
|
367
|
+
Honeybadger.notify(exception)
|
368
|
+
end
|
369
|
+
```
|
370
|
+
|
371
|
+
---
|
372
|
+
|
373
|
+
### `Honeybadger.configure()`: Configure Honeybadger from Ruby
|
374
|
+
|
375
|
+
This method allows you to configure Honeybadger at runtime.
|
376
|
+
|
377
|
+
#### Use this method if:
|
378
|
+
|
379
|
+
* You want to change Honeybadger's configuration from inside Ruby rather than
|
380
|
+
(or in addition to) using the honeybadger.yml file or environment variables.
|
381
|
+
|
382
|
+
#### Examples:
|
383
|
+
|
384
|
+
```ruby
|
385
|
+
Honeybadger.configure do |config|
|
386
|
+
config.api_key = 'project api key'
|
387
|
+
config.exceptions.ignore += [CustomError]
|
333
388
|
end
|
334
389
|
```
|
335
390
|
|
@@ -364,8 +419,45 @@ end
|
|
364
419
|
```
|
365
420
|
__WARNING:__ While it is possible to use this callback to modify the data that is reported to Honeybadger, this is not officially supported and may not be allowed in future versions of the gem.
|
366
421
|
|
422
|
+
---
|
423
|
+
|
424
|
+
### `Honeybadger.exception_fingerprint()`: Customize your error grouping.
|
367
425
|
|
368
|
-
|
426
|
+
This method lets you add a callback that should return a unique string given a `Honeybadger::Notice` instance. All notices which match the same string will be grouped together in Honeybadger.
|
427
|
+
|
428
|
+
#### Use this method if:
|
429
|
+
|
430
|
+
* You currently receive too many error notifications
|
431
|
+
* You want to group some errors together which are currently unique
|
432
|
+
* You *don't* want to group some errors which are currently grouped
|
433
|
+
|
434
|
+
#### Examples:
|
435
|
+
|
436
|
+
```ruby
|
437
|
+
Honeybadger.exception_fingerprint do |notice|
|
438
|
+
[notice[:error_class], notice[:component], notice[:backtrace].to_s].join(':')
|
439
|
+
end
|
440
|
+
```
|
441
|
+
|
442
|
+
---
|
443
|
+
|
444
|
+
### `Honeybadger.backtrace_filter()`: Filter your backtrace.
|
445
|
+
|
446
|
+
This method allows you to add a callback which modifies each line of the backtrace before a notification happens.
|
447
|
+
|
448
|
+
#### Use this method if:
|
449
|
+
|
450
|
+
* You want to change or sanitize common data in your exception backtraces
|
451
|
+
|
452
|
+
#### Examples:
|
453
|
+
|
454
|
+
```ruby
|
455
|
+
Honeybadger.backtrace_filter do |line|
|
456
|
+
line.gsub(/^\/my\/unknown\/bundle\/path/, "[GEM_ROOT]")
|
457
|
+
end
|
458
|
+
```
|
459
|
+
|
460
|
+
## Deployment Tracking
|
369
461
|
|
370
462
|
Honeybadger has an API to keep track of project deployments. Whenever you deploy, all errors for that environment will be resolved automatically. You can choose to enable or disable the auto-resolve feature from your Honeybadger project settings page.
|
371
463
|
|
@@ -385,7 +477,7 @@ Adding options to your _config/deploy.rb_ file allows you to cus
|
|
385
477
|
set :honeybadger_env, "preprod"
|
386
478
|
```
|
387
479
|
|
388
|
-
You can use any of the following options when configuring capistrano.
|
480
|
+
You can use any of the following options when configuring capistrano.
|
389
481
|
|
390
482
|
| Option | |
|
391
483
|
|-------------------------- | ---- |
|
@@ -425,16 +517,117 @@ bundle exec honeybadger deploy --environment=production
|
|
425
517
|
Run `bundle exec honeybadger help deploy` for all available options.
|
426
518
|
|
427
519
|
|
520
|
+
## Honeybadger CLI
|
521
|
+
|
522
|
+
The Honeybadger CLI provides a Command Line Interface for various
|
523
|
+
Honeybadger-related programs and utilities. All features are available through
|
524
|
+
the `honeybadger` command and can be used independently of Bundler/Rails.
|
525
|
+
|
526
|
+
When using the *honeybadger* gem with Bundler, run `bundle exec honeybadger`.
|
527
|
+
|
528
|
+
To use outside of bundler, install the Honeybadger gem with `gem install
|
529
|
+
honeybadger` and then run `honeybadger`.
|
530
|
+
|
531
|
+
### CLI Configuration
|
532
|
+
|
533
|
+
The `honeybadger` command optionally reads configuration from the following
|
534
|
+
locations. Each location in the list takes precedence over the previous
|
535
|
+
location:
|
536
|
+
|
537
|
+
1. ~/honeybadger.yml
|
538
|
+
2. ./config/honeybadger.yml
|
539
|
+
3. ./honeybadger.yml
|
540
|
+
4. Rails/Ruby configuration (only when called from a Rails app root)
|
541
|
+
5. Environment variables
|
542
|
+
6. Command-line flags (i.e. `--api-key`)
|
543
|
+
|
544
|
+
The following configuration options are used by the CLI when applicable:
|
545
|
+
`api_key`, `env`. See [Configuration Options](#configuration-options)
|
546
|
+
|
547
|
+
All other options must be passed as command-line flags.
|
548
|
+
|
549
|
+
### CLI Commands
|
550
|
+
|
551
|
+
The following commands are available through the `honeybadger` CLI:
|
552
|
+
|
553
|
+
| Command | Description |
|
554
|
+
| -------------------- | ----------- |
|
555
|
+
| honeybadger deploy | Notify Honeybadger of deployment |
|
556
|
+
| honeybadger exec | Execute a command. If the exit status is not 0, report the result to Honeybadger |
|
557
|
+
| honeybadger help | Describe available commands or one specific command |
|
558
|
+
| honeybadger heroku | Manage Honeybadger on Heroku |
|
559
|
+
| honeybadger install | Install Honeybadger into a new project |
|
560
|
+
| honeybadger notify | Notify Honeybadger of an error |
|
561
|
+
| honeybadger test | Send a test notification from Honeybadger |
|
562
|
+
|
563
|
+
For additional info about each command, run `honeybadger help`.
|
564
|
+
|
565
|
+
### Rails initialization
|
566
|
+
|
567
|
+
When run from the root of a Rails project, the `honeybadger` command will load
|
568
|
+
the Rails environment so that any framework/programmatic configuration is picked
|
569
|
+
up.
|
570
|
+
|
571
|
+
## Cron/command line monitoring
|
572
|
+
|
573
|
+
`honeybadger exec` can be used from the command line/terminal to monitor failed
|
574
|
+
commands. To use it, prefix any normal command with `honeybadger exec` (much
|
575
|
+
like `bundle exec`):
|
576
|
+
|
577
|
+
```sh
|
578
|
+
$ honeybadger exec my-command --my-flag
|
579
|
+
```
|
580
|
+
|
581
|
+
If the command executes successfully, honeybadger exits with code 0. It prints
|
582
|
+
any output from the command by default. To use with cron's automatic email
|
583
|
+
feature, use the `--quiet` flag, which will suppress all standard output from
|
584
|
+
the origin command unless the command fails *and* the Honeybadger notification
|
585
|
+
fails, in which case it will dump the output so that cron can send a backup
|
586
|
+
email notification.
|
587
|
+
|
588
|
+
For full usage run `honeybadger help exec`.
|
589
|
+
|
590
|
+
## Notify from the command line
|
591
|
+
|
592
|
+
To send a Honeybadger notification from the command line/terminal, use
|
593
|
+
`honeybadger notify`:
|
594
|
+
|
595
|
+
```sh
|
596
|
+
$ honeybadger notify --message "This is an error from the command line"
|
597
|
+
```
|
598
|
+
|
599
|
+
For full usage run `honeybadger help notify`.
|
600
|
+
|
601
|
+
## Reporting to multiple Honeybadger projects in the same app
|
602
|
+
|
603
|
+
To send errors to another Honeybadger project, configure an additional agent:
|
604
|
+
|
605
|
+
```ruby
|
606
|
+
OtherBadger = Honeybadger::Agent.new
|
607
|
+
|
608
|
+
OtherBadger.configure do |config|
|
609
|
+
config.api_key = 'project api key'
|
610
|
+
end
|
611
|
+
|
612
|
+
begin
|
613
|
+
# Failing code
|
614
|
+
rescue => exception
|
615
|
+
OtherBadger.notify(exception)
|
616
|
+
end
|
617
|
+
```
|
618
|
+
|
619
|
+
Agents do not use the global honeybadger.yml or environment variable
|
620
|
+
configuration and must be configured manually after they are instantiated.
|
428
621
|
|
429
622
|
## Custom Error Pages
|
430
623
|
|
431
|
-
The Honeybadger gem has a few special tags that it looks for whenever you render an error page. These can be used to display extra information about the error, or to ask the user for information about how they triggered the error.
|
624
|
+
The Honeybadger gem has a few special tags that it looks for whenever you render an error page. These can be used to display extra information about the error, or to ask the user for information about how they triggered the error.
|
432
625
|
|
433
626
|
### Displaying Error ID
|
434
627
|
|
435
628
|
When an error is sent to Honeybadger, our API returns a unique UUID for the occurrence within your project. This UUID can be automatically displayed for reference on Rails error pages (e.g. `public/500.html`) or any rack output by including the `Honeybadger::UserInformer` middleware.
|
436
629
|
|
437
|
-
To include the error id, simply place this magic HTML comment on your error page:
|
630
|
+
To include the error id, simply place this magic HTML comment on your error page:
|
438
631
|
|
439
632
|
```html
|
440
633
|
<!-- HONEYBADGER ERROR -->
|
@@ -482,6 +675,90 @@ en:
|
|
482
675
|
comment: "Comment (required)"
|
483
676
|
```
|
484
677
|
|
678
|
+
## Testing Honeybadger in your integration tests
|
679
|
+
|
680
|
+
It is possible to test Honeybadger's integration with your application using the
|
681
|
+
included test backend.
|
682
|
+
|
683
|
+
The test backend replaces the default server backend with a stub that records
|
684
|
+
error notices rather than sending them, allowing all but the HTTP notification
|
685
|
+
itself to be verified. Alternatively, you could use something like
|
686
|
+
[WebMock](https://github.com/bblimke/webmock) to perform a similar test using
|
687
|
+
the "server" backend.
|
688
|
+
|
689
|
+
### Configuring the test backend
|
690
|
+
|
691
|
+
To use the test backend, set the `backend` configuration option to "test" in
|
692
|
+
honeybadger.yml for your test environment only:
|
693
|
+
|
694
|
+
```yaml
|
695
|
+
api_key: 'project api key'
|
696
|
+
test:
|
697
|
+
backend: test
|
698
|
+
```
|
699
|
+
|
700
|
+
You can also use the *HONEYBADGER_BACKEND* environment variable to configure the
|
701
|
+
test backend. Note that you must also configure your API key for the test to
|
702
|
+
succeed.
|
703
|
+
|
704
|
+
|
705
|
+
### Writing the integration test
|
706
|
+
|
707
|
+
The test backend can be used in any testing framework to test any code which
|
708
|
+
reports an error with `Honeybadger.notify`. A common scenario is to test the
|
709
|
+
Rails-integration which reports exceptions in a Rails controller automatically.
|
710
|
+
|
711
|
+
The following example uses RSpec to test error notification in a Rails
|
712
|
+
controller.
|
713
|
+
|
714
|
+
First, create the controller:
|
715
|
+
|
716
|
+
```ruby
|
717
|
+
# app/controllers/honeybadger_test_controller.rb
|
718
|
+
class HoneybadgerTestController < ApplicationController
|
719
|
+
ERROR = RuntimeError.new("testing reporting an error to Honeybadger")
|
720
|
+
|
721
|
+
def index
|
722
|
+
raise ERROR
|
723
|
+
end
|
724
|
+
end
|
725
|
+
```
|
726
|
+
|
727
|
+
Next, create a route. For security, it's a good idea to enable the route only in
|
728
|
+
the test environment:
|
729
|
+
|
730
|
+
```ruby
|
731
|
+
# config/routes.rb
|
732
|
+
|
733
|
+
# ...
|
734
|
+
get '/test/honeybadger' => 'honeybadger_test#index' if Rails.env.test?
|
735
|
+
```
|
736
|
+
|
737
|
+
Finally, create the integration test:
|
738
|
+
|
739
|
+
```ruby
|
740
|
+
# spec/features/honeybadger_spec.rb
|
741
|
+
require 'rails_helper'
|
742
|
+
|
743
|
+
describe "error notification" do
|
744
|
+
it "notifies Honeybadger" do
|
745
|
+
expect {
|
746
|
+
# Code to test goes here:
|
747
|
+
expect { visit '/test/honeybadger' }.to raise_error(HoneybadgerTestController::ERROR)
|
748
|
+
|
749
|
+
# Important: `Honeybadger.flush` ensures that asynchronous notifications
|
750
|
+
# are delivered before the test's remaining expectations are verified.
|
751
|
+
Honeybadger.flush
|
752
|
+
}.to change(Honeybadger::Backend::Test.notifications[:notices], :size).by(1)
|
753
|
+
expect(Honeybadger::Backend::Test.notifications[:notices].first.error_message).to eq('testing reporting an error to Honeybadger')
|
754
|
+
end
|
755
|
+
end
|
756
|
+
```
|
757
|
+
|
758
|
+
## Troubleshooting
|
759
|
+
|
760
|
+
See [TROUBLESHOOTING.md](https://github.com/honeybadger-io/honeybadger-ruby/blob/master/TROUBLESHOOTING.md)
|
761
|
+
|
485
762
|
## Changelog
|
486
763
|
|
487
764
|
See https://github.com/honeybadger-io/honeybadger-ruby/blob/master/CHANGELOG.md
|
data/TROUBLESHOOTING.md
CHANGED
@@ -8,9 +8,17 @@ one or all of our helpful founders will assist you!
|
|
8
8
|
## Upgrade the gem
|
9
9
|
|
10
10
|
Before digging deeper into this guide, **make sure you are on the latest minor
|
11
|
-
release of the honeybadger gem** (i.e.
|
11
|
+
release of the honeybadger gem** (i.e. 3.x.x). There's a chance you've found a bug
|
12
12
|
which has already been fixed!
|
13
13
|
|
14
|
+
## Send a Test Exception
|
15
|
+
|
16
|
+
You can send a test exception using the `honeybadger` command line utility:
|
17
|
+
|
18
|
+
```bash
|
19
|
+
$ honeybadger test
|
20
|
+
```
|
21
|
+
|
14
22
|
## How to enable verbose logging
|
15
23
|
|
16
24
|
Troubleshooting any of these issues will be much easier if you can see what's
|
@@ -62,6 +70,10 @@ development:
|
|
62
70
|
report_data: true
|
63
71
|
```
|
64
72
|
|
73
|
+
##### The `better_errors` gem is installed
|
74
|
+
|
75
|
+
The [`better_errors` gem](https://github.com/charliesome/better_errors) conflicts with the Honeybadger gem when in development mode. To be able to report errors from development you must first temporarily disable/remove the `better_errors` gem. Better Errors should not affect production because it should never be enabled in production.
|
76
|
+
|
65
77
|
#### Is the error ignored by default?
|
66
78
|
|
67
79
|
Honeybadger ignores [this list of
|
@@ -87,28 +99,13 @@ rescue => e
|
|
87
99
|
end
|
88
100
|
```
|
89
101
|
|
90
|
-
|
91
|
-
|
92
|
-
We currently initialize Rails and Sinatra apps automatically. If you use either
|
93
|
-
of those frameworks and are not receiving error reports, then you probably have
|
94
|
-
a different issue and should skip this section. For all other frameworks (or
|
95
|
-
plain ol' Ruby), `Honeybadger.start()` must be called manually.
|
96
|
-
|
97
|
-
To verify that Honeybadger is not started, [enable debug
|
98
|
-
logging](#how-to-enable-verbose-logging) and then start your app; if Honeybadger
|
99
|
-
was initialized, you should see something in the log output.
|
102
|
+
### I'm not receiving notifications
|
100
103
|
|
101
|
-
|
102
|
-
** [Honeybadger] Starting Honeybadger version 2.1.0 level=1 pid=18077
|
103
|
-
```
|
104
|
+
#### Was the error reported already and is unresolved?
|
104
105
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
```ruby
|
109
|
-
honeybadger_config = Honeybadger::Config.new
|
110
|
-
Honeybadger.start(honeybadger_config)
|
111
|
-
```
|
106
|
+
By default we only send notifications the first time an exception happens, and
|
107
|
+
when it re-occurs after being marked resolved. If an exception happens 100
|
108
|
+
times, but was never resolved you'll only get 1 email about it.
|
112
109
|
|
113
110
|
## Sidekiq/Resque/ActiveJob/etc.
|
114
111
|
|
@@ -129,3 +126,12 @@ behavior:
|
|
129
126
|
```
|
130
127
|
HONEYBADGER_EXCEPTIONS_IGNORE_ONLY=Error,ClassNames,Here bundle exec sidekiq
|
131
128
|
```
|
129
|
+
|
130
|
+
## Command line utility
|
131
|
+
|
132
|
+
If you get an error while running the `honeybadger` command line utility:
|
133
|
+
|
134
|
+
0. Try prefixing the command with `bundle exec`...even if you normally rely on bin-stubs to do this for you
|
135
|
+
1. Check `honeybadger help` if you're having trouble with the syntax for a specific command.
|
136
|
+
2. Try enabling [verbose logging](#how-to-enable-verbose-logging) to get more info
|
137
|
+
3. Ask Us! We're always here to help. Just copy the terminal output and email it to us at support@honeybadger.io
|
@@ -271,6 +271,11 @@ module Honeybadger
|
|
271
271
|
default: 0,
|
272
272
|
type: Integer
|
273
273
|
},
|
274
|
+
:'shoryuken.attempt_threshold' => {
|
275
|
+
description: 'The number of attempts before notifications will be sent.',
|
276
|
+
default: 0,
|
277
|
+
type: Integer
|
278
|
+
},
|
274
279
|
:'sidekiq.use_component' => {
|
275
280
|
description: 'Automatically set the component to the class of the job. Helps with grouping.',
|
276
281
|
default: true,
|
@@ -4,11 +4,6 @@ module Honeybadger
|
|
4
4
|
module Plugins
|
5
5
|
module Rails
|
6
6
|
module ExceptionsCatcher
|
7
|
-
def self.included(base)
|
8
|
-
base.send(:alias_method, :render_exception_without_honeybadger, :render_exception)
|
9
|
-
base.send(:alias_method, :render_exception, :render_exception_with_honeybadger)
|
10
|
-
end
|
11
|
-
|
12
7
|
# Internal: Adds additional Honeybadger info to Request env when an
|
13
8
|
# exception is rendered in Rails' middleware.
|
14
9
|
#
|
@@ -18,7 +13,7 @@ module Honeybadger
|
|
18
13
|
#
|
19
14
|
# Returns the super value of the middleware's #render_exception()
|
20
15
|
# method.
|
21
|
-
def
|
16
|
+
def render_exception(arg, exception)
|
22
17
|
if arg.kind_of?(::ActionDispatch::Request)
|
23
18
|
request = arg
|
24
19
|
env = request.env
|
@@ -30,7 +25,7 @@ module Honeybadger
|
|
30
25
|
env['honeybadger.exception'] = exception
|
31
26
|
env['honeybadger.request.url'] = request.url rescue nil
|
32
27
|
|
33
|
-
|
28
|
+
super(arg, exception)
|
34
29
|
end
|
35
30
|
end
|
36
31
|
|
@@ -41,10 +36,10 @@ module Honeybadger
|
|
41
36
|
require 'rack/request'
|
42
37
|
if defined?(::ActionDispatch::DebugExceptions)
|
43
38
|
# Rails 3.2.x+
|
44
|
-
::ActionDispatch::DebugExceptions.
|
39
|
+
::ActionDispatch::DebugExceptions.prepend(ExceptionsCatcher)
|
45
40
|
elsif defined?(::ActionDispatch::ShowExceptions)
|
46
41
|
# Rails 3.0.x and 3.1.x
|
47
|
-
::ActionDispatch::ShowExceptions.
|
42
|
+
::ActionDispatch::ShowExceptions.prepend(ExceptionsCatcher)
|
48
43
|
end
|
49
44
|
end
|
50
45
|
end
|
data/lib/honeybadger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: honeybadger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Honeybadger Industries LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Make managing application errors a more pleasant experience.
|
14
14
|
email:
|
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
144
|
rubyforge_project:
|
145
|
-
rubygems_version: 2.
|
145
|
+
rubygems_version: 2.6.8
|
146
146
|
signing_key:
|
147
147
|
specification_version: 4
|
148
148
|
summary: Error reports you can be happy about.
|