honeybadger 5.14.2 → 5.15.1

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
  SHA256:
3
- metadata.gz: 6a266a536f678ad185e842fb49965060a83a9212bc9e0d83b82676eda7ee339e
4
- data.tar.gz: efe4451de8be26102391b0e15269a175b446250bb81d0076807f0137497e959a
3
+ metadata.gz: 53470c49dca6dd18cc027497e441431f1b6871d47ddeb17ee00656dfefe49d18
4
+ data.tar.gz: e100a3d9279cd5986b16de62c25cf5d2b40f5bafad03bf0dc6560af1ebf966b3
5
5
  SHA512:
6
- metadata.gz: d72c1b0452f68bfae263c9ceaca636b8201e20f4a902ea8498dfc174251ca3a8e3f72e3043aae0cf2e43a972ac35a94c051f1ee113b2b0ff344a021f4caeded9
7
- data.tar.gz: f2b3511ec5b6cb683a593424831e05475320fc398063ab948a81fb946dfff45656c9df7da3ac0a02f9af050747d58dbf9b94aa661855fbc688814a85660e8faa
6
+ metadata.gz: adef30d0aa32a2933cec0513cbb64e0b0a024d2e8b486b8c3f8da662996337f60537f0d228a28ef2b4a36449cb8ac986588ee1d7b7e737716fa44767e23c9961
7
+ data.tar.gz: dbc9fd40eb13d435365cad321d604aaa0403ccc88184ae11087f11c3fdfb834da02a96a7c3281fc340956f9dcde38bcfeec097fe2d62be960291e6a545e371b2
data/CHANGELOG.md CHANGED
@@ -1,6 +1,21 @@
1
1
  # Change Log
2
2
 
3
3
 
4
+ ## [5.15.1](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.15.0...v5.15.1) (2024-07-23)
5
+
6
+
7
+ ### Bug Fixes
8
+
9
+ * safe navigate adapter_name for payload connection ([#593](https://github.com/honeybadger-io/honeybadger-ruby/issues/593)) ([368fb16](https://github.com/honeybadger-io/honeybadger-ruby/commit/368fb160d811252f83d0e262110a8c198557c7df))
10
+ * sidekiq leader check only for version > 6.5 ([#594](https://github.com/honeybadger-io/honeybadger-ruby/issues/594)) ([3bc005b](https://github.com/honeybadger-io/honeybadger-ruby/commit/3bc005b12d689da84ebe9b485eb53c508623d984))
11
+
12
+ ## [5.15.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.14.2...v5.15.0) (2024-07-18)
13
+
14
+
15
+ ### Features
16
+
17
+ * 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))
18
+
4
19
  ## [5.14.2](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.14.1...v5.14.2) (2024-07-17)
5
20
 
6
21
 
@@ -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? { |check| event.event_type&.match?(check) }
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)
@@ -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
@@ -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 string to specify exact matches, or regex for more flexibility.',
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: {
@@ -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
- self[:'events.ignore'].map do |check|
197
- check.is_a?(String) ? /^#{check}$/ : check
198
- end
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
@@ -13,7 +13,7 @@ module Honeybadger
13
13
  # The payload data of the event
14
14
  attr_reader :payload
15
15
 
16
- def_delegators :payload, :[], :[]=
16
+ def_delegators :payload, :dig, :[], :[]=
17
17
 
18
18
  # @api private
19
19
  def initialize(event_type_or_payload, payload={})
@@ -59,14 +59,13 @@ module Honeybadger
59
59
  class ActiveRecordSubscriber < NotificationSubscriber
60
60
  def format_payload(payload)
61
61
  {
62
- query: Util::SQL.obfuscate(payload[:sql], payload[:connection].adapter_name),
62
+ query: Util::SQL.obfuscate(payload[:sql], payload[:connection]&.adapter_name),
63
63
  async: payload[:async]
64
64
  }
65
65
  end
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
@@ -127,25 +127,31 @@ module Honeybadger
127
127
  if config.load_plugin_insights?(:sidekiq)
128
128
  require "sidekiq"
129
129
  require "sidekiq/api"
130
- require "sidekiq/component"
131
130
 
132
- class SidekiqClusterCollectionChecker
133
- include ::Sidekiq::Component
134
- def initialize(config)
135
- @config = config
136
- end
131
+ if Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new('6.5')
132
+ require "sidekiq/component"
133
+
134
+ class SidekiqClusterCollectionChecker
135
+ include ::Sidekiq::Component
136
+ def initialize(config)
137
+ @config = config
138
+ end
137
139
 
138
- def collect?
139
- return true unless defined?(::Sidekiq::Enterprise)
140
- leader?
140
+ def collect?
141
+ return true unless defined?(::Sidekiq::Enterprise)
142
+ leader?
143
+ end
141
144
  end
142
145
  end
143
146
 
144
147
  ::Sidekiq.configure_server do |config|
145
148
  config.server_middleware { |chain| chain.add(ServerMiddlewareInstrumentation) }
146
149
  config.client_middleware { |chain| chain.add(ClientMiddlewareInstrumentation) }
147
- config.on(:startup) do
148
- leader_checker = SidekiqClusterCollectionChecker.new(config)
150
+
151
+ if defined?(SidekiqClusterCollectionChecker)
152
+ config.on(:startup) do
153
+ leader_checker = SidekiqClusterCollectionChecker.new(config)
154
+ end
149
155
  end
150
156
  end
151
157
 
@@ -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,4 @@
1
1
  module Honeybadger
2
2
  # The current String Honeybadger version.
3
- VERSION = '5.14.2'.freeze
3
+ VERSION = '5.15.1'.freeze
4
4
  end
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.14.2
4
+ version: 5.15.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: 2024-07-17 00:00:00.000000000 Z
11
+ date: 2024-07-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make managing application errors a more pleasant experience.
14
14
  email: