honeybadger 5.19.2 → 5.20.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 +14 -0
- data/lib/honeybadger/cli/test.rb +1 -0
- data/lib/honeybadger/config/defaults.rb +42 -1
- data/lib/honeybadger/gauge.rb +1 -0
- data/lib/honeybadger/histogram.rb +1 -0
- data/lib/honeybadger/instrumentation.rb +1 -1
- data/lib/honeybadger/notification_subscriber.rb +25 -17
- data/lib/honeybadger/plugins/active_job.rb +0 -1
- data/lib/honeybadger/plugins/net_http.rb +17 -3
- data/lib/honeybadger/plugins/sidekiq.rb +10 -4
- data/lib/honeybadger/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae2f44eb9962db4e28c9dde0605afddce6d9f5e45a5edd4717df5ee29c3721f7
|
4
|
+
data.tar.gz: 1b8a54201362718397a65381a1acae5075d981e8ec456a83c88c738842fbd61a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 120f89c79192559358b22bc4b2834e511974f2021faf94001f8ac535cabd5ad4d544093381053ee056b824e47bcc3b2365e41bbf4828c4dfe77a7503f9baea16
|
7
|
+
data.tar.gz: 05d48ae81cc6e01c1ea0686d8f8a3c6d76c532afd8d286aa2920c8c19ba12cd0b2e56041837d77c3926c1c0f172c98504ccd647d7c70e86d86ad9272c88bec38
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
3
|
|
4
|
+
## [5.20.1](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.20.0...v5.20.1) (2024-11-13)
|
5
|
+
|
6
|
+
|
7
|
+
### Bug Fixes
|
8
|
+
|
9
|
+
* cli test for rails 8 ([#639](https://github.com/honeybadger-io/honeybadger-ruby/issues/639)) ([ec74cfd](https://github.com/honeybadger-io/honeybadger-ruby/commit/ec74cfd95519cd49509ff63fb34a7673f5c76323))
|
10
|
+
|
11
|
+
## [5.20.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.19.2...v5.20.0) (2024-11-08)
|
12
|
+
|
13
|
+
|
14
|
+
### Features
|
15
|
+
|
16
|
+
* add aggregated metrics for rails and more ([#630](https://github.com/honeybadger-io/honeybadger-ruby/issues/630)) ([12db5a4](https://github.com/honeybadger-io/honeybadger-ruby/commit/12db5a4d44a9597c0999d32a150283799d856d66))
|
17
|
+
|
4
18
|
## [5.19.2](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.19.1...v5.19.2) (2024-11-05)
|
5
19
|
|
6
20
|
|
data/lib/honeybadger/cli/test.rb
CHANGED
@@ -142,6 +142,7 @@ module Honeybadger
|
|
142
142
|
end
|
143
143
|
CONTROLLER
|
144
144
|
|
145
|
+
::Rails.application.try(:reload_routes_unless_loaded)
|
145
146
|
::Rails.application.routes.tap do |r|
|
146
147
|
# RouteSet#disable_clear_and_finalize prevents existing routes from
|
147
148
|
# being cleared. We'll set it back to the original value when we're
|
@@ -32,6 +32,7 @@ module Honeybadger
|
|
32
32
|
'Sidekiq::JobRetry::Skip'].map(&:freeze).freeze
|
33
33
|
|
34
34
|
IGNORE_EVENTS_DEFAULT = [
|
35
|
+
{ event_type: 'metric.hb', metric_name: 'duration.sql.active_record', query: /^(begin|commit)( transaction)?$/i },
|
35
36
|
{ event_type: 'sql.active_record', query: /^(begin|commit)( transaction)?$/i },
|
36
37
|
{ event_type: 'sql.active_record', query: /(solid_queue|good_job)/i },
|
37
38
|
{ event_type: 'sql.active_record', name: /^GoodJob/ },
|
@@ -363,6 +364,36 @@ module Honeybadger
|
|
363
364
|
default: 60,
|
364
365
|
type: Integer
|
365
366
|
},
|
367
|
+
:'sidekiq.insights.enabled' => {
|
368
|
+
description: 'Enable automatic data collection for Sidekiq.',
|
369
|
+
default: true,
|
370
|
+
type: Boolean
|
371
|
+
},
|
372
|
+
:'sidekiq.insights.events' => {
|
373
|
+
description: 'Enable automatic event capturing for Sidekiq.',
|
374
|
+
default: true,
|
375
|
+
type: Boolean
|
376
|
+
},
|
377
|
+
:'sidekiq.insights.metrics' => {
|
378
|
+
description: 'Enable automatic metric data collection for Sidekiq.',
|
379
|
+
default: false,
|
380
|
+
type: Boolean
|
381
|
+
},
|
382
|
+
:'rails.insights.enabled' => {
|
383
|
+
description: 'Enable automatic data collection for Ruby on Rails.',
|
384
|
+
default: true,
|
385
|
+
type: Boolean
|
386
|
+
},
|
387
|
+
:'rails.insights.events' => {
|
388
|
+
description: 'Enable automatic event capturing for Ruby on Rails.',
|
389
|
+
default: true,
|
390
|
+
type: Boolean
|
391
|
+
},
|
392
|
+
:'rails.insights.metrics' => {
|
393
|
+
description: 'Enable automatic metric data collection for Ruby on Rails.',
|
394
|
+
default: false,
|
395
|
+
type: Boolean
|
396
|
+
},
|
366
397
|
:'karafka.insights.enabled' => {
|
367
398
|
description: 'Enable automatic data collection for Karafka.',
|
368
399
|
default: true,
|
@@ -375,7 +406,7 @@ module Honeybadger
|
|
375
406
|
},
|
376
407
|
:'karafka.insights.metrics' => {
|
377
408
|
description: 'Enable automatic metric data collection for Karafka.',
|
378
|
-
default:
|
409
|
+
default: false,
|
379
410
|
type: Boolean
|
380
411
|
},
|
381
412
|
:'net_http.insights.enabled' => {
|
@@ -383,6 +414,16 @@ module Honeybadger
|
|
383
414
|
default: true,
|
384
415
|
type: Boolean
|
385
416
|
},
|
417
|
+
:'net_http.insights.events' => {
|
418
|
+
description: 'Enable automatic event capturing for Net::HTTP requests.',
|
419
|
+
default: true,
|
420
|
+
type: Boolean
|
421
|
+
},
|
422
|
+
:'net_http.insights.metrics' => {
|
423
|
+
description: 'Enable automatic metric data collection for Net::HTTP requests.',
|
424
|
+
default: false,
|
425
|
+
type: Boolean
|
426
|
+
},
|
386
427
|
:'net_http.insights.full_url' => {
|
387
428
|
description: 'Record the full request url during instrumentation.',
|
388
429
|
default: false,
|
data/lib/honeybadger/gauge.rb
CHANGED
@@ -134,7 +134,7 @@ module Honeybadger
|
|
134
134
|
elsif block_given?
|
135
135
|
value = yield
|
136
136
|
else
|
137
|
-
value = attributes.delete(:value)
|
137
|
+
value = attributes.delete(:duration) || attributes.delete(:value)
|
138
138
|
end
|
139
139
|
|
140
140
|
Honeybadger::Gauge.register(registry, name, attributes).tap do |gauge|
|
@@ -3,6 +3,8 @@ require 'honeybadger/util/sql'
|
|
3
3
|
|
4
4
|
module Honeybadger
|
5
5
|
class NotificationSubscriber
|
6
|
+
include Honeybadger::InstrumentationHelper
|
7
|
+
|
6
8
|
def start(name, id, payload)
|
7
9
|
@start_time = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
|
8
10
|
end
|
@@ -21,7 +23,29 @@ module Honeybadger
|
|
21
23
|
end
|
22
24
|
|
23
25
|
def record(name, payload)
|
24
|
-
Honeybadger.
|
26
|
+
if Honeybadger.config.load_plugin_insights_events?(:rails)
|
27
|
+
Honeybadger.event(name, payload)
|
28
|
+
end
|
29
|
+
|
30
|
+
if Honeybadger.config.load_plugin_insights_metrics?(:rails)
|
31
|
+
metric_source 'rails'
|
32
|
+
record_metrics(name, payload)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def record_metrics(name, payload)
|
37
|
+
case name
|
38
|
+
when 'sql.active_record'
|
39
|
+
gauge('duration.sql.active_record', value: payload[:duration], **payload.slice(:query))
|
40
|
+
when 'process_action.action_controller'
|
41
|
+
gauge('duration.process_action.action_controller', value: payload[:duration], **payload.slice(:method, :controller, :action, :format, :status))
|
42
|
+
gauge('db_runtime.process_action.action_controller', value: payload[:db_runtime], **payload.slice(:method, :controller, :action, :format, :status))
|
43
|
+
gauge('view_runtime.process_action.action_controller', value: payload[:view_runtime], **payload.slice(:method, :controller, :action, :format, :status))
|
44
|
+
when 'perform.active_job'
|
45
|
+
gauge('duration.perform.active_job', value: payload[:duration], **payload.slice(:job_class, :queue_name))
|
46
|
+
when /^cache_.*.active_support$/
|
47
|
+
gauge("duration.#{name}", value: payload[:duration], **payload.slice(:store, :key))
|
48
|
+
end
|
25
49
|
end
|
26
50
|
|
27
51
|
def process?(event, payload)
|
@@ -109,22 +133,6 @@ module Honeybadger
|
|
109
133
|
end
|
110
134
|
end
|
111
135
|
|
112
|
-
class ActiveJobMetricsSubscriber < NotificationSubscriber
|
113
|
-
include Honeybadger::InstrumentationHelper
|
114
|
-
|
115
|
-
def format_payload(payload)
|
116
|
-
{
|
117
|
-
job_class: payload[:job].class.to_s,
|
118
|
-
queue_name: payload[:job].queue_name
|
119
|
-
}
|
120
|
-
end
|
121
|
-
|
122
|
-
def record(name, payload)
|
123
|
-
metric_source 'active_job'
|
124
|
-
histogram name, { bins: [30, 60, 120, 300, 1800, 3600, 21_600] }.merge(payload)
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
136
|
class ActionMailerSubscriber < NotificationSubscriber
|
129
137
|
end
|
130
138
|
|
@@ -55,7 +55,6 @@ module Honeybadger
|
|
55
55
|
|
56
56
|
if config.load_plugin_insights?(:active_job)
|
57
57
|
::ActiveSupport::Notifications.subscribe(/(enqueue_at|enqueue|enqueue_retry|enqueue_all|perform|retry_stopped|discard)\.active_job/, Honeybadger::ActiveJobSubscriber.new)
|
58
|
-
::ActiveSupport::Notifications.subscribe('perform.active_job', Honeybadger::ActiveJobMetricsSubscriber.new)
|
59
58
|
end
|
60
59
|
end
|
61
60
|
end
|
@@ -7,6 +7,12 @@ module Honeybadger
|
|
7
7
|
module Plugins
|
8
8
|
module Net
|
9
9
|
module HTTP
|
10
|
+
@@hb_config = ::Honeybadger.config
|
11
|
+
|
12
|
+
def self.set_hb_config(config)
|
13
|
+
@@hb_config = config
|
14
|
+
end
|
15
|
+
|
10
16
|
def request(request_data, body = nil, &block)
|
11
17
|
return super unless started?
|
12
18
|
return super if hb?
|
@@ -18,19 +24,26 @@ module Honeybadger
|
|
18
24
|
status: response_data.code.to_i
|
19
25
|
}.merge(parsed_uri_data(request_data))
|
20
26
|
|
21
|
-
|
27
|
+
if @@hb_config.load_plugin_insights_events?(:net_http)
|
28
|
+
Honeybadger.event('request.net_http', context)
|
29
|
+
end
|
30
|
+
|
31
|
+
if @@hb_config.load_plugin_insights_metrics?(:net_http)
|
32
|
+
context.delete(:url)
|
33
|
+
Honeybadger.gauge('duration.request', context.merge(metric_source: 'net_http'))
|
34
|
+
end
|
22
35
|
end[1] # return the response data only
|
23
36
|
end
|
24
37
|
|
25
38
|
def hb?
|
26
|
-
address.to_s[/#{
|
39
|
+
address.to_s[/#{@@hb_config[:'connection.host'].to_s}/]
|
27
40
|
end
|
28
41
|
|
29
42
|
def parsed_uri_data(request_data)
|
30
43
|
uri = request_data.uri || build_uri(request_data)
|
31
44
|
{}.tap do |uri_data|
|
32
45
|
uri_data[:host] = uri.host
|
33
|
-
uri_data[:url] = uri.to_s if
|
46
|
+
uri_data[:url] = uri.to_s if @@hb_config[:'net_http.insights.full_url']
|
34
47
|
end
|
35
48
|
end
|
36
49
|
|
@@ -43,6 +56,7 @@ module Honeybadger
|
|
43
56
|
requirement { config.load_plugin_insights?(:net_http) }
|
44
57
|
|
45
58
|
execution do
|
59
|
+
Honeybadger::Plugins::Net::HTTP.set_hb_config(config)
|
46
60
|
::Net::HTTP.send(:prepend, Honeybadger::Plugins::Net::HTTP)
|
47
61
|
end
|
48
62
|
end
|
@@ -38,10 +38,14 @@ module Honeybadger
|
|
38
38
|
raise
|
39
39
|
ensure
|
40
40
|
context.merge!(duration: duration, status: status)
|
41
|
-
Honeybadger.
|
41
|
+
if Honeybadger.config.load_plugin_insights_events?(:sidekiq)
|
42
|
+
Honeybadger.event('perform.sidekiq', context)
|
43
|
+
end
|
42
44
|
|
43
|
-
|
44
|
-
|
45
|
+
if Honeybadger.config.load_plugin_insights_metrics?(:sidekiq)
|
46
|
+
metric_source 'sidekiq'
|
47
|
+
gauge 'perform', context.slice(:worker, :queue, :duration)
|
48
|
+
end
|
45
49
|
end
|
46
50
|
end
|
47
51
|
end
|
@@ -55,7 +59,9 @@ module Honeybadger
|
|
55
59
|
queue: queue
|
56
60
|
}
|
57
61
|
|
58
|
-
Honeybadger.
|
62
|
+
if Honeybadger.config.load_plugin_insights_events?(:sidekiq)
|
63
|
+
Honeybadger.event('enqueue.sidekiq', context)
|
64
|
+
end
|
59
65
|
|
60
66
|
yield
|
61
67
|
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: 5.
|
4
|
+
version: 5.20.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-11-
|
11
|
+
date: 2024-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logger
|
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
194
|
- !ruby/object:Gem::Version
|
195
195
|
version: '0'
|
196
196
|
requirements: []
|
197
|
-
rubygems_version: 3.5.
|
197
|
+
rubygems_version: 3.5.22
|
198
198
|
signing_key:
|
199
199
|
specification_version: 4
|
200
200
|
summary: Error reports you can be happy about.
|