airbrake-ruby 4.9.0-java → 4.10.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/lib/airbrake-ruby.rb +55 -6
  3. data/lib/airbrake-ruby/async_sender.rb +3 -3
  4. data/lib/airbrake-ruby/backtrace.rb +2 -2
  5. data/lib/airbrake-ruby/code_hunk.rb +1 -1
  6. data/lib/airbrake-ruby/config.rb +1 -1
  7. data/lib/airbrake-ruby/config/validator.rb +3 -3
  8. data/lib/airbrake-ruby/deploy_notifier.rb +1 -1
  9. data/lib/airbrake-ruby/filters/exception_attributes_filter.rb +2 -2
  10. data/lib/airbrake-ruby/filters/git_last_checkout_filter.rb +2 -2
  11. data/lib/airbrake-ruby/filters/keys_filter.rb +1 -1
  12. data/lib/airbrake-ruby/filters/sql_filter.rb +3 -3
  13. data/lib/airbrake-ruby/filters/thread_filter.rb +1 -1
  14. data/lib/airbrake-ruby/inspectable.rb +2 -2
  15. data/lib/airbrake-ruby/notice.rb +7 -7
  16. data/lib/airbrake-ruby/notice_notifier.rb +1 -1
  17. data/lib/airbrake-ruby/performance_breakdown.rb +1 -1
  18. data/lib/airbrake-ruby/performance_notifier.rb +36 -20
  19. data/lib/airbrake-ruby/query.rb +1 -1
  20. data/lib/airbrake-ruby/queue.rb +2 -2
  21. data/lib/airbrake-ruby/request.rb +1 -1
  22. data/lib/airbrake-ruby/stat.rb +1 -1
  23. data/lib/airbrake-ruby/version.rb +1 -1
  24. data/spec/airbrake_spec.rb +107 -48
  25. data/spec/async_sender_spec.rb +4 -4
  26. data/spec/backtrace_spec.rb +18 -18
  27. data/spec/code_hunk_spec.rb +9 -9
  28. data/spec/config/validator_spec.rb +5 -5
  29. data/spec/config_spec.rb +5 -5
  30. data/spec/deploy_notifier_spec.rb +2 -2
  31. data/spec/filter_chain_spec.rb +1 -1
  32. data/spec/filters/dependency_filter_spec.rb +1 -1
  33. data/spec/filters/gem_root_filter_spec.rb +5 -5
  34. data/spec/filters/git_last_checkout_filter_spec.rb +1 -1
  35. data/spec/filters/git_repository_filter.rb +1 -1
  36. data/spec/filters/git_revision_filter_spec.rb +10 -10
  37. data/spec/filters/keys_blacklist_spec.rb +22 -22
  38. data/spec/filters/keys_whitelist_spec.rb +21 -21
  39. data/spec/filters/root_directory_filter_spec.rb +5 -5
  40. data/spec/filters/sql_filter_spec.rb +53 -53
  41. data/spec/filters/system_exit_filter_spec.rb +1 -1
  42. data/spec/filters/thread_filter_spec.rb +28 -28
  43. data/spec/fixtures/project_root/code.rb +9 -9
  44. data/spec/notice_notifier/options_spec.rb +12 -12
  45. data/spec/notice_notifier_spec.rb +17 -17
  46. data/spec/notice_spec.rb +5 -5
  47. data/spec/performance_notifier_spec.rb +88 -68
  48. data/spec/query_spec.rb +1 -1
  49. data/spec/request_spec.rb +1 -1
  50. data/spec/response_spec.rb +8 -8
  51. data/spec/spec_helper.rb +2 -2
  52. data/spec/stat_spec.rb +2 -2
  53. data/spec/sync_sender_spec.rb +12 -12
  54. data/spec/tdigest_spec.rb +6 -6
  55. data/spec/thread_pool_spec.rb +5 -5
  56. data/spec/timed_trace_spec.rb +1 -1
  57. data/spec/truncator_spec.rb +12 -12
  58. metadata +2 -2
data/spec/query_spec.rb CHANGED
@@ -2,7 +2,7 @@ RSpec.describe Airbrake::Query do
2
2
  describe "#stash" do
3
3
  subject do
4
4
  described_class.new(
5
- method: 'GET', route: '/', query: '', start_time: Time.now
5
+ method: 'GET', route: '/', query: '', start_time: Time.now,
6
6
  )
