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 +4 -4
- data/lib/airbrake-ruby/performance_notifier.rb +18 -5
- data/lib/airbrake-ruby/version.rb +1 -1
- data/spec/airbrake_spec.rb +9 -9
- data/spec/config_spec.rb +3 -7
- data/spec/filters/sql_filter_spec.rb +1 -3
- data/spec/performance_notifier_spec.rb +36 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a57915aa35401d290910ae5b67ae0b4242b2204a8d01b3d2a0162105cdf4a2c8
|
4
|
+
data.tar.gz: c32c7e64425037221491c64de8e22d548815929ec6e3a0289aad3c74f8ffedc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
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
|
-
|
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?
|
data/spec/airbrake_spec.rb
CHANGED
@@ -171,7 +171,7 @@ RSpec.describe Airbrake do
|
|
171
171
|
method: 'GET',
|
172
172
|
route: '/',
|
173
173
|
status_code: 200,
|
174
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
313
|
+
timing: 1,
|
314
314
|
},
|
315
315
|
request_id: 1,
|
316
316
|
)
|
data/spec/config_spec.rb
CHANGED
@@ -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,
|
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
|
-
|
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
|
-
|
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
|