airbrake-ruby 4.11.0-java → 4.11.1-java

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2583597d5f9ccbfe09e3d861ebdc75ca8258e24fb829e265501f10b084ac0c32
4
- data.tar.gz: 2117a15ce8ee4de598ad3da47562614087c76765573e76b66d300fbb85f0a8ea
3
+ metadata.gz: a57915aa35401d290910ae5b67ae0b4242b2204a8d01b3d2a0162105cdf4a2c8
4
+ data.tar.gz: c32c7e64425037221491c64de8e22d548815929ec6e3a0289aad3c74f8ffedc7
5
5
  SHA512:
6
- metadata.gz: d519aacd0c4f2b16e31cf08a45c00db1290a8260e93f5eacc650b96dda8f42930876cd028e0ecc5cae94526d0caaaf0dcd453025b8b909a46e3b2d0f4995bbcf
7
- data.tar.gz: cdf685b1acae7c8d94103561cf28597775638fb6d8e1a9635775fc3966d91006e46defdb0ac2ed4d917ad168b664ab2c9db1c2f3aab33fb87ec5ff8b929a906c
6
+ metadata.gz: 8b21ffa32f19b58f5f9486623818d054d416dad398ea09d2db7045c7ee034178fe4921ca7ae5b0ac499dde77d61c3eefc3127fbb3c2a434ba607177c72790e6d
7
+ data.tar.gz: 300176c0bab2a6ddcb4b3453069be19ef5a477021ca10f68256edabc97c9d0d15b3b4a5659f2676e53071f89229b59c90ac6d0f1016d953342af8d9fc8b27581
@@ -120,14 +120,13 @@ module Airbrake
120
120
  end
121
121
 
122
122
  def send_resource(resource, sync:)
123
- promise = @config.check_configuration
124
- return promise if promise.rejected?
125
-
126
- promise = @config.check_performance_options(resource)
123
+ promise = check_configuration(resource)
127
124
  return promise if promise.rejected?
128
125
 
129
126
  @filter_chain.refine(resource)
130
- return if resource.ignored?
127
+ if resource.ignored?
128
+ return Promise.new.reject("#{resource.class} was ignored by a filter")
129
+ end
131
130
 
132
131
  @mutex.synchronize do
133
132
  update_payload(resource)
@@ -139,6 +138,20 @@ module Airbrake
139
138
  end
140
139
  end
141
140
 
141
+ def check_configuration(resource)
142
+ promise = @config.check_configuration
143
+ return promise if promise.rejected?
144
+
145
+ promise = @config.check_performance_options(resource)
146
+ return promise if promise.rejected?
147
+
148
+ if resource.timing && resource.timing == 0
149
+ return Promise.new.reject(':timing cannot be zero')
150
+ end
151
+
152
+ Promise.new
153
+ end
154
+
142
155
  def send(sender, payload, promise)
143
156
  signature = "#{self.class.name}##{__method__}"
144
157
  raise "#{signature}: payload (#{payload}) cannot be empty. Race?" if payload.none?
@@ -2,5 +2,5 @@
2
2
  # More information: http://semver.org/
3
3
  module Airbrake
4
4
  # @return [String] the library version
5
- AIRBRAKE_RUBY_VERSION = '4.11.0'.freeze
5
+ AIRBRAKE_RUBY_VERSION = '4.11.1'.freeze
6
6
  end
@@ -171,7 +171,7 @@ RSpec.describe Airbrake do
171
171
  method: 'GET',
172
172
  route: '/',
173
173
  status_code: 200,
174
- start_time: Time.now,
174
+ timing: 1,
175
175
  )
176
176
  end
177
177
  end
@@ -187,7 +187,7 @@ RSpec.describe Airbrake do
187
187
  method: 'GET',
188
188
  route: '/',
189
189
  status_code: 200,
190
- start_time: Time.now,
190
+ timing: 1,
191
191
  },
192
192
  request_id: 1,
193
193
  )
@@ -204,7 +204,7 @@ RSpec.describe Airbrake do
204
204
  method: 'GET',
205
205
  route: '/',
206
206
  status_code: 200,
207
- start_time: Time.now,
207
+ timing: 1,
208
208
  },
209
209
  request_id: 1,
210
210
  )
@@ -222,7 +222,7 @@ RSpec.describe Airbrake do
222
222
  method: 'GET',
223
223
  route: '/',
224
224
  query: '',
225
- start_time: Time.now,
225
+ timing: 1,
226
226
  )
227
227
  end
228
228
  end
@@ -238,7 +238,7 @@ RSpec.describe Airbrake do
238
238
  method: 'GET',
239
239
  route: '/',
240
240
  query: '',
241
- start_time: Time.now,
241
+ timing: 1,
242
242
  },
243
243
  request_id: 1,
244
244
  )
@@ -255,7 +255,7 @@ RSpec.describe Airbrake do
255
255
  method: 'GET',
256
256
  route: '/',
257
257
  query: '',
258
- start_time: Time.now,
258
+ timing: 1,
259
259
  },
260
260
  request_id: 1,
261
261
  )
@@ -273,7 +273,7 @@ RSpec.describe Airbrake do
273
273
  method: 'GET',