7
7
  end
8
8
 
data/spec/request_spec.rb CHANGED
@@ -2,7 +2,7 @@ RSpec.describe Airbrake::Request do
2
2
  describe "#stash" do
3
3
  subject do
4
4
  described_class.new(
5
- method: 'GET', route: '/', status_code: 200, start_time: Time.now
5
+ method: 'GET', route: '/', status_code: 200, start_time: Time.now,
6
6
  )
7
7
  end
8
8
 
@@ -4,7 +4,7 @@ RSpec.describe Airbrake::Response do
4
4
  context "when response code is #{code}" do
5
5
  it "logs response body" do
6
6
  expect(Airbrake::Loggable.instance).to receive(:debug).with(
7
- /Airbrake::Response \(#{code}\): {}/
7
+ /Airbrake::Response \(#{code}\): {}/,
8
8
  )
9
9
  described_class.parse(OpenStruct.new(code: code, body: '{}'))
10
10
  end
@@ -15,10 +15,10 @@ RSpec.describe Airbrake::Response do
15
15
  context "when response code is #{code}" do
16
16
  it "logs response message" do
17
17
  expect(Airbrake::Loggable.instance).to receive(:error).with(
18
- /Airbrake: foo/
18
+ /Airbrake: foo/,
19
19
  )
20
20
  described_class.parse(
21
- OpenStruct.new(code: code, body: '{"message":"foo"}')
21
+ OpenStruct.new(code: code, body: '{"message":"foo"}'),
22
22
  )
23
23
  end
24
24
  end
@@ -29,7 +29,7 @@ RSpec.describe Airbrake::Response do
29
29
 
30
30
  it "logs response message" do
31
31
  expect(Airbrake::Loggable.instance).to receive(:error).with(
32
- /Airbrake: rate limited/
32
+ /Airbrake: rate limited/,
33
33
  )
34
34
  described_class.parse(response)
35
35
  end
@@ -41,7 +41,7 @@ RSpec.describe Airbrake::Response do
41
41
  resp = described_class.parse(response)
42
42
  expect(resp).to include(
43
43
  'error' => '**Airbrake: rate limited',
44
- 'rate_limit_reset' => time
44
+ 'rate_limit_reset' => time,
45
45
  )
46
46
  end
47
47
  end
@@ -51,7 +51,7 @@ RSpec.describe Airbrake::Response do
51
51
 
52
52
  it "logs response body" do
53
53
  expect(Airbrake::Loggable.instance).to receive(:error).with(
54
- /Airbrake: unexpected code \(500\)\. Body: foo/
54
+ /Airbrake: unexpected code \(500\)\. Body: foo/,
55
55
  )
56
56
  described_class.parse(response)
57
57
  end
@@ -73,14 +73,14 @@ RSpec.describe Airbrake::Response do
73
73
 
74
74
  it "logs response body" do
75
75
  expect(Airbrake::Loggable.instance).to receive(:error).with(
76
- /Airbrake: error while parsing body \(.*unexpected token.*\)\. Body: foo/
76
+ /Airbrake: error while parsing body \(.*unexpected token.*\)\. Body: foo/,
77
77
  )
78
78
  described_class.parse(response)
79
79
  end
80
80
 
81
81
  it "returns an error message" do
82
82
  expect(described_class.parse(response)['error']).to match(
83
- /\A#<JSON::ParserError.+>/
83
+ /\A#<JSON::ParserError.+>/,
84
84
  )
85
85
  end
86
86
  end
data/spec/spec_helper.rb CHANGED
@@ -47,7 +47,7 @@ class AirbrakeTestError < RuntimeError
47
47
  "/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:88:in `run'",
48
48
  "/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:73:in `run'",
49
49
  "/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:41:in `invoke'",
50
- "/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/exe/rspec:4:in `<main>'"
50
+ "/home/kyrylo/.gem/ruby/2.2.2/gems/rspec-core-3.3.2/exe/rspec:4:in `<main>'",
51
51
  ]
52
52
  # rubocop:enable Metrics/LineLength
53
53
  end
@@ -78,7 +78,7 @@ class JavaAirbrakeTestError < AirbrakeTestError
78
78
  "opt.rubies.jruby_minus_9_dot_0_dot_0_dot_0.bin.irb.RUBY$script(/opt/rubies/jruby-9.0.0.0/bin/irb:13)",
79
79
  "org.jruby.ir.Compiler$1.load(Compiler.java:111)",
80
80
  "org.jruby.Main.run(Main.java:225)",
81
- "org.jruby.Main.main(Main.java:197)"
81
+ "org.jruby.Main.main(Main.java:197)",
82
82
  ]
