airbrake 7.3.3 → 7.3.4
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/lib/airbrake/sneakers.rb +17 -1
- data/lib/airbrake/version.rb +1 -1
- data/spec/unit/sneakers_spec.rb +22 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8821368e7cec12e1d5c8595c65fd1b93c27027a3
|
4
|
+
data.tar.gz: 33a3fed7d6a7d6055ea01469213bf7adb5f3fa32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a88c69f02a34f87036df4d14ea0ac059fc1723e3528a56b3ebc2f637c1f5dd4638403f13f95e939e17c0bf5066f9d035fd3d296b2b35cbfefe96b24c73c1eeb
|
7
|
+
data.tar.gz: cf5144da7477e5b3312f2784551715f269e36e38af3be52b4f752927f7b4c75e096981ef4bb5ee6f600d55b0a4164ab51708ffbe95079dc3bd66294dde1cc528
|
data/lib/airbrake/sneakers.rb
CHANGED
@@ -5,12 +5,28 @@ module Airbrake
|
|
5
5
|
# @see https://github.com/jondot/sneakers
|
6
6
|
# @since v7.2.0
|
7
7
|
class ErrorReporter
|
8
|
+
# @return [Array<Symbol>] ignored keys values of which raise
|
9
|
+
# SystemStackError when `as_json` is called on them
|
10
|
+
# @see https://github.com/airbrake/airbrake/issues/850
|
11
|
+
IGNORED_KEYS = %i[delivery_tag consumer channel].freeze
|
12
|
+
|
8
13
|
def call(exception, worker = nil, **context)
|
9
|
-
Airbrake.notify(exception, context) do |notice|
|
14
|
+
Airbrake.notify(exception, filter_context(context)) do |notice|
|
10
15
|
notice[:context][:component] = 'sneakers'
|
11
16
|
notice[:context][:action] = worker.class.to_s
|
12
17
|
end
|
13
18
|
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def filter_context(context)
|
23
|
+
return context unless context[:delivery_info]
|
24
|
+
h = context.dup
|
25
|
+
h[:delivery_info] = context[:delivery_info].reject do |k, _v|
|
26
|
+
IGNORED_KEYS.include?(k)
|
27
|
+
end
|
28
|
+
h
|
29
|
+
end
|
14
30
|
end
|
15
31
|
end
|
16
32
|
end
|
data/lib/airbrake/version.rb
CHANGED
data/spec/unit/sneakers_spec.rb
CHANGED
@@ -22,7 +22,6 @@ RSpec.describe Airbrake::Sneakers::ErrorReporter do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
let(:error) { StandardError.new('Something is wrong') }
|
25
|
-
|
26
25
|
let(:endpoint) { 'https://airbrake.io/api/v3/projects/113743/notices' }
|
27
26
|
|
28
27
|
def wait_for_a_request_with_body(body)
|
@@ -36,9 +35,7 @@ RSpec.describe Airbrake::Sneakers::ErrorReporter do
|
|
36
35
|
Sneakers::Worker.configure_metrics
|
37
36
|
end
|
38
37
|
|
39
|
-
after
|
40
|
-
Sneakers.clear!
|
41
|
-
end
|
38
|
+
after { Sneakers.clear! }
|
42
39
|
|
43
40
|
it "should send a notice" do
|
44
41
|
handler = instance_double('handler')
|
@@ -46,26 +43,42 @@ RSpec.describe Airbrake::Sneakers::ErrorReporter do
|
|
46
43
|
allow(worker.logger).to receive(:error)
|
47
44
|
worker.do_work(nil, nil, "msg", handler)
|
48
45
|
|
49
|
-
wait_for_a_request_with_body(/"message":"oops
|
46
|
+
wait_for_a_request_with_body(/"message":"oops error"/)
|
50
47
|
wait_for_a_request_with_body(/test-queue/)
|
51
48
|
wait_for_a_request_with_body(/"component":"sneakers"/)
|
52
49
|
end
|
53
50
|
|
54
51
|
it "should support call without worker" do
|
55
|
-
|
52
|
+
subject.call(error, message: 'my_glorious_messsage', delivery_info: {})
|
56
53
|
wait_for_a_request_with_body(/"message":"Something is wrong"/)
|
57
|
-
wait_for_a_request_with_body(/"params":{"message":"
|
54
|
+
wait_for_a_request_with_body(/"params":{"message":"my_glorious_messsage"/)
|
58
55
|
# worker class is nil so action is NilClass
|
59
56
|
wait_for_a_request_with_body(/"action":"NilClass"/)
|
60
57
|
wait_for_a_request_with_body(/"component":"sneakers"/)
|
61
58
|
end
|
62
59
|
|
63
60
|
it "should support call with worker" do
|
64
|
-
|
61
|
+
subject.call(error, '', message: 'my_special_message', delivery_info: {})
|
65
62
|
wait_for_a_request_with_body(/"message":"Something is wrong"/)
|
66
|
-
wait_for_a_request_with_body(/"params":{"message":"my_special_message"
|
63
|
+
wait_for_a_request_with_body(/"params":{"message":"my_special_message"/)
|
67
64
|
# worker class is a String so action is String
|
68
65
|
wait_for_a_request_with_body(/"action":"String"/)
|
69
66
|
wait_for_a_request_with_body(/"component":"sneakers"/)
|
67
|
+
wait_for_a_request_with_body(
|
68
|
+
/"params":{"message":"my_special_message","delivery_info":{}}/
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
72
|
+
described_class::IGNORED_KEYS.each do |key|
|
73
|
+
context "when delivery_info/#{key} is present" do
|
74
|
+
it "filters out #{key}" do
|
75
|
+
subject.call(
|
76
|
+
error, '', message: 'msg', delivery_info: { key => 'a', foo: 'b' }
|
77
|
+
)
|
78
|
+
wait_for_a_request_with_body(
|
79
|
+
/"params":{"message":"msg","delivery_info":{"foo":"b"}}/
|
80
|
+
)
|
81
|
+
end
|
82
|
+
end
|
70
83
|
end
|
71
84
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airbrake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.3.
|
4
|
+
version: 7.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airbrake Technologies, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: airbrake-ruby
|