274
274
  route: '/',
275
275
  query: '',
276
- start_time: Time.now,
276
+ timing: 1,
277
277
  )
278
278
  end
279
279
  end
@@ -292,7 +292,7 @@ RSpec.describe Airbrake do
292
292
  route: '/',
293
293
  response_type: :html,
294
294
  groups: {},
295
- start_time: Time.now,
295
+ timing: 1,
296
296
  },
297
297
  request_id: 1,
298
298
  )
@@ -310,7 +310,7 @@ RSpec.describe Airbrake do
310
310
  route: '/',
311
311
  response_type: :html,
312
312
  groups: {},
313
- start_time: Time.now,
313
+ timing: 1,
314
314
  },
315
315
  request_id: 1,
316
316
  )
@@ -110,9 +110,7 @@ RSpec.describe Airbrake::Config do
110
110
 
111
111
  describe "#check_performance_options" do
112
112
  it "returns a promise" do
113
- resource = Airbrake::Query.new(
114
- method: '', route: '', query: '', start_time: Time.now,
115
- )
113
+ resource = Airbrake::Query.new(method: '', route: '', query: '', timing: 1)
116
114
  expect(subject.check_performance_options(resource))
117
115
  .to be_an(Airbrake::Promise)
118
116
  end
@@ -122,7 +120,7 @@ RSpec.describe Airbrake::Config do
122
120
 
123
121
  let(:resource) do
124
122
  Airbrake::Request.new(
125
- method: 'GET', route: '/foo', status_code: 200, start_time: Time.new,
123
+ method: 'GET', route: '/foo', status_code: 200, timing: 1,
126
124
  )
127
125
  end
128
126
 
@@ -138,9 +136,7 @@ RSpec.describe Airbrake::Config do
138
136
  before { subject.query_stats = false }
139
137
 
140
138
  let(:resource) do
141
- Airbrake::Query.new(
142
- method: 'GET', route: '/foo', query: '', start_time: Time.new,
143
- )
139
+ Airbrake::Query.new(method: 'GET', route: '/foo', query: '', timing: 1)
144
140
  end
145
141
 
146
142
  it "returns a rejected promise" do
@@ -13,9 +13,7 @@ RSpec.describe Airbrake::Filters::SqlFilter do
13
13
  shared_examples "query blacklisting" do |query, opts|
14
14
  it "ignores '#{query}'" do
15
15
  filter = described_class.new('postgres')
16
- q = Airbrake::Query.new(
17
- query: query, method: 'GET', route: '/', start_time: Time.now,
18
- )
16
+ q = Airbrake::Query.new(query: query, method: 'GET', route: '/', timing: 1)
19
17
  filter.call(q)
20
18
 
21
19
  expect(q.ignored?).to eq(opts[:should_ignore])
@@ -475,7 +475,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
475
475
  method: 'GET',
476
476
  route: '/foo',
477
477
  status_code: 200,
478
- start_time: Time.new(2018, 1, 1, 0, 49, 0, 0),
478
+ timing: 1,
479
479
  ),
480
480
  )
481
481
  subject.close
@@ -489,13 +489,29 @@ RSpec.describe Airbrake::PerformanceNotifier do
489
489
  method: 'POST',
490
490
  route: '/foo',
491
491
  query: 'SELECT * FROM things',
492
- start_time: Time.new(2018, 1, 1, 0, 49, 0, 0),
492
+ timing: 1,
493
493
  ),
494
494
  )
495
495
  subject.close
496
496
 
497
497
  expect(a_request(:put, queries)).not_to have_been_made
498
498
  end
499
+
500
+ it "returns a rejected promise" do
501
+ promise = subject.notify(
502
+ Airbrake::Query.new(
503
+ method: 'POST',
504
+ route: '/foo',
505
+ query: 'SELECT * FROM things',
506
+ timing: 1,
507
+ ),
508
+ )
509
+ subject.close
510
+
511
+ expect(promise.value).to eq(
512
+ 'error' => 'Airbrake::Query was ignored by a filter',
513
+ )
514
+ end
499
515
  end
500
516
 
501
517
  context "when a filter that modifies payload was defined" do
@@ -548,6 +564,24 @@ RSpec.describe Airbrake::PerformanceNotifier do
548
564
  ).to have_been_made
549
565
  end
550
566
  end
567
+
568
+ context "when provided :timing is zero" do
569
+ it "doesn't notify" do
570
+ queue = Airbrake::Queue.new(queue: 'bananas', error_count: 0, timing: 0)
571
+ subject.notify(queue)
572
+ subject.close
573
+
574
+ expect(a_request(:put, queues)).not_to have_been_made
575
+ end
576
+
577
+ it "returns a rejected promise" do
578
+ queue = Airbrake::Queue.new(queue: 'bananas', error_count: 0, timing: 0)
579
+ promise = subject.notify(queue)
580
+ subject.close
581
+
582
+ expect(promise.value).to eq('error' => ':timing cannot be zero')
583
+ end
584
+ end
551
585
  end
552
586
 
553
587
  describe "#notify_sync" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.11.0
4
+ version: 4.11.1
5
5
  platform: java
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.