83
83
  # rubocop:enable Metrics/LineLength
84
84
  end
data/spec/stat_spec.rb CHANGED
@@ -5,7 +5,7 @@ RSpec.describe Airbrake::Stat do
5
5
  'count' => 0,
6
6
  'sum' => 0.0,
7
7
  'sumsq' => 0.0,
8
- 'tdigest' => 'AAAAAkA0AAAAAAAAAAAAAA=='
8
+ 'tdigest' => 'AAAAAkA0AAAAAAAAAAAAAA==',
9
9
  )
10
10
  end
11
11
  end
@@ -34,7 +34,7 @@ RSpec.describe Airbrake::Stat do
34
34
  describe "#inspect" do
35
35
  it "provides custom inspect output" do
36
36
  expect(subject.inspect).to eq(
37
- '#<struct Airbrake::Stat count=0, sum=0.0, sumsq=0.0>'
37
+ '#<struct Airbrake::Stat count=0, sum=0.0, sumsq=0.0>',
38
38
  )
39
39
  end
40
40
  end
@@ -1,7 +1,7 @@
1
1
  RSpec.describe Airbrake::SyncSender do
2
2
  before do
3
3
  Airbrake::Config.instance = Airbrake::Config.new(
4
- project_id: 1, project_key: 'banana'
4
+ project_id: 1, project_key: 'banana',
5
5
  )
6
6
  end
7
7
 
@@ -17,8 +17,8 @@ RSpec.describe Airbrake::SyncSender do
17
17
  subject.send({}, promise)
18
18
  expect(
19
19
  a_request(:post, endpoint).with(
20
- headers: { 'Content-Type' => 'application/json' }
21
- )
20
+ headers: { 'Content-Type' => 'application/json' },
21
+ ),
22
22
  ).to have_been_made.once
23
23
  end
24
24
 
@@ -27,9 +27,9 @@ RSpec.describe Airbrake::SyncSender do
27
27
  expect(
28
28
  a_request(:post, endpoint).with(
29
29
  headers: {
30
- 'User-Agent' => %r{airbrake-ruby/\d+\.\d+\.\d+ Ruby/\d+\.\d+\.\d+}
31
- }
32
- )
30
+ 'User-Agent' => %r{airbrake-ruby/\d+\.\d+\.\d+ Ruby/\d+\.\d+\.\d+},
31
+ },
32
+ ),
33
33
  ).to have_been_made.once
34
34
  end
35
35
 
@@ -37,8 +37,8 @@ RSpec.describe Airbrake::SyncSender do
37
37
  subject.send({}, promise)
38
38
  expect(
39
39
  a_request(:post, endpoint).with(
40
- headers: { 'Authorization' => 'Bearer banana' }
41
- )
40
+ headers: { 'Authorization' => 'Bearer banana' },
41
+ ),
42
42
  ).to have_been_made.once
43
43
  end
44
44
 
@@ -47,7 +47,7 @@ RSpec.describe Airbrake::SyncSender do
47
47
  allow(subject).to receive(:build_https).and_return(https)
48
48
  allow(https).to receive(:request).and_raise(StandardError.new('foo'))
49
49
  expect(Airbrake::Loggable.instance).to receive(:error).with(
50
- /HTTP error: foo/
50
+ /HTTP error: foo/,
51
51
  )
52
52
  expect(subject.send({}, promise)).to be_an(Airbrake::Promise)
53
53
  expect(promise.value).to eq('error' => '**Airbrake: HTTP error: foo')
@@ -69,10 +69,10 @@ RSpec.describe Airbrake::SyncSender do
69
69
  notice = Airbrake::Notice.new(ex)
70
70
 
71
71
  expect(Airbrake::Loggable.instance).to receive(:error).with(
72
- /data was not sent/
72
+ /data was not sent/,
73
73
  )
74
74
  expect(Airbrake::Loggable.instance).to receive(:error).with(
75
- /truncation failed/
75
+ /truncation failed/,
76
76
  )
77
77
  expect(subject.send(notice, promise)).to be_an(Airbrake::Promise)
78
78
  expect(promise.value)
