honeybadger 3.0.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +7 -3
- data/lib/honeybadger/backend/base.rb +6 -1
- data/lib/honeybadger/cli/deploy.rb +5 -3
- data/lib/honeybadger/cli/exec.rb +3 -1
- data/lib/honeybadger/cli/helpers.rb +28 -0
- data/lib/honeybadger/cli/heroku.rb +1 -1
- data/lib/honeybadger/cli/install.rb +4 -3
- data/lib/honeybadger/cli/main.rb +25 -4
- data/lib/honeybadger/cli/notify.rb +5 -4
- data/lib/honeybadger/cli/test.rb +67 -66
- data/lib/honeybadger/config.rb +23 -20
- data/lib/honeybadger/config/yaml.rb +19 -1
- data/lib/honeybadger/plugins/rails.rb +1 -1
- data/lib/honeybadger/plugins/shoryuken.rb +20 -9
- data/lib/honeybadger/rack/user_feedback.rb +2 -0
- data/lib/honeybadger/rack/user_informer.rb +2 -0
- data/lib/honeybadger/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5a85ec9c99acf790b1dba514a10a36583c6f9704
|
|
4
|
+
data.tar.gz: fc26320ade5dea6c6a655d8fcbeddfd02b227f9c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 42e9fd0591c0a5f9830a94cf8014b67956c1908b857b031b664f2d7de872db58e6d2f43123a08dcc5c3ab58a6d82b4ea6fc195869d39e01414809bd548ae867d
|
|
7
|
+
data.tar.gz: 2669f5ecba56140789ff06ee00fe46c8b1274d4d95a1576fe4b2a2dba5089f27326e5d328eea7c2d468bd1d9af7f4450aa06d9c119d2d537126326f20daa0a4c
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,22 @@ adheres to [Semantic Versioning](http://semver.org/).
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [3.1.0] - 2017-03-01
|
|
9
|
+
### Changed
|
|
10
|
+
- Exceptions encountered while loading/evaluating honeybadger.yml are now raised
|
|
11
|
+
instead of logged.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- Friendlier backtraces for exceptions originating in honeybadger.yml.
|
|
15
|
+
- Notify errors in Shoryuken batches -@phstc
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- Rails environment is now loaded when running `honeybadger` cli from a Rails
|
|
19
|
+
root. This fixes an issue where programmatic configuration from Rails was not
|
|
20
|
+
loaded.
|
|
21
|
+
- Fixed logger isn't being overridden properly when configuring with
|
|
22
|
+
Honeybadger.configure -@anujbiyani
|
|
23
|
+
|
|
8
24
|
## [3.0.2] - 2017-02-16
|
|
9
25
|
### Fixed
|
|
10
26
|
- Fixed a bug caused by an interaction with the semantic\_logger gem.
|
data/README.md
CHANGED
|
@@ -286,7 +286,7 @@ You can use any of the options below in your config file, or in the environment.
|
|
|
286
286
|
|
|
287
287
|
Sometimes, default exception data just isn't enough. If you have extra data that will help you in debugging, send it as part of an error's context. [View full method documentation](http://www.rubydoc.info/gems/honeybadger/Honeybadger%3Acontext)
|
|
288
288
|
|
|
289
|
-
Global context is stored in a thread local variable and automatically reported with any exception which
|
|
289
|
+
Global context is stored in a thread local variable and automatically reported with any exception which occurs within the current thread's execution.
|
|
290
290
|
|
|
291
291
|
#### Use this method if:
|
|
292
292
|
|
|
@@ -486,9 +486,13 @@ en:
|
|
|
486
486
|
|
|
487
487
|
See https://github.com/honeybadger-io/honeybadger-ruby/blob/master/CHANGELOG.md
|
|
488
488
|
|
|
489
|
-
##
|
|
489
|
+
## Development
|
|
490
490
|
|
|
491
|
-
If you're adding a new feature, please [submit an issue](https://github.com/honeybadger-io/honeybadger-ruby/issues/new) as a preliminary step; that way you can be (moderately) sure that your pull request will be accepted.
|
|
491
|
+
Pull requests are welcome. If you're adding a new feature, please [submit an issue](https://github.com/honeybadger-io/honeybadger-ruby/issues/new) as a preliminary step; that way you can be (moderately) sure that your pull request will be accepted.
|
|
492
|
+
|
|
493
|
+
If you're integrating your gem/open source project with Honeybadger, please consider submitting an official plugin to our gem. [Submit an issue](https://github.com/honeybadger-io/honeybadger-ruby/issues/new) to discuss with us!
|
|
494
|
+
|
|
495
|
+
We use [TomDoc](http://tomdoc.org/) to document our API. Classes and methods which are safe to depend on in your gems/projects are marked "Public". All other classes/methods are considered internal and may change without notice -- don't depend on them! If you need a new public API, we're happy to work with you. [Submit an issue](https://github.com/honeybadger-io/honeybadger-ruby/issues/new) to discuss.
|
|
492
496
|
|
|
493
497
|
### To contribute your code:
|
|
494
498
|
|
|
@@ -45,7 +45,12 @@ module Honeybadger
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def error_message
|
|
48
|
-
|
|
48
|
+
return message if code == :error
|
|
49
|
+
return FRIENDLY_ERRORS[code] if FRIENDLY_ERRORS[code]
|
|
50
|
+
return error if error =~ NOT_BLANK
|
|
51
|
+
msg = "The server responded with #{code}"
|
|
52
|
+
msg << ": #{message}" if message =~ NOT_BLANK
|
|
53
|
+
msg
|
|
49
54
|
end
|
|
50
55
|
|
|
51
56
|
private
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
require 'forwardable'
|
|
2
2
|
require 'honeybadger/cli/main'
|
|
3
|
+
require 'honeybadger/cli/helpers'
|
|
3
4
|
require 'honeybadger/util/http'
|
|
4
5
|
|
|
5
6
|
module Honeybadger
|
|
6
7
|
module CLI
|
|
7
8
|
class Deploy
|
|
8
9
|
extend Forwardable
|
|
10
|
+
include Helpers::BackendCmd
|
|
9
11
|
|
|
10
12
|
def initialize(options, args, config)
|
|
11
13
|
@options = options
|
|
@@ -22,11 +24,11 @@ module Honeybadger
|
|
|
22
24
|
local_username: options['user']
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
if
|
|
27
|
+
response = config.backend.notify(:deploys, payload)
|
|
28
|
+
if response.success?
|
|
27
29
|
say("Deploy notification complete.", :green)
|
|
28
30
|
else
|
|
29
|
-
say(
|
|
31
|
+
say(error_message(response), :red)
|
|
30
32
|
exit(1)
|
|
31
33
|
end
|
|
32
34
|
end
|
data/lib/honeybadger/cli/exec.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require 'erb'
|
|
2
2
|
require 'forwardable'
|
|
3
3
|
require 'honeybadger/cli/main'
|
|
4
|
+
require 'honeybadger/cli/helpers'
|
|
4
5
|
require 'honeybadger/util/http'
|
|
5
6
|
require 'honeybadger/util/stats'
|
|
6
7
|
require 'open3'
|
|
@@ -11,6 +12,7 @@ module Honeybadger
|
|
|
11
12
|
module CLI
|
|
12
13
|
class Exec
|
|
13
14
|
extend Forwardable
|
|
15
|
+
include Helpers::BackendCmd
|
|
14
16
|
|
|
15
17
|
FAILED_TEMPLATE = <<-MSG
|
|
16
18
|
Honeybadger detected failure or error output for the command:
|
|
@@ -87,7 +89,7 @@ MSG
|
|
|
87
89
|
|
|
88
90
|
if !response.success?
|
|
89
91
|
say(result.msg)
|
|
90
|
-
say(
|
|
92
|
+
say(error_message(response), :red)
|
|
91
93
|
exit(1)
|
|
92
94
|
end
|
|
93
95
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Honeybadger
|
|
2
|
+
module CLI
|
|
3
|
+
module Helpers
|
|
4
|
+
module BackendCmd
|
|
5
|
+
def error_message(response)
|
|
6
|
+
host = config.get(:'connection.host')
|
|
7
|
+
<<-MSG
|
|
8
|
+
!! --- Honeybadger request failed --------------------------------------------- !!
|
|
9
|
+
|
|
10
|
+
We encountered an error when contacting the server:
|
|
11
|
+
|
|
12
|
+
#{response.error_message}
|
|
13
|
+
|
|
14
|
+
To fix this issue, please try the following:
|
|
15
|
+
|
|
16
|
+
- Make sure the gem is configured properly.
|
|
17
|
+
- Retry executing this command a few times.
|
|
18
|
+
- Make sure you can connect to #{host} (`ping #{host}`).
|
|
19
|
+
- Email support@honeybadger.io for help. Include as much debug info as you
|
|
20
|
+
can for a faster resolution!
|
|
21
|
+
|
|
22
|
+
!! --- End -------------------------------------------------------------------- !!
|
|
23
|
+
MSG
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -19,12 +19,13 @@ module Honeybadger
|
|
|
19
19
|
|
|
20
20
|
begin
|
|
21
21
|
require File.join(Dir.pwd, 'config', 'application.rb')
|
|
22
|
+
raise LoadError unless defined?(::Rails.application)
|
|
23
|
+
root = Rails.root
|
|
24
|
+
config_root = root.join('config')
|
|
22
25
|
rescue LoadError
|
|
23
|
-
|
|
26
|
+
root = config_root = Pathname.new(Dir.pwd)
|
|
24
27
|
end
|
|
25
28
|
|
|
26
|
-
root = defined?(Rails.root) ? Rails.root : Pathname.new(Dir.pwd)
|
|
27
|
-
config_root = defined?(Rails.root) ? root.join('config') : root
|
|
28
29
|
config_path = config_root.join('honeybadger.yml')
|
|
29
30
|
|
|
30
31
|
if config_path.exist?
|
data/lib/honeybadger/cli/main.rb
CHANGED
|
@@ -6,6 +6,7 @@ require 'honeybadger/cli/notify'
|
|
|
6
6
|
require 'honeybadger/cli/test'
|
|
7
7
|
require 'honeybadger/config'
|
|
8
8
|
require 'honeybadger/config/defaults'
|
|
9
|
+
require 'honeybadger/ruby'
|
|
9
10
|
require 'honeybadger/util/http'
|
|
10
11
|
require 'honeybadger/version'
|
|
11
12
|
require 'logger'
|
|
@@ -137,15 +138,35 @@ WELCOME
|
|
|
137
138
|
end
|
|
138
139
|
|
|
139
140
|
def build_config(options)
|
|
140
|
-
|
|
141
|
+
load_env
|
|
142
|
+
|
|
143
|
+
config = Honeybadger.config
|
|
144
|
+
config.set(:report_data, true)
|
|
141
145
|
config.set(:api_key, fetch_value(options, 'api_key')) if options.has_key?('api_key')
|
|
142
146
|
config.set(:env, fetch_value(options, 'environment')) if options.has_key?('environment')
|
|
143
|
-
|
|
144
|
-
framework: :cli
|
|
145
|
-
})
|
|
147
|
+
|
|
146
148
|
config
|
|
147
149
|
end
|
|
148
150
|
|
|
151
|
+
def load_env
|
|
152
|
+
# Initialize Rails when running from Rails root.
|
|
153
|
+
environment_rb = File.join(Dir.pwd, 'config', 'environment.rb')
|
|
154
|
+
load_rails_env(environment_rb) if File.exists?(environment_rb)
|
|
155
|
+
|
|
156
|
+
# Ensure config is loaded (will be skipped if initialized by Rails).
|
|
157
|
+
Honeybadger.config.load!
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def load_rails_env(environment_rb)
|
|
161
|
+
begin
|
|
162
|
+
require 'rails'
|
|
163
|
+
rescue LoadError
|
|
164
|
+
# No Rails, so skip loading Rails environment.
|
|
165
|
+
return
|
|
166
|
+
end
|
|
167
|
+
require environment_rb
|
|
168
|
+
end
|
|
169
|
+
|
|
149
170
|
def log_error(e)
|
|
150
171
|
case e
|
|
151
172
|
when *Util::HTTP::ERRORS
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require 'digest'
|
|
2
2
|
require 'forwardable'
|
|
3
3
|
require 'honeybadger/cli/main'
|
|
4
|
+
require 'honeybadger/cli/helpers'
|
|
4
5
|
require 'honeybadger/util/http'
|
|
5
6
|
require 'honeybadger/util/stats'
|
|
6
7
|
|
|
@@ -8,6 +9,7 @@ module Honeybadger
|
|
|
8
9
|
module CLI
|
|
9
10
|
class Notify
|
|
10
11
|
extend Forwardable
|
|
12
|
+
include Helpers::BackendCmd
|
|
11
13
|
|
|
12
14
|
def initialize(options, args, config)
|
|
13
15
|
@options = options
|
|
@@ -42,12 +44,11 @@ module Honeybadger
|
|
|
42
44
|
|
|
43
45
|
payload.delete(:request) if payload[:request].empty?
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if result.code == '201'
|
|
47
|
+
response = config.backend.notify(:notices, payload)
|
|
48
|
+
if response.success?
|
|
48
49
|
say("Error notification complete.", :green)
|
|
49
50
|
else
|
|
50
|
-
say(
|
|
51
|
+
say(error_message(response), :red)
|
|
51
52
|
exit(1)
|
|
52
53
|
end
|
|
53
54
|
end
|
data/lib/honeybadger/cli/test.rb
CHANGED
|
@@ -37,13 +37,9 @@ module Honeybadger
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def run
|
|
40
|
-
require 'honeybadger/ruby'
|
|
41
|
-
|
|
42
40
|
begin
|
|
43
|
-
require File.join(Dir.pwd, 'config', '
|
|
44
|
-
raise LoadError unless defined?(::Rails)
|
|
45
|
-
require 'honeybadger/init/rails'
|
|
46
|
-
Rails.application.initialize!
|
|
41
|
+
require File.join(Dir.pwd, 'config', 'environment.rb')
|
|
42
|
+
raise LoadError unless defined?(::Rails.application)
|
|
47
43
|
say("Detected Rails #{Rails::VERSION::STRING}")
|
|
48
44
|
rescue LoadError
|
|
49
45
|
require 'honeybadger/init/ruby'
|
|
@@ -59,65 +55,8 @@ module Honeybadger
|
|
|
59
55
|
Honeybadger.config.backend = test_backend
|
|
60
56
|
|
|
61
57
|
at_exit do
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if calling = TestBackend.callings[:notices].find {|c| c[0].exception.eql?(TEST_EXCEPTION) }
|
|
65
|
-
notice, response = *calling
|
|
66
|
-
|
|
67
|
-
if response.code != 201
|
|
68
|
-
host = Honeybadger.config.get(:'connection.host')
|
|
69
|
-
say(<<-MSG, :red)
|
|
70
|
-
!! --- Honeybadger test failed ------------------------------------------------ !!
|
|
71
|
-
|
|
72
|
-
The error notifier is installed, but we encountered an error:
|
|
73
|
-
|
|
74
|
-
#{response.code.kind_of?(Integer) ? "(#{response.code}) " : nil}#{response.error_message}
|
|
75
|
-
|
|
76
|
-
To fix this issue, please try the following:
|
|
77
|
-
|
|
78
|
-
- Make sure the gem is configured properly.
|
|
79
|
-
- Retry executing this command a few times.
|
|
80
|
-
- Make sure you can connect to #{host} (`ping #{host}`).
|
|
81
|
-
- Email support@honeybadger.io for help. Include as much debug info as you
|
|
82
|
-
can for a faster resolution!
|
|
83
|
-
|
|
84
|
-
!! --- End -------------------------------------------------------------------- !!
|
|
85
|
-
MSG
|
|
86
|
-
exit(1)
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
say(generate_success_message(response), :green)
|
|
90
|
-
|
|
91
|
-
exit(0)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
say(<<-MSG, :red)
|
|
95
|
-
!! --- Honeybadger test failed ------------------------------------------------ !!
|
|
96
|
-
|
|
97
|
-
Error: The test exception was not reported; the application may not be
|
|
98
|
-
configured properly.
|
|
99
|
-
|
|
100
|
-
This is usually caused by one of the following issues:
|
|
101
|
-
|
|
102
|
-
- There was a problem loading your application. Check your logs to see if a
|
|
103
|
-
different exception is being raised.
|
|
104
|
-
- The exception is being rescued before it reaches our Rack middleware. If
|
|
105
|
-
you're using `rescue` or `rescue_from` you may need to notify Honeybadger
|
|
106
|
-
manually: `Honeybadger.notify(exception)`.
|
|
107
|
-
- The honeybadger gem is misconfigured. Check the settings in your
|
|
108
|
-
honeybadger.yml file.
|
|
109
|
-
MSG
|
|
110
|
-
|
|
111
|
-
notices = TestBackend.callings[:notices].map(&:first)
|
|
112
|
-
unless notices.empty?
|
|
113
|
-
say("\nThe following errors were reported:", :red)
|
|
114
|
-
notices.each {|n| say("\n - #{n.error_class}: #{n.error_message}", :red) }
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
say("\nSee https://git.io/vXCYp for more troubleshooting help.\n\n", :red)
|
|
118
|
-
say("!! --- End -------------------------------------------------------------------- !!", :red)
|
|
119
|
-
|
|
120
|
-
exit(1)
|
|
58
|
+
# Exceptions will already be reported when exiting.
|
|
59
|
+
verify_test unless $!
|
|
121
60
|
end
|
|
122
61
|
|
|
123
62
|
run_test
|
|
@@ -130,7 +69,7 @@ MSG
|
|
|
130
69
|
def_delegator :@shell, :say
|
|
131
70
|
|
|
132
71
|
def run_test
|
|
133
|
-
if defined?(::Rails.application)
|
|
72
|
+
if defined?(::Rails.application) && ::Rails.application
|
|
134
73
|
run_rails_test
|
|
135
74
|
else
|
|
136
75
|
run_standalone_test
|
|
@@ -217,6 +156,68 @@ MSG
|
|
|
217
156
|
::Rails.application.call(env)
|
|
218
157
|
end
|
|
219
158
|
|
|
159
|
+
def verify_test
|
|
160
|
+
Honeybadger.flush
|
|
161
|
+
|
|
162
|
+
if calling = TestBackend.callings[:notices].find {|c| c[0].exception.eql?(TEST_EXCEPTION) }
|
|
163
|
+
notice, response = *calling
|
|
164
|
+
|
|
165
|
+
if response.code != 201
|
|
166
|
+
host = Honeybadger.config.get(:'connection.host')
|
|
167
|
+
say(<<-MSG, :red)
|
|
168
|
+
!! --- Honeybadger test failed ------------------------------------------------ !!
|
|
169
|
+
|
|
170
|
+
The error notifier is installed, but we encountered an error:
|
|
171
|
+
|
|
172
|
+
#{response.error_message}
|
|
173
|
+
|
|
174
|
+
To fix this issue, please try the following:
|
|
175
|
+
|
|
176
|
+
- Make sure the gem is configured properly.
|
|
177
|
+
- Retry executing this command a few times.
|
|
178
|
+
- Make sure you can connect to #{host} (`ping #{host}`).
|
|
179
|
+
- Email support@honeybadger.io for help. Include as much debug info as you
|
|
180
|
+
can for a faster resolution!
|
|
181
|
+
|
|
182
|
+
!! --- End -------------------------------------------------------------------- !!
|
|
183
|
+
MSG
|
|
184
|
+
exit(1)
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
say(generate_success_message(response), :green)
|
|
188
|
+
|
|
189
|
+
exit(0)
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
say(<<-MSG, :red)
|
|
193
|
+
!! --- Honeybadger test failed ------------------------------------------------ !!
|
|
194
|
+
|
|
195
|
+
Error: The test exception was not reported; the application may not be
|
|
196
|
+
configured properly.
|
|
197
|
+
|
|
198
|
+
This is usually caused by one of the following issues:
|
|
199
|
+
|
|
200
|
+
- There was a problem loading your application. Check your logs to see if a
|
|
201
|
+
different exception is being raised.
|
|
202
|
+
- The exception is being rescued before it reaches our Rack middleware. If
|
|
203
|
+
you're using `rescue` or `rescue_from` you may need to notify Honeybadger
|
|
204
|
+
manually: `Honeybadger.notify(exception)`.
|
|
205
|
+
- The honeybadger gem is misconfigured. Check the settings in your
|
|
206
|
+
honeybadger.yml file.
|
|
207
|
+
MSG
|
|
208
|
+
|
|
209
|
+
notices = TestBackend.callings[:notices].map(&:first)
|
|
210
|
+
unless notices.empty?
|
|
211
|
+
say("\nThe following errors were reported:", :red)
|
|
212
|
+
notices.each {|n| say("\n - #{n.error_class}: #{n.error_message}", :red) }
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
say("\nSee https://git.io/vXCYp for more troubleshooting help.\n\n", :red)
|
|
216
|
+
say("!! --- End -------------------------------------------------------------------- !!", :red)
|
|
217
|
+
|
|
218
|
+
exit(1)
|
|
219
|
+
end
|
|
220
|
+
|
|
220
221
|
def generate_success_message(response)
|
|
221
222
|
notice_id = JSON.parse(response.body)['id']
|
|
222
223
|
notice_url = "https://app.honeybadger.io/notice/#{notice_id}"
|
data/lib/honeybadger/config.rb
CHANGED
|
@@ -13,7 +13,9 @@ require 'honeybadger/util/revision'
|
|
|
13
13
|
require 'honeybadger/logging'
|
|
14
14
|
|
|
15
15
|
module Honeybadger
|
|
16
|
-
# Internal
|
|
16
|
+
# Internal: The Config class is used to manage Honeybadger's initialization
|
|
17
|
+
# and configuration. Please don't depend on any internal classes or methods
|
|
18
|
+
# outside of Honeybadger as they may change without notice.
|
|
17
19
|
class Config
|
|
18
20
|
extend Forwardable
|
|
19
21
|
|
|
@@ -48,14 +50,24 @@ module Honeybadger
|
|
|
48
50
|
# initialization. This is not required for the notifier to work (i.e. with
|
|
49
51
|
# `require 'honeybadger/ruby'`).
|
|
50
52
|
def init!(opts = {}, env = ENV)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
load_config_from_disk {|yaml| self.yaml = yaml.freeze }
|
|
54
|
-
detect_revision!
|
|
53
|
+
load!(framework: opts, env: env)
|
|
54
|
+
|
|
55
55
|
init_logging!
|
|
56
56
|
init_backend!
|
|
57
|
+
|
|
57
58
|
logger.info(sprintf('Initializing Honeybadger Error Tracker for Ruby. Ship it! version=%s framework=%s', Honeybadger::VERSION, detected_framework))
|
|
58
59
|
logger.warn('Entering development mode: data will not be reported.') if dev? && backend.kind_of?(Backend::Null)
|
|
60
|
+
|
|
61
|
+
self
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def load!(framework: {}, env: ENV)
|
|
65
|
+
return self if @loaded
|
|
66
|
+
self.framework = framework.freeze
|
|
67
|
+
self.env = Env.new(env).freeze
|
|
68
|
+
load_config_from_disk {|yaml| self.yaml = yaml.freeze }
|
|
69
|
+
detect_revision!
|
|
70
|
+
@loaded = true
|
|
59
71
|
self
|
|
60
72
|
end
|
|
61
73
|
|
|
@@ -63,7 +75,7 @@ module Honeybadger
|
|
|
63
75
|
ruby_config = Ruby.new(self)
|
|
64
76
|
yield(ruby_config)
|
|
65
77
|
self.ruby = ruby.merge(ruby_config).freeze
|
|
66
|
-
@
|
|
78
|
+
@logger = @backend = nil
|
|
67
79
|
self
|
|
68
80
|
end
|
|
69
81
|
|
|
@@ -96,7 +108,7 @@ module Honeybadger
|
|
|
96
108
|
|
|
97
109
|
def set(key, value)
|
|
98
110
|
self.ruby = ruby.merge(key => value).freeze
|
|
99
|
-
@
|
|
111
|
+
@logger = @backend = nil
|
|
100
112
|
end
|
|
101
113
|
alias []= :set
|
|
102
114
|
|
|
@@ -225,7 +237,7 @@ module Honeybadger
|
|
|
225
237
|
includes_token?(self[:plugins], name)
|
|
226
238
|
end
|
|
227
239
|
|
|
228
|
-
#
|
|
240
|
+
# Match the project root.
|
|
229
241
|
#
|
|
230
242
|
# Returns Regexp matching the project root in a file string.
|
|
231
243
|
def root_regexp
|
|
@@ -269,7 +281,7 @@ module Honeybadger
|
|
|
269
281
|
set(:revision, Util::Revision.detect(self[:root]))
|
|
270
282
|
end
|
|
271
283
|
|
|
272
|
-
#
|
|
284
|
+
# Optional path to honeybadger.log log file.
|
|
273
285
|
#
|
|
274
286
|
# Returns the Pathname log path if a log path was specified.
|
|
275
287
|
def log_path
|
|
@@ -278,7 +290,7 @@ module Honeybadger
|
|
|
278
290
|
locate_absolute_path(self[:'logging.path'], self[:root])
|
|
279
291
|
end
|
|
280
292
|
|
|
281
|
-
#
|
|
293
|
+
# Path to honeybadger.yml configuration file; this should be the
|
|
282
294
|
# root directory if no path was specified.
|
|
283
295
|
#
|
|
284
296
|
# Returns the Pathname configuration path.
|
|
@@ -354,7 +366,7 @@ module Honeybadger
|
|
|
354
366
|
@logger = Logging::ConfigLogger.new(self, build_logger)
|
|
355
367
|
end
|
|
356
368
|
|
|
357
|
-
#
|
|
369
|
+
# Does collection include the String value or Symbol value?
|
|
358
370
|
#
|
|
359
371
|
# obj - The Array object, if present.
|
|
360
372
|
# value - The value which may exist within Array obj.
|
|
@@ -380,15 +392,6 @@ module Honeybadger
|
|
|
380
392
|
yield(yml) if block_given?
|
|
381
393
|
end
|
|
382
394
|
end
|
|
383
|
-
rescue ConfigError => e
|
|
384
|
-
error("Error loading config from disk: #{e}")
|
|
385
|
-
nil
|
|
386
|
-
rescue StandardError => e
|
|
387
|
-
error {
|
|
388
|
-
msg = "Error loading config from disk. class=%s message=%s\n\t%s"
|
|
389
|
-
sprintf(msg, e.class, e.message.dump, Array(e.backtrace).join("\n\t"))
|
|
390
|
-
}
|
|
391
|
-
nil
|
|
392
395
|
end
|
|
393
396
|
|
|
394
397
|
def undotify_keys(hash)
|
|
@@ -25,7 +25,25 @@ module Honeybadger
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def self.load_yaml(path)
|
|
28
|
-
|
|
28
|
+
begin
|
|
29
|
+
yaml = YAML.load(ERB.new(path.read).result)
|
|
30
|
+
rescue => e
|
|
31
|
+
config_error = ConfigError.new(e.to_s)
|
|
32
|
+
|
|
33
|
+
if e.backtrace
|
|
34
|
+
backtrace = e.backtrace.map do |line|
|
|
35
|
+
if line.start_with?('(erb)'.freeze)
|
|
36
|
+
line.gsub('(erb)'.freeze, path.to_s)
|
|
37
|
+
else
|
|
38
|
+
line
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
config_error.set_backtrace(backtrace)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
raise config_error
|
|
45
|
+
end
|
|
46
|
+
|
|
29
47
|
case yaml
|
|
30
48
|
when Hash
|
|
31
49
|
yaml
|
|
@@ -5,26 +5,37 @@ module Honeybadger
|
|
|
5
5
|
module Plugins
|
|
6
6
|
module Shoryuken
|
|
7
7
|
class Middleware
|
|
8
|
-
def call(
|
|
9
|
-
if sqs_msg.is_a?(Array)
|
|
10
|
-
yield
|
|
11
|
-
return
|
|
12
|
-
end
|
|
13
|
-
|
|
8
|
+
def call(_worker, _queue, sqs_msg, body)
|
|
14
9
|
Honeybadger.flush do
|
|
15
10
|
begin
|
|
16
11
|
yield
|
|
17
12
|
rescue => e
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Honeybadger.notify(e, parameters: body)
|
|
13
|
+
if attempt_threshold <= receive_count(sqs_msg)
|
|
14
|
+
Honeybadger.notify(e, parameters: notification_params(body))
|
|
21
15
|
end
|
|
16
|
+
|
|
22
17
|
raise e
|
|
23
18
|
end
|
|
24
19
|
end
|
|
25
20
|
ensure
|
|
26
21
|
Honeybadger.context.clear!
|
|
27
22
|
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def attempt_threshold
|
|
27
|
+
::Honeybadger.config[:'shoryuken.attempt_threshold'].to_i
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def receive_count(sqs_msg)
|
|
31
|
+
return 0 if sqs_msg.is_a?(Array)
|
|
32
|
+
|
|
33
|
+
sqs_msg.attributes['ApproximateReceiveCount'.freeze].to_i
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def notification_params(body)
|
|
37
|
+
body.is_a?(Array) ? { batch: body } : { body: body }
|
|
38
|
+
end
|
|
28
39
|
end
|
|
29
40
|
|
|
30
41
|
Plugin.register do
|
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.0
|
|
4
|
+
version: 3.1.0
|
|
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-03-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Make managing application errors a more pleasant experience.
|
|
14
14
|
email:
|
|
@@ -35,6 +35,7 @@ files:
|
|
|
35
35
|
- lib/honeybadger/cli.rb
|
|
36
36
|
- lib/honeybadger/cli/deploy.rb
|
|
37
37
|
- lib/honeybadger/cli/exec.rb
|
|
38
|
+
- lib/honeybadger/cli/helpers.rb
|
|
38
39
|
- lib/honeybadger/cli/heroku.rb
|
|
39
40
|
- lib/honeybadger/cli/install.rb
|
|
40
41
|
- lib/honeybadger/cli/main.rb
|
|
@@ -141,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
141
142
|
version: '0'
|
|
142
143
|
requirements: []
|
|
143
144
|
rubyforge_project:
|
|
144
|
-
rubygems_version: 2.
|
|
145
|
+
rubygems_version: 2.5.1
|
|
145
146
|
signing_key:
|
|
146
147
|
specification_version: 4
|
|
147
148
|
summary: Error reports you can be happy about.
|