airbrake 7.3.3 → 7.3.4

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
  SHA1:
3
- metadata.gz: b725f58fb8bcbe584bcb48667958d69b6d624d3c
4
- data.tar.gz: 51e95705e618dcdb841c8d7a2715e34add84aa64
3
+ metadata.gz: 8821368e7cec12e1d5c8595c65fd1b93c27027a3
4
+ data.tar.gz: 33a3fed7d6a7d6055ea01469213bf7adb5f3fa32
5
5
  SHA512:
6
- metadata.gz: e62eb59355112c63942617ff37aad78f29b03ef28ddb734f9669432478d681b4e5ffe9694a2bb30e740055851cd3ee73c2f48a7da0d8696194efdd3125a822ed
7
- data.tar.gz: cec780dee54d1fda0746110b27e45f88ce841fdb8bbc89d04b45d57e65527d92ccafe0c6cebe05257616df538cf3474ad9bec91ee703744f1d0b1f27a7e6fbda
6
+ metadata.gz: 0a88c69f02a34f87036df4d14ea0ac059fc1723e3528a56b3ebc2f637c1f5dd4638403f13f95e939e17c0bf5066f9d035fd3d296b2b35cbfefe96b24c73c1eeb
7
+ data.tar.gz: cf5144da7477e5b3312f2784551715f269e36e38af3be52b4f752927f7b4c75e096981ef4bb5ee6f600d55b0a4164ab51708ffbe95079dc3bd66294dde1cc528
@@ -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
@@ -1,5 +1,5 @@
1
1
  # We use Semantic Versioning v2.0.0
2
2
  # More information: http://semver.org/
3
3
  module Airbrake
4
- AIRBRAKE_VERSION = '7.3.3'.freeze
4
+ AIRBRAKE_VERSION = '7.3.4'.freeze
5
5
  end
@@ -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 do
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\serror"/)
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
- Airbrake::Sneakers::ErrorReporter.new.call(error, message: 'my_glorious_message')
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":"my_glorious_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
- Airbrake::Sneakers::ErrorReporter.new.call(error, '', message: 'my_special_message')
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.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-05-11 00:00:00.000000000 Z
11
+ date: 2018-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: airbrake-ruby