@@ -87,7 +87,7 @@ RSpec.describe Airbrake::SyncSender do
87
87
  stub_request(:post, endpoint).to_return(
88
88
  status: 429,
89
89
  body: '{"message":"IP is rate limited"}',
90
- headers: { 'X-RateLimit-Delay' => '1' }
90
+ headers: { 'X-RateLimit-Delay' => '1' },
91
91
  )
92
92
  end
93
93
 
data/spec/tdigest_spec.rb CHANGED
@@ -29,7 +29,7 @@ RSpec.describe Airbrake::TDigest do
29
29
  new_tdigest = described_class.from_bytes(bytes)
30
30
  # Expect some rounding error due to compression
31
31
  expect(new_tdigest.percentile(0.9).round(5)).to eq(
32
- subject.percentile(0.9).round(5)
32
+ subject.percentile(0.9).round(5),
33
33
  )
34
34
  expect(new_tdigest.as_small_bytes).to eq(bytes)
35
35
  end
@@ -126,8 +126,8 @@ RSpec.describe Airbrake::TDigest do
126
126
  113270270.27027026,
127
127
  154459459.45945945,
128
128
  123829787.23404256,
129
- 103191489.36170213
130
- ]
129
+ 103191489.36170213,
130
+ ],
131
131
  )
132
132
  end
133
133
 
@@ -166,13 +166,13 @@ RSpec.describe Airbrake::TDigest do
166
166
  it "has the parameters of the left argument (the calling tdigest)" do
167
167
  new_tdigest = subject + @other
168
168
  expect(new_tdigest.instance_variable_get(:@delta)).to eq(
169
- subject.instance_variable_get(:@delta)
169
+ subject.instance_variable_get(:@delta),
170
170
  )
171
171
  expect(new_tdigest.instance_variable_get(:@k)).to eq(
172
- subject.instance_variable_get(:@k)
172
+ subject.instance_variable_get(:@k),
173
173
  )
174
174
  expect(new_tdigest.instance_variable_get(:@cx)).to eq(
175
- subject.instance_variable_get(:@cx)
175
+ subject.instance_variable_get(:@cx),
176
176
  )
177
177
  end
178
178
 
@@ -7,7 +7,7 @@ RSpec.describe Airbrake::ThreadPool do
7
7
  described_class.new(
8
8
  worker_size: worker_size,
9
9
  queue_size: queue_size,
10
- block: proc { |message| tasks << message }
10
+ block: proc { |message| tasks << message },
11
11
  )
12
12
  end
13
13
 
@@ -35,7 +35,7 @@ RSpec.describe Airbrake::ThreadPool do
35
35
  described_class.new(
36
36
  worker_size: 1,
37
37
  queue_size: 1,
38
- block: proc { |message| tasks << message }
38
+ block: proc { |message| tasks << message },
39
39
  )
40
40
  end
41
41
 
@@ -98,11 +98,11 @@ RSpec.describe Airbrake::ThreadPool do
98
98
  context "when there's some work to do" do
99
99
  it "logs how many tasks are left to process" do
100
100
  thread_pool = described_class.new(
101
- worker_size: 0, queue_size: 2, block: proc {}
101
+ worker_size: 0, queue_size: 2, block: proc {},
102
102
  )
103
103
 
104
104
  expect(Airbrake::Loggable.instance).to receive(:debug).with(
105
- /waiting to process \d+ task\(s\)/
105
+ /waiting to process \d+ task\(s\)/,
106
106
  )
107
107
  expect(Airbrake::Loggable.instance).to receive(:debug).with(/closed/)
108
108
 
@@ -112,7 +112,7 @@ RSpec.describe Airbrake::ThreadPool do
112
112
 
113
113
  it "waits until the queue gets empty" do
114
114
  thread_pool = described_class.new(
115
- worker_size: 1, queue_size: 2, block: proc {}
115
+ worker_size: 1, queue_size: 2, block: proc {},
116
116
  )
117
117
 
118
118
  10.times { subject << 1 }
@@ -117,7 +117,7 @@ RSpec.describe Airbrake::TimedTrace do
117
117
  it "returns a Hash with all spans" do
118
118
  expect(subject.spans).to match(
119
119
  'operation' => be > 0,
120
- 'another operation' => be > 0
120
+ 'another operation' => be > 0,
121
121
  )
122
122
  end
123
123
  end
