airbrake-ruby 4.2.2-java → 4.2.3-java
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of airbrake-ruby might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/airbrake-ruby.rb +36 -19
- data/lib/airbrake-ruby/version.rb +1 -1
- data/spec/airbrake_spec.rb +47 -9
- data/spec/filters/git_revision_filter_spec.rb +3 -1
- 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: 21a4892144d86df478ce7d7d694797e7ed01e1a6
|
4
|
+
data.tar.gz: b286b7e4ac43b7386c67ad1f98403a8f8cbc9371
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1840ca5c36d9d581403fa7eed0db66f4a750636b6759ae86f44e02b0246106035dcaf9946c4316ba16a61719844f6aabb690c12199c9e8d557a382c07b43e8c
|
7
|
+
data.tar.gz: 81cd2aa61fa9cb2f325f4b6d3578ff820db81393e8be563635963098c8c68e3e4020e55362fbb5df11a7a752ca47a83c3c08b4b62bf42122918f8185274c0efc
|
data/lib/airbrake-ruby.rb
CHANGED
@@ -79,6 +79,18 @@ module Airbrake
|
|
79
79
|
# @see Airbrake.$0
|
80
80
|
|
81
81
|
class << self
|
82
|
+
# @since v4.2.3
|
83
|
+
# @api private
|
84
|
+
attr_accessor :performance_notifier
|
85
|
+
|
86
|
+
# @since v4.2.3
|
87
|
+
# @api private
|
88
|
+
attr_accessor :notice_notifier
|
89
|
+
|
90
|
+
# @since v4.2.3
|
91
|
+
# @api private
|
92
|
+
attr_accessor :deploy_notifier
|
93
|
+
|
82
94
|
# Configures the Airbrake notifier.
|
83
95
|
#
|
84
96
|
# @example
|
@@ -96,13 +108,16 @@ module Airbrake
|
|
96
108
|
def configure
|
97
109
|
yield config = Airbrake::Config.instance
|
98
110
|
Airbrake::Loggable.instance = config.logger
|
111
|
+
|
112
|
+
return if performance_notifier && notice_notifier && deploy_notifier
|
113
|
+
|
99
114
|
reset
|
100
115
|
end
|
101
116
|
|
102
117
|
# @return [Boolean] true if the notifier was configured, false otherwise
|
103
118
|
# @since v2.3.0
|
104
119
|
def configured?
|
105
|
-
|
120
|
+
notice_notifier.configured?
|
106
121
|
end
|
107
122
|
|
108
123
|
# Sends an exception to Airbrake asynchronously.
|
@@ -127,7 +142,7 @@ module Airbrake
|
|
127
142
|
# @return [Airbrake::Promise]
|
128
143
|
# @see .notify_sync
|
129
144
|
def notify(exception, params = {}, &block)
|
130
|
-
|
145
|
+
notice_notifier.notify(exception, params, &block)
|
131
146
|
end
|
132
147
|
|
133
148
|
# Sends an exception to Airbrake synchronously.
|
@@ -147,7 +162,7 @@ module Airbrake
|
|
147
162
|
# @return [Airbrake::Promise] the reponse from the server
|
148
163
|
# @see .notify
|
149
164
|
def notify_sync(exception, params = {}, &block)
|
150
|
-
|
165
|
+
notice_notifier.notify_sync(exception, params, &block)
|
151
166
|
end
|
152
167
|
|
153
168
|
# Runs a callback before {.notify} or {.notify_sync} kicks in. This is
|
@@ -175,7 +190,7 @@ module Airbrake
|
|
175
190
|
# @yieldreturn [void]
|
176
191
|
# @return [void]
|
177
192
|
def add_filter(filter = nil, &block)
|
178
|
-
|
193
|
+
notice_notifier.add_filter(filter, &block)
|
179
194
|
end
|
180
195
|
|
181
196
|
# Deletes a filter added via {Airbrake#add_filter}.
|
@@ -192,7 +207,7 @@ module Airbrake
|
|
192
207
|
# @since v3.1.0
|
193
208
|
# @note This method cannot delete filters assigned via the Proc form.
|
194
209
|
def delete_filter(filter_class)
|
195
|
-
|
210
|
+
notice_notifier.delete_filter(filter_class)
|
196
211
|
end
|
197
212
|
|
198
213
|
# Builds an Airbrake notice. This is useful, if you want to add or modify a
|
@@ -210,7 +225,7 @@ module Airbrake
|
|
210
225
|
# @return [Airbrake::Notice] the notice built with help of the given
|
211
226
|
# arguments
|
212
227
|
def build_notice(exception, params = {})
|
213
|
-
|
228
|
+
notice_notifier.build_notice(exception, params)
|
214
229
|
end
|
215
230
|
|
216
231
|
# Makes the notice notifier a no-op, which means you cannot use the
|
@@ -223,7 +238,7 @@ module Airbrake
|
|
223
238
|
#
|
224
239
|
# @return [void]
|
225
240
|
def close
|
226
|
-
|
241
|
+
notice_notifier.close
|
227
242
|
end
|
228
243
|
|
229
244
|
# Pings the Airbrake Deploy API endpoint about the occurred deploy.
|
@@ -236,7 +251,7 @@ module Airbrake
|
|
236
251
|
# @option deploy_info [Symbol] :version
|
237
252
|
# @return [void]
|
238
253
|
def notify_deploy(deploy_info)
|
239
|
-
|
254
|
+
deploy_notifier.notify(deploy_info)
|
240
255
|
end
|
241
256
|
|
242
257
|
# Merges +context+ with the current context.
|
@@ -284,7 +299,7 @@ module Airbrake
|
|
284
299
|
# @param [Hash{Symbol=>Object}] context
|
285
300
|
# @return [void]
|
286
301
|
def merge_context(context)
|
287
|
-
|
302
|
+
notice_notifier.merge_context(context)
|
288
303
|
end
|
289
304
|
|
290
305
|
# Increments request statistics of a certain +route+ that was invoked on
|
@@ -323,7 +338,7 @@ module Airbrake
|
|
323
338
|
# @since v3.0.0
|
324
339
|
# @see Airbrake::PerformanceNotifier#notify
|
325
340
|
def notify_request(request_info)
|
326
|
-
|
341
|
+
performance_notifier.notify(Request.new(request_info))
|
327
342
|
end
|
328
343
|
|
329
344
|
# Increments SQL statistics of a certain +query+ that was invoked on
|
@@ -354,7 +369,7 @@ module Airbrake
|
|
354
369
|
# @since v3.2.0
|
355
370
|
# @see Airbrake::PerformanceNotifier#notify
|
356
371
|
def notify_query(query_info)
|
357
|
-
|
372
|
+
performance_notifier.notify(Query.new(query_info))
|
358
373
|
end
|
359
374
|
|
360
375
|
# Increments performance breakdown statistics of a certain route.
|
@@ -378,7 +393,7 @@ module Airbrake
|
|
378
393
|
# @return [void]
|
379
394
|
# @since v4.2.0
|
380
395
|
def notify_performance_breakdown(breakdown_info)
|
381
|
-
|
396
|
+
performance_notifier.notify(PerformanceBreakdown.new(breakdown_info))
|
382
397
|
end
|
383
398
|
|
384
399
|
# Runs a callback before {.notify_request} or {.notify_query} kicks in. This
|
@@ -413,7 +428,7 @@ module Airbrake
|
|
413
428
|
# @since v3.2.0
|
414
429
|
# @see Airbrake::PerformanceNotifier#add_filter
|
415
430
|
def add_performance_filter(filter = nil, &block)
|
416
|
-
|
431
|
+
performance_notifier.add_filter(filter, &block)
|
417
432
|
end
|
418
433
|
|
419
434
|
# Deletes a filter added via {Airbrake#add_performance_filter}.
|
@@ -431,20 +446,22 @@ module Airbrake
|
|
431
446
|
# @note This method cannot delete filters assigned via the Proc form.
|
432
447
|
# @see Airbrake::PerformanceNotifier#delete_filter
|
433
448
|
def delete_performance_filter(filter_class)
|
434
|
-
|
449
|
+
performance_notifier.delete_filter(filter_class)
|
435
450
|
end
|
436
451
|
|
437
452
|
# Resets all notifiers, including its filters
|
438
453
|
# @return [void]
|
439
454
|
# @since v4.2.2
|
440
455
|
def reset
|
441
|
-
close if
|
456
|
+
close if notice_notifier && configured?
|
442
457
|
|
443
|
-
|
444
|
-
|
445
|
-
|
458
|
+
self.performance_notifier = PerformanceNotifier.new
|
459
|
+
self.notice_notifier = NoticeNotifier.new
|
460
|
+
self.deploy_notifier = DeployNotifier.new
|
446
461
|
end
|
447
462
|
end
|
448
463
|
end
|
449
464
|
|
450
|
-
Airbrake.
|
465
|
+
Airbrake.configure do
|
466
|
+
# Initialize Airbrake with default notifiers.
|
467
|
+
end
|
data/spec/airbrake_spec.rb
CHANGED
@@ -1,12 +1,24 @@
|
|
1
1
|
RSpec.describe Airbrake do
|
2
|
-
|
3
|
-
|
4
|
-
described_class.reset
|
2
|
+
it "gets initialized with a performance notifier" do
|
3
|
+
expect(described_class.performance_notifier).not_to be_nil
|
5
4
|
end
|
6
5
|
|
7
|
-
|
6
|
+
it "gets initialized with a notice notifier" do
|
7
|
+
expect(described_class.notice_notifier).not_to be_nil
|
8
|
+
end
|
9
|
+
|
10
|
+
it "gets initialized with a deploy notifier" do
|
11
|
+
expect(described_class.deploy_notifier).not_to be_nil
|
12
|
+
end
|
8
13
|
|
9
14
|
describe ".configure" do
|
15
|
+
before do
|
16
|
+
Airbrake::Config.instance = Airbrake::Config.new
|
17
|
+
described_class.reset
|
18
|
+
end
|
19
|
+
|
20
|
+
after { described_class.reset }
|
21
|
+
|
10
22
|
it "yields the config" do
|
11
23
|
expect do |b|
|
12
24
|
begin
|
@@ -41,18 +53,18 @@ RSpec.describe Airbrake do
|
|
41
53
|
|
42
54
|
context "when a notifier was configured" do
|
43
55
|
before do
|
44
|
-
expect(described_class).to receive(:configured?).
|
56
|
+
expect(described_class).to receive(:configured?).and_return(true)
|
45
57
|
end
|
46
58
|
|
47
59
|
it "closes previously configured notice notifier" do
|
48
|
-
expect(described_class).to receive(:close)
|
60
|
+
expect(described_class).to receive(:close)
|
49
61
|
described_class.configure {}
|
50
62
|
end
|
51
63
|
end
|
52
64
|
|
53
65
|
context "when a notifier wasn't configured" do
|
54
66
|
before do
|
55
|
-
expect(described_class).to receive(:configured?).
|
67
|
+
expect(described_class).to receive(:configured?).and_return(false)
|
56
68
|
end
|
57
69
|
|
58
70
|
it "doesn't close previously configured notice notifier" do
|
@@ -60,16 +72,42 @@ RSpec.describe Airbrake do
|
|
60
72
|
described_class.configure {}
|
61
73
|
end
|
62
74
|
end
|
75
|
+
|
76
|
+
context "when called multiple times" do
|
77
|
+
it "doesn't overwrite performance notifier" do
|
78
|
+
described_class.configure {}
|
79
|
+
performance_notifier = described_class.performance_notifier
|
80
|
+
|
81
|
+
described_class.configure {}
|
82
|
+
expect(described_class.performance_notifier).to eql(performance_notifier)
|
83
|
+
end
|
84
|
+
|
85
|
+
it "doesn't overwrite notice notifier" do
|
86
|
+
described_class.configure {}
|
87
|
+
notice_notifier = described_class.notice_notifier
|
88
|
+
|
89
|
+
described_class.configure {}
|
90
|
+
expect(described_class.notice_notifier).to eql(notice_notifier)
|
91
|
+
end
|
92
|
+
|
93
|
+
it "doesn't overwrite deploy notifier" do
|
94
|
+
described_class.configure {}
|
95
|
+
deploy_notifier = described_class.deploy_notifier
|
96
|
+
|
97
|
+
described_class.configure {}
|
98
|
+
expect(described_class.deploy_notifier).to eql(deploy_notifier)
|
99
|
+
end
|
100
|
+
end
|
63
101
|
end
|
64
102
|
|
65
103
|
describe "#reset" do
|
66
104
|
context "when Airbrake was previously configured" do
|
67
105
|
before do
|
68
|
-
expect(described_class).to receive(:configured?).
|
106
|
+
expect(described_class).to receive(:configured?).and_return(true)
|
69
107
|
end
|
70
108
|
|
71
109
|
it "closes notice notifier" do
|
72
|
-
expect(described_class).to receive(:close)
|
110
|
+
expect(described_class).to receive(:close)
|
73
111
|
subject.reset
|
74
112
|
end
|
75
113
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
RSpec.describe Airbrake::Filters::GitRevisionFilter do
|
2
2
|
subject { described_class.new('root/dir') }
|
3
3
|
|
4
|
-
let
|
4
|
+
# 'let!', not 'let' to make sure Notice doesn't call File.exist? with
|
5
|
+
# unexpected arguments.
|
6
|
+
let!(:notice) { Airbrake::Notice.new(AirbrakeTestError.new) }
|
5
7
|
|
6
8
|
context "when context/revision is defined" do
|
7
9
|
it "doesn't attach anything to context/revision" do
|
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.2.
|
4
|
+
version: 4.2.3
|
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-
|
11
|
+
date: 2019-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbtree-jruby
|