exception_handling 2.14.0.pre.gk.0 → 2.14.0.pre.gk.1
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 +1 -1
- data/Gemfile.lock +9 -11
- data/lib/exception_handling/exception_info.rb +1 -1
- data/lib/exception_handling/version.rb +1 -1
- data/lib/exception_handling.rb +4 -1
- data/spec/unit/exception_handling/exception_info_spec.rb +5 -5
- data/spec/unit/exception_handling/sensu_spec.rb +3 -3
- data/spec/unit/exception_handling_spec.rb +5 -9
- 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: 9443856b4b95e8a7a4447797e52afc5f7278e10574e3f42b6b761f6d914b7a8f
|
4
|
+
data.tar.gz: de0790fced3ccdd7e6dbcff2ecd153f7cc9619bf729adf1b6322fd486ff004b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fd845247940506ce0ebc30ffe35a715454926e2a4b90b9f56c39bb6386c8267b06d8da911c57ee52327451ddb10ca16c3cfe63f0aeb9088423cc7211a737736
|
7
|
+
data.tar.gz: 888c7ab078a79727813d58656b1bba588e7c70c9482c21cc2e8bf95bed37e3bf228787be055dda3bc05d57e9c56915dc9ee3f6aba32d539d2e5e5633d3418ebc
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,7 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
5
5
|
Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
-
## [2.14.0] -
|
7
|
+
## [2.14.0] - Unreleased
|
8
8
|
### Added
|
9
9
|
- Added support for plumbing tags through to honeybadger via the `honeybadger_tags` log context parameter
|
10
10
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
exception_handling (2.14.0.pre.gk.
|
4
|
+
exception_handling (2.14.0.pre.gk.1)
|
5
5
|
actionmailer (>= 5.2, < 7.0)
|
6
6
|
actionpack (>= 5.2, < 7.0)
|
7
7
|
activesupport (>= 5.2, < 7.0)
|
@@ -52,12 +52,11 @@ GEM
|
|
52
52
|
byebug (11.1.3)
|
53
53
|
coderay (1.1.2)
|
54
54
|
concurrent-ruby (1.1.10)
|
55
|
-
contextual_logger (1.
|
55
|
+
contextual_logger (1.1.1)
|
56
56
|
activesupport
|
57
57
|
json
|
58
58
|
crass (1.0.6)
|
59
59
|
diff-lcs (1.5.0)
|
60
|
-
digest (3.1.0)
|
61
60
|
erubi (1.10.0)
|
62
61
|
escalate (0.3.0)
|
63
62
|
eventmachine (1.2.7)
|
@@ -66,9 +65,10 @@ GEM
|
|
66
65
|
honeybadger (4.11.0)
|
67
66
|
i18n (1.10.0)
|
68
67
|
concurrent-ruby (~> 1.0)
|
69
|
-
invoca-utils (0.
|
68
|
+
invoca-utils (0.5.0)
|
69
|
+
activesupport (>= 5.0)
|
70
70
|
jaro_winkler (1.5.3)
|
71
|
-
json (2.6.
|
71
|
+
json (2.6.3)
|
72
72
|
loofah (2.15.0)
|
73
73
|
crass (~> 1.0.2)
|
74
74
|
nokogiri (>= 1.5.9)
|
@@ -78,12 +78,10 @@ GEM
|
|
78
78
|
mini_mime (1.1.2)
|
79
79
|
mini_portile2 (2.8.0)
|
80
80
|
minitest (5.15.0)
|
81
|
-
net-protocol (0.1
|
81
|
+
net-protocol (0.2.1)
|
82
82
|
timeout
|
83
|
-
net-smtp (0.3.
|
84
|
-
digest
|
83
|
+
net-smtp (0.3.3)
|
85
84
|
net-protocol
|
86
|
-
timeout
|
87
85
|
nokogiri (1.13.3)
|
88
86
|
mini_portile2 (~> 2.8.0)
|
89
87
|
racc (~> 1.4)
|
@@ -97,7 +95,7 @@ GEM
|
|
97
95
|
pry-byebug (3.8.0)
|
98
96
|
byebug (~> 11.0)
|
99
97
|
pry (~> 0.10)
|
100
|
-
psych (3.3.
|
98
|
+
psych (3.3.4)
|
101
99
|
racc (1.6.0)
|
102
100
|
rack (2.2.3)
|
103
101
|
rack-test (1.1.0)
|
@@ -136,7 +134,7 @@ GEM
|
|
136
134
|
power_assert
|
137
135
|
thor (1.0.1)
|
138
136
|
thread_safe (0.3.6)
|
139
|
-
timeout (0.3.
|
137
|
+
timeout (0.3.2)
|
140
138
|
tzinfo (1.2.9)
|
141
139
|
thread_safe (~> 0.1)
|
142
140
|
unicode-display_width (1.6.0)
|
@@ -59,7 +59,7 @@ module ExceptionHandling
|
|
59
59
|
@data_callback = data_callback
|
60
60
|
# merge into the surrounding context just like ContextualLogger does when logging
|
61
61
|
@merged_log_context = ExceptionHandling.logger.current_context_for_thread.deep_merge(log_context || {})
|
62
|
-
@honeybadger_tags =
|
62
|
+
@honeybadger_tags = Array(@merged_log_context[:honeybadger_tags] || [])
|
63
63
|
end
|
64
64
|
|
65
65
|
def data
|
data/lib/exception_handling.rb
CHANGED
@@ -270,12 +270,15 @@ module ExceptionHandling # never included
|
|
270
270
|
def send_exception_to_honeybadger(exception_info)
|
271
271
|
exception = exception_info.exception
|
272
272
|
exception_description = exception_info.exception_description
|
273
|
+
# Note: Both commas and spaces are treated as delimiters for the :tags string. Space-delimiters are not officially documented.
|
274
|
+
# https://github.com/honeybadger-io/honeybadger-ruby/pull/422
|
275
|
+
tags = exception_info.honeybadger_tags.join(' ')
|
273
276
|
response = Honeybadger.notify(error_class: exception_description ? exception_description.filter_name : exception.class.name,
|
274
277
|
error_message: exception.message.to_s,
|
275
278
|
exception: exception,
|
276
279
|
context: exception_info.honeybadger_context_data,
|
277
280
|
controller: exception_info.controller_name,
|
278
|
-
tags:
|
281
|
+
tags: tags)
|
279
282
|
response ? :success : :failure
|
280
283
|
rescue Exception => ex
|
281
284
|
warn("ExceptionHandling.send_exception_to_honeybadger rescued exception while logging #{exception_info.exception_context}:\n#{exception.class}: #{exception.message}:\n#{ex.class}: #{ex.message}\n#{ex.backtrace.join("\n")}")
|
@@ -47,16 +47,16 @@ module ExceptionHandling
|
|
47
47
|
|
48
48
|
context "honeybadger_tags" do
|
49
49
|
it "retrieved from log_context" do
|
50
|
-
exception_info = ExceptionInfo.new(@exception, "string context", @timestamp, log_context: { honeybadger_tags: ['Data
|
51
|
-
expect(exception_info.honeybadger_tags).to eq(['Data
|
50
|
+
exception_info = ExceptionInfo.new(@exception, "string context", @timestamp, log_context: { honeybadger_tags: ['Data-Services'] })
|
51
|
+
expect(exception_info.honeybadger_tags).to eq(['Data-Services'])
|
52
52
|
end
|
53
53
|
|
54
54
|
it "retrieved from log_context and normalized to array if a string" do
|
55
|
-
exception_info = ExceptionInfo.new(@exception, "string context", @timestamp, log_context: { honeybadger_tags: 'Data
|
56
|
-
expect(exception_info.honeybadger_tags).to eq(['Data
|
55
|
+
exception_info = ExceptionInfo.new(@exception, "string context", @timestamp, log_context: { honeybadger_tags: 'Data-Services' })
|
56
|
+
expect(exception_info.honeybadger_tags).to eq(['Data-Services'])
|
57
57
|
end
|
58
58
|
|
59
|
-
it "defaults to empty array if
|
59
|
+
it "defaults to empty array if not given" do
|
60
60
|
exception_info = ExceptionInfo.new(@exception, "string context", @timestamp)
|
61
61
|
expect(exception_info.honeybadger_tags).to eq([])
|
62
62
|
end
|
@@ -6,7 +6,7 @@ module ExceptionHandling
|
|
6
6
|
describe Sensu do
|
7
7
|
context "#generate_event" do
|
8
8
|
it "create an event" do
|
9
|
-
expect(ExceptionHandling::Sensu).to receive(:send_event).with(name: "world_is_ending", output: "stick head between knees and kiss ass goodbye", status: 1)
|
9
|
+
expect(ExceptionHandling::Sensu).to receive(:send_event).with({ name: "world_is_ending", output: "stick head between knees and kiss ass goodbye", status: 1 })
|
10
10
|
|
11
11
|
ExceptionHandling::Sensu.generate_event("world_is_ending", "stick head between knees and kiss ass goodbye")
|
12
12
|
end
|
@@ -14,13 +14,13 @@ module ExceptionHandling
|
|
14
14
|
it "add the sensu prefix" do
|
15
15
|
ExceptionHandling.sensu_prefix = "cnn_"
|
16
16
|
|
17
|
-
expect(ExceptionHandling::Sensu).to receive(:send_event).with(name: "cnn_world_is_ending", output: "stick head between knees and kiss ass goodbye", status: 1)
|
17
|
+
expect(ExceptionHandling::Sensu).to receive(:send_event).with({ name: "cnn_world_is_ending", output: "stick head between knees and kiss ass goodbye", status: 1 })
|
18
18
|
|
19
19
|
ExceptionHandling::Sensu.generate_event("world_is_ending", "stick head between knees and kiss ass goodbye")
|
20
20
|
end
|
21
21
|
|
22
22
|
it "allow the level to be set to critical" do
|
23
|
-
expect(ExceptionHandling::Sensu).to receive(:send_event).with(name: "world_is_ending", output: "stick head between knees and kiss ass goodbye", status: 2)
|
23
|
+
expect(ExceptionHandling::Sensu).to receive(:send_event).with({ name: "world_is_ending", output: "stick head between knees and kiss ass goodbye", status: 2 })
|
24
24
|
|
25
25
|
ExceptionHandling::Sensu.generate_event("world_is_ending", "stick head between knees and kiss ass goodbye", :critical)
|
26
26
|
end
|
@@ -158,12 +158,8 @@ describe ExceptionHandling do
|
|
158
158
|
|
159
159
|
context "#log_warning" do
|
160
160
|
it "have empty array as a backtrace" do
|
161
|
-
|
162
|
-
|
163
|
-
else
|
164
|
-
[ExceptionHandling::Warning]
|
165
|
-
end
|
166
|
-
expect(ExceptionHandling).to receive(:log_error).with(*expected_args) do |error|
|
161
|
+
expect(ExceptionHandling).to receive(:log_error) do |error|
|
162
|
+
expect(error.class).to eq(ExceptionHandling::Warning)
|
167
163
|
expect(error.backtrace).to eq([])
|
168
164
|
end
|
169
165
|
ExceptionHandling.log_warning('Now with empty array as a backtrace!')
|
@@ -727,7 +723,7 @@ describe ExceptionHandling do
|
|
727
723
|
expect(Honeybadger).to receive(:notify).with(any_args) do |data|
|
728
724
|
honeybadger_data = data
|
729
725
|
end
|
730
|
-
ExceptionHandling.logger.global_context = { service_name: "rails", region: "AWS-us-east-1", honeybadger_tags: ['Data
|
726
|
+
ExceptionHandling.logger.global_context = { service_name: "rails", region: "AWS-us-east-1", honeybadger_tags: ['Data-Services', 'web'] }
|
731
727
|
log_context = { log_source: "gem/listen", service_name: "bin/console" }
|
732
728
|
ExceptionHandling.log_error(@exception, @exception_context, @controller, **log_context) do |data|
|
733
729
|
data[:scm_revision] = "5b24eac37aaa91f5784901e9aabcead36fd9df82"
|
@@ -741,7 +737,7 @@ describe ExceptionHandling do
|
|
741
737
|
error_message: "Some Exception",
|
742
738
|
controller: "some_controller",
|
743
739
|
exception: @exception,
|
744
|
-
tags: "Data
|
740
|
+
tags: "Data-Services web",
|
745
741
|
context: {
|
746
742
|
timestamp: Time.now.to_i,
|
747
743
|
error_class: "StandardError",
|
@@ -767,7 +763,7 @@ describe ExceptionHandling do
|
|
767
763
|
"spec/unit/exception_handling_spec.rb:455:in `block (4 levels) in <class:ExceptionHandlingTest>'"
|
768
764
|
],
|
769
765
|
event_response: "Event successfully received",
|
770
|
-
log_context: { "service_name" => "bin/console", "region" => "AWS-us-east-1", "log_source" => "gem/listen", "honeybadger_tags" => ['Data
|
766
|
+
log_context: { "service_name" => "bin/console", "region" => "AWS-us-east-1", "log_source" => "gem/listen", "honeybadger_tags" => ['Data-Services', 'web'] }
|
771
767
|
}
|
772
768
|
}
|
773
769
|
expect(honeybadger_data).to eq(expected_data)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exception_handling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.14.0.pre.gk.
|
4
|
+
version: 2.14.0.pre.gk.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Invoca
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|