@@ -25,7 +25,7 @@ RSpec.describe Airbrake::Truncator do
25
25
  banana: multiply_by_2_max_len('a'),
26
26
  kiwi: multiply_by_2_max_len('b'),
27
27
  strawberry: 'c',
28
- shrimp: 'd'
28
+ shrimp: 'd',
29
29
  }.freeze
30
30
  end
31
31
 
@@ -34,7 +34,7 @@ RSpec.describe Airbrake::Truncator do
34
34
  expect(subject).to be_frozen
35
35
 
36
36
  expect(subject).to eq(
37
- banana: 'aaa[Truncated]', kiwi: 'bbb[Truncated]', strawberry: 'c'
37
+ banana: 'aaa[Truncated]', kiwi: 'bbb[Truncated]', strawberry: 'c',
38
38
  )
39
39
  expect(subject[:banana]).to be_frozen
40
40
  expect(subject[:kiwi]).to be_frozen
@@ -48,7 +48,7 @@ RSpec.describe Airbrake::Truncator do
48
48
  multiply_by_2_max_len('a'),
49
49
  'b',
50
50
  multiply_by_2_max_len('c'),
51
- 'd'
51
+ 'd',
52
52
  ].freeze
53
53
  end
54
54
 
@@ -69,7 +69,7 @@ RSpec.describe Airbrake::Truncator do
69
69
  multiply_by_2_max_len('a'),
70
70
  'b',
71
71
  multiply_by_2_max_len('c'),
72
- 'd'
72
+ 'd',
73
73
  ]).freeze
74
74
  end
75
75
 
@@ -78,7 +78,7 @@ RSpec.describe Airbrake::Truncator do
78
78
  expect(subject).to be_frozen
79
79
 
80
80
  expect(subject).to eq(
81
- Set.new(['aaa[Truncated]', 'b', 'ccc[Truncated]'])
81
+ Set.new(['aaa[Truncated]', 'b', 'ccc[Truncated]']),
82
82
  )
83
83
  expect(subject).to be_frozen
84
84
  end
@@ -166,7 +166,7 @@ RSpec.describe Airbrake::Truncator do
166
166
 
167
167
  it "prevents recursion" do
168
168
  expect(subject).to eq(
169
- Set.new(['[Circular]', { k: '[Circular]' }, 'aaa[Truncated]'])
169
+ Set.new(['[Circular]', { k: '[Circular]' }, 'aaa[Truncated]']),
170
170
  )
171
171
  expect(subject).to be_frozen
172
172
  end
@@ -177,13 +177,13 @@ RSpec.describe Airbrake::Truncator do
177
177
  {
178
178
  a: multiply_by_2_max_len('a'),
179
179
  b: multiply_by_2_max_len('b'),
180
- c: { d: multiply_by_2_max_len('d'), e: 'e' }
180
+ c: { d: multiply_by_2_max_len('d'), e: 'e' },
181
181
  }
182
182
  end
183
183
 
184
184
  it "truncates the long strings" do
185
185
  expect(subject).to eq(
186
- a: 'aaa[Truncated]', b: 'bbb[Truncated]', c: { d: 'ddd[Truncated]', e: 'e' }
186
+ a: 'aaa[Truncated]', b: 'bbb[Truncated]', c: { d: 'ddd[Truncated]', e: 'e' },
187
187
  )
188
188
  expect(subject).to be_frozen
189
189
  end
@@ -218,8 +218,8 @@ RSpec.describe Airbrake::Truncator do
218
218
  errors: [
219
219
  { file: 'a' },
220
220
  { file: 'a' },
221
- hashie.new.merge(file: 'bcde')
222
- ]
221
+ hashie.new.merge(file: 'bcde'),
222
+ ],
223
223
  }
224
224
  end
225
225
 
@@ -228,8 +228,8 @@ RSpec.describe Airbrake::Truncator do
228
228
  errors: [
229
229
  { file: 'a' },
230
230
  { file: 'a' },
231
- hashie.new.merge(file: 'bcd[Truncated]')
232
- ]
231
+ hashie.new.merge(file: 'bcd[Truncated]'),
232
+ ],
233
233
  )
234
234
  expect(subject).to be_frozen
235
235
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.9.0
4
+ version: 4.10.0
5
5
  platform: java
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-09 00:00:00.000000000 Z
11
+ date: 2019-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbtree-jruby