honeybadger 5.13.1 → 5.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +49 -0
- data/lib/honeybadger/agent.rb +12 -1
- data/lib/honeybadger/backend/test.rb +15 -0
- data/lib/honeybadger/cli/install.rb +4 -0
- data/lib/honeybadger/cli/main.rb +2 -0
- data/lib/honeybadger/cli/test.rb +10 -0
- data/lib/honeybadger/config/defaults.rb +19 -3
- data/lib/honeybadger/config.rb +24 -3
- data/lib/honeybadger/event.rb +1 -1
- data/lib/honeybadger/events_worker.rb +7 -1
- data/lib/honeybadger/init/rails.rb +4 -0
- data/lib/honeybadger/notification_subscriber.rb +5 -4
- data/lib/honeybadger/plugins/solid_queue.rb +1 -1
- data/lib/honeybadger/util/sanitizer.rb +1 -2
- data/lib/honeybadger/version.rb +1 -1
- data/lib/honeybadger/worker.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60300a5d8ccaecda5eeff8887f76c5c54dba5c4610539c4ff8865d1355a5c124
|
4
|
+
data.tar.gz: d057c93fc1a8d24f6fdb4a952d5b56cf8dbf0f3ee07466eaad38d3be2efcad13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06cdba44a37870e7b2e51414efb9ac48f5e3dc8015403a7b40e3a12520f0d037ab77f90205ea85f610de2d9bee11b6b6d5bf63fcbfce6a8d296ef8d1aeec7af9
|
7
|
+
data.tar.gz: 6538734d781bd200445e9ac603baf2fbd3b91a0e723112cb79d7468a56baaadc38921fdd75dfd4bde8ad25a67e911e3c56020dcff54f49414066abd68c83dc9a
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,55 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
3
|
|
4
|
+
## [5.15.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.14.2...v5.15.0) (2024-07-18)
|
5
|
+
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* define default events to ignore, allow for override ([#570](https://github.com/honeybadger-io/honeybadger-ruby/issues/570)) ([a6f2177](https://github.com/honeybadger-io/honeybadger-ruby/commit/a6f2177eb69b75eafef235768187ccf6b3a538f0))
|
10
|
+
|
11
|
+
## [5.14.2](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.14.1...v5.14.2) (2024-07-17)
|
12
|
+
|
13
|
+
|
14
|
+
### Bug Fixes
|
15
|
+
|
16
|
+
* add []= delegator ([#590](https://github.com/honeybadger-io/honeybadger-ruby/issues/590)) ([9f1d6b5](https://github.com/honeybadger-io/honeybadger-ruby/commit/9f1d6b55e88497c4c37659fdfaeaa163c7794672))
|
17
|
+
* add event method for cli backend test ([#588](https://github.com/honeybadger-io/honeybadger-ruby/issues/588)) ([1e047bb](https://github.com/honeybadger-io/honeybadger-ruby/commit/1e047bbcd17db676b96dd78eb918475e3a52ab1b))
|
18
|
+
|
19
|
+
## [5.14.1](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.14.0...v5.14.1) (2024-07-15)
|
20
|
+
|
21
|
+
|
22
|
+
### Bug Fixes
|
23
|
+
|
24
|
+
* do not serialize adapter object ([#586](https://github.com/honeybadger-io/honeybadger-ruby/issues/586)) ([f724ebf](https://github.com/honeybadger-io/honeybadger-ruby/commit/f724ebf0a2c3e2402c64448779cf7e6386de8b47))
|
25
|
+
|
26
|
+
## [5.14.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.13.3...v5.14.0) (2024-07-11)
|
27
|
+
|
28
|
+
|
29
|
+
### Features
|
30
|
+
|
31
|
+
* add --host and --ui_host flags to install command ([#584](https://github.com/honeybadger-io/honeybadger-ruby/issues/584)) ([5f171ba](https://github.com/honeybadger-io/honeybadger-ruby/commit/5f171badc0602df76a87e4caa0e06c9959648376))
|
32
|
+
* add ability to link to a custom domain after creating a notice ([#583](https://github.com/honeybadger-io/honeybadger-ruby/issues/583)) ([5b32b23](https://github.com/honeybadger-io/honeybadger-ruby/commit/5b32b231bb5562b3d97066e3a41f39de76b2f4a3))
|
33
|
+
|
34
|
+
|
35
|
+
### Bug Fixes
|
36
|
+
|
37
|
+
* squash warning about BigDecimal ([#578](https://github.com/honeybadger-io/honeybadger-ruby/issues/578)) ([47ff813](https://github.com/honeybadger-io/honeybadger-ruby/commit/47ff8130047b723b9d85be07b308c4883320eabb))
|
38
|
+
|
39
|
+
## [5.13.3](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.13.2...v5.13.3) (2024-07-06)
|
40
|
+
|
41
|
+
|
42
|
+
### Bug Fixes
|
43
|
+
|
44
|
+
* disable insights when loading rails console ([#580](https://github.com/honeybadger-io/honeybadger-ruby/issues/580)) ([94844bd](https://github.com/honeybadger-io/honeybadger-ruby/commit/94844bd72922f27ecf40453ef7c901433067688b))
|
45
|
+
|
46
|
+
## [5.13.2](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.13.1...v5.13.2) (2024-07-03)
|
47
|
+
|
48
|
+
|
49
|
+
### Bug Fixes
|
50
|
+
|
51
|
+
* buffer more and warn less ([#575](https://github.com/honeybadger-io/honeybadger-ruby/issues/575)) ([8e99e17](https://github.com/honeybadger-io/honeybadger-ruby/commit/8e99e17af65e8d0002e5e8204d5ded1cea891e86))
|
52
|
+
|
4
53
|
## [5.13.1](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.13.0...v5.13.1) (2024-07-01)
|
5
54
|
|
6
55
|
|
data/lib/honeybadger/agent.rb
CHANGED
@@ -404,7 +404,18 @@ module Honeybadger
|
|
404
404
|
with_error_handling { hook.call(event) }
|
405
405
|
end
|
406
406
|
|
407
|
-
return if config.ignored_events.any?
|
407
|
+
return if config.ignored_events.any? do |check|
|
408
|
+
with_error_handling do
|
409
|
+
check.all? do |keys, value|
|
410
|
+
if keys == [:event_type]
|
411
|
+
event.event_type&.match?(value)
|
412
|
+
elsif event.dig(*keys)
|
413
|
+
event.dig(*keys).to_s.match?(value)
|
414
|
+
end
|
415
|
+
end
|
416
|
+
end
|
417
|
+
end
|
418
|
+
|
408
419
|
return if event.halted?
|
409
420
|
|
410
421
|
events_worker.push(event.as_json)
|
@@ -13,6 +13,16 @@ module Honeybadger
|
|
13
13
|
@notifications ||= Hash.new {|h,k| h[k] = [] }
|
14
14
|
end
|
15
15
|
|
16
|
+
# The event list.
|
17
|
+
#
|
18
|
+
# @example
|
19
|
+
# Test.events # => [{}, {}, ...]
|
20
|
+
#
|
21
|
+
# @return [Array<Hash>] List of event payloads.
|
22
|
+
def self.events
|
23
|
+
@events ||= []
|
24
|
+
end
|
25
|
+
|
16
26
|
# @api public
|
17
27
|
# The check in list.
|
18
28
|
#
|
@@ -37,6 +47,11 @@ module Honeybadger
|
|
37
47
|
super
|
38
48
|
end
|
39
49
|
|
50
|
+
def event(payload)
|
51
|
+
events << payload
|
52
|
+
super
|
53
|
+
end
|
54
|
+
|
40
55
|
def check_in(id)
|
41
56
|
check_ins << id
|
42
57
|
super
|
@@ -78,6 +78,10 @@ debug: false
|
|
78
78
|
insights:
|
79
79
|
enabled: #{options["insights"]}
|
80
80
|
CONFIG
|
81
|
+
if (connection = options.slice("host", "ui_host")).any?
|
82
|
+
file.puts("\n# Override hosts\nconnection:")
|
83
|
+
connection.each {|k,v| file.puts(" #{k}: '#{v}'") }
|
84
|
+
end
|
81
85
|
end
|
82
86
|
end
|
83
87
|
|
data/lib/honeybadger/cli/main.rb
CHANGED
@@ -49,6 +49,8 @@ WELCOME
|
|
49
49
|
|
50
50
|
desc 'install API_KEY', 'Install Honeybadger into a new project'
|
51
51
|
option :insights, type: :boolean, aliases: :'-i', default: false, desc: 'Enable Honeybadger Insights'
|
52
|
+
option :host, type: :string
|
53
|
+
option :ui_host, type: :string
|
52
54
|
def install(api_key)
|
53
55
|
Install.new(options, api_key).run
|
54
56
|
rescue => e
|
data/lib/honeybadger/cli/test.rb
CHANGED
@@ -24,11 +24,21 @@ module Honeybadger
|
|
24
24
|
@callings ||= Hash.new {|h,k| h[k] = [] }
|
25
25
|
end
|
26
26
|
|
27
|
+
def self.events
|
28
|
+
@events ||= []
|
29
|
+
end
|
30
|
+
|
27
31
|
def notify(feature, payload)
|
28
32
|
response = @backend.notify(feature, payload)
|
29
33
|
self.class.callings[feature] << [payload, response]
|
30
34
|
response
|
31
35
|
end
|
36
|
+
|
37
|
+
def event(payload)
|
38
|
+
response = @backend.event(payload)
|
39
|
+
self.class.events << [payload, response]
|
40
|
+
response
|
41
|
+
end
|
32
42
|
end
|
33
43
|
|
34
44
|
def initialize(options)
|
@@ -31,6 +31,12 @@ module Honeybadger
|
|
31
31
|
'Sinatra::NotFound',
|
32
32
|
'Sidekiq::JobRetry::Skip'].map(&:freeze).freeze
|
33
33
|
|
34
|
+
IGNORE_EVENTS_DEFAULT = [
|
35
|
+
{ event_type: 'sql.active_record', query: /^(begin|commit)( transaction)?$/i },
|
36
|
+
{ event_type: 'sql.active_record', query: /(solid_queue|good_job)/i },
|
37
|
+
{ event_type: 'process_action.action_controller', controller: 'Rails::HealthController' }
|
38
|
+
].freeze
|
39
|
+
|
34
40
|
DEVELOPMENT_ENVIRONMENTS = ['development', 'test', 'cucumber'].map(&:freeze).freeze
|
35
41
|
|
36
42
|
DEFAULT_PATHS = ['honeybadger.yml', 'config/honeybadger.yml', "#{ENV['HOME']}/honeybadger.yml"].map(&:freeze).freeze
|
@@ -93,7 +99,7 @@ module Honeybadger
|
|
93
99
|
},
|
94
100
|
:'events.max_queue_size' => {
|
95
101
|
description: 'Maximum number of event for the event worker queue.',
|
96
|
-
default:
|
102
|
+
default: 100000,
|
97
103
|
type: Integer
|
98
104
|
},
|
99
105
|
:'events.batch_size' => {
|
@@ -112,8 +118,13 @@ module Honeybadger
|
|
112
118
|
type: Boolean
|
113
119
|
},
|
114
120
|
:'events.ignore' => {
|
115
|
-
description: 'A list of events to ignore. Use a
|
116
|
-
default:
|
121
|
+
description: 'A list of additional events to ignore. Use a hash to query nested payloads, match using a string or regex. Non-hash will match on the event_type.',
|
122
|
+
default: IGNORE_EVENTS_DEFAULT,
|
123
|
+
type: Array
|
124
|
+
},
|
125
|
+
:'events.ignore_only' => {
|
126
|
+
description: 'A list of events to ignore (overrides the default ignored events).',
|
127
|
+
default: nil,
|
117
128
|
type: Array
|
118
129
|
},
|
119
130
|
plugins: {
|
@@ -166,6 +177,11 @@ module Honeybadger
|
|
166
177
|
default: 'api.honeybadger.io'.freeze,
|
167
178
|
type: String
|
168
179
|
},
|
180
|
+
:'connection.ui_host' => {
|
181
|
+
description: 'The host to use when viewing data.',
|
182
|
+
default: 'app.honeybadger.io'.freeze,
|
183
|
+
type: String
|
184
|
+
},
|
169
185
|
:'connection.port' => {
|
170
186
|
description: 'The port to use when sending data.',
|
171
187
|
default: nil,
|
data/lib/honeybadger/config.rb
CHANGED
@@ -192,10 +192,22 @@ module Honeybadger
|
|
192
192
|
DEFAULTS[:'exceptions.ignore'] | Array(ignore)
|
193
193
|
end
|
194
194
|
|
195
|
+
def raw_ignored_events
|
196
|
+
ignore_only = get(:'events.ignore_only')
|
197
|
+
return ignore_only if ignore_only
|
198
|
+
return DEFAULTS[:'events.ignore'] unless ignore = get(:'events.ignore')
|
199
|
+
|
200
|
+
DEFAULTS[:'events.ignore'] | Array(ignore)
|
201
|
+
end
|
202
|
+
|
195
203
|
def ignored_events
|
196
|
-
|
197
|
-
check.is_a?(String)
|
198
|
-
|
204
|
+
@ignored_events ||= raw_ignored_events.map do |check|
|
205
|
+
if check.is_a?(String) || check.is_a?(Regexp)
|
206
|
+
{ [:event_type] => check }
|
207
|
+
elsif check.is_a?(Hash)
|
208
|
+
flat_hash(check).transform_keys! { |key_array| key_array.map(&:to_sym) }
|
209
|
+
end
|
210
|
+
end.compact
|
199
211
|
end
|
200
212
|
|
201
213
|
def ca_bundle_path
|
@@ -455,5 +467,14 @@ module Honeybadger
|
|
455
467
|
end
|
456
468
|
end
|
457
469
|
end
|
470
|
+
|
471
|
+
# Converts a nested hash into a single layer where keys become arrays:
|
472
|
+
# ex: > flat_hash({ :nested => { :hash => "value" }})
|
473
|
+
# > { [:nested, :hash] => "value" }
|
474
|
+
def flat_hash(h,f=[],g={})
|
475
|
+
return g.update({ f=>h }) unless h.is_a? Hash
|
476
|
+
h.each { |k,r| flat_hash(r,f+[k],g) }
|
477
|
+
g
|
478
|
+
end
|
458
479
|
end
|
459
480
|
end
|
data/lib/honeybadger/event.rb
CHANGED
@@ -39,13 +39,14 @@ module Honeybadger
|
|
39
39
|
@pid = Process.pid
|
40
40
|
@send_queue = []
|
41
41
|
@last_sent = nil
|
42
|
+
@dropped_events = 0
|
42
43
|
end
|
43
44
|
|
44
45
|
def push(msg)
|
45
46
|
return false unless start
|
46
47
|
|
47
48
|
if queue.size >= config.events_max_queue_size
|
48
|
-
|
49
|
+
@dropped_events += 1
|
49
50
|
return false
|
50
51
|
end
|
51
52
|
|
@@ -207,7 +208,12 @@ module Honeybadger
|
|
207
208
|
send_now(mutex.synchronize { send_queue })
|
208
209
|
mutex.synchronize do
|
209
210
|
@last_sent = Time.now
|
211
|
+
debug { sprintf('Sending %s events', send_queue.length) }
|
210
212
|
send_queue.clear
|
213
|
+
if @dropped_events > 0
|
214
|
+
warn { sprintf('Dropped %s messages due to exceeding max queue size of %s', @dropped_events, config.events_max_queue_size) }
|
215
|
+
end
|
216
|
+
@dropped_events = 0
|
211
217
|
end
|
212
218
|
end
|
213
219
|
|
@@ -32,6 +32,10 @@ module Honeybadger
|
|
32
32
|
config.after_initialize do
|
33
33
|
Honeybadger.load_plugins!
|
34
34
|
end
|
35
|
+
|
36
|
+
console do
|
37
|
+
Honeybadger::Agent.instance.config[:'insights.enabled'] = false unless Honeybadger::Agent.instance.config.env.has_key?(:'insights.enabled')
|
38
|
+
end
|
35
39
|
end
|
36
40
|
end
|
37
41
|
end
|
@@ -66,7 +66,6 @@ module Honeybadger
|
|
66
66
|
|
67
67
|
def process?(event, payload)
|
68
68
|
return false if payload[:name] == "SCHEMA"
|
69
|
-
return false if payload[:sql]&.match?(/^(begin|commit)( transaction)?$/i)
|
70
69
|
true
|
71
70
|
end
|
72
71
|
end
|
@@ -74,8 +73,10 @@ module Honeybadger
|
|
74
73
|
class ActiveJobSubscriber < NotificationSubscriber
|
75
74
|
def format_payload(payload)
|
76
75
|
job = payload[:job]
|
77
|
-
payload
|
78
|
-
|
76
|
+
adapter = payload[:adapter]
|
77
|
+
payload.except(:job, :adapter).merge({
|
78
|
+
adapter_class: adapter.class.to_s,
|
79
|
+
job_class: job.class.to_s,
|
79
80
|
job_id: job.job_id,
|
80
81
|
queue_name: job.queue_name
|
81
82
|
})
|
@@ -87,7 +88,7 @@ module Honeybadger
|
|
87
88
|
|
88
89
|
def format_payload(payload)
|
89
90
|
{
|
90
|
-
job_class: payload[:job].class,
|
91
|
+
job_class: payload[:job].class.to_s,
|
91
92
|
queue_name: payload[:job].queue_name
|
92
93
|
}
|
93
94
|
end
|
@@ -2,7 +2,7 @@ module Honeybadger
|
|
2
2
|
module Plugins
|
3
3
|
module SolidQueue
|
4
4
|
Plugin.register :solid_queue do
|
5
|
-
requirement { defined?(::SolidQueue) }
|
5
|
+
requirement { config.load_plugin_insights?(:solid_queue) && defined?(::SolidQueue) }
|
6
6
|
|
7
7
|
collect do
|
8
8
|
if config.cluster_collection?(:solid_queue)
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'bigdecimal'
|
2
1
|
require 'set'
|
3
2
|
|
4
3
|
require 'honeybadger/conversions'
|
@@ -21,7 +20,7 @@ module Honeybadger
|
|
21
20
|
RECURSION = '[RECURSION]'.freeze
|
22
21
|
TRUNCATED = '[TRUNCATED]'.freeze
|
23
22
|
|
24
|
-
IMMUTABLE = [NilClass, FalseClass, TrueClass, Symbol, Numeric,
|
23
|
+
IMMUTABLE = [NilClass, FalseClass, TrueClass, Symbol, Numeric, Method].freeze
|
25
24
|
|
26
25
|
MAX_STRING_SIZE = 65536
|
27
26
|
|
data/lib/honeybadger/version.rb
CHANGED
data/lib/honeybadger/worker.rb
CHANGED
@@ -226,10 +226,11 @@ module Honeybadger
|
|
226
226
|
when 413
|
227
227
|
warn { sprintf('Error report failed: Payload is too large. id=%s code=%s', msg.id, response.code) }
|
228
228
|
when 201
|
229
|
+
host = config.get(:'connection.ui_host')
|
229
230
|
if throttle = dec_throttle
|
230
|
-
info { sprintf('Success ⚡ https
|
231
|
+
info { sprintf('Success ⚡ https://%s/notice/%s id=%s code=%s throttle=%s interval=%s', host, msg.id, msg.id, response.code, throttle, throttle_interval) }
|
231
232
|
else
|
232
|
-
info { sprintf('Success ⚡ https
|
233
|
+
info { sprintf('Success ⚡ https://%s/notice/%s id=%s code=%s', host, msg.id, msg.id, response.code) }
|
233
234
|
end
|
234
235
|
when :stubbed
|
235
236
|
info { sprintf('Success ⚡ Development mode is enabled; this error will be reported if it occurs after you deploy your app. id=%s', msg.id) }
|
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: 5.
|
4
|
+
version: 5.15.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: 2024-07-
|
11
|
+
date: 2024-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Make managing application errors a more pleasant experience.
|
14
14
|
email:
|