airbrake-ruby 4.15.0 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/lib/airbrake-ruby/async_sender.rb +4 -2
  3. data/lib/airbrake-ruby/backtrace.rb +6 -5
  4. data/lib/airbrake-ruby/config/processor.rb +77 -0
  5. data/lib/airbrake-ruby/config/validator.rb +6 -0
  6. data/lib/airbrake-ruby/config.rb +44 -35
  7. data/lib/airbrake-ruby/context.rb +51 -0
  8. data/lib/airbrake-ruby/file_cache.rb +1 -1
  9. data/lib/airbrake-ruby/filter_chain.rb +3 -0
  10. data/lib/airbrake-ruby/filters/context_filter.rb +4 -5
  11. data/lib/airbrake-ruby/filters/dependency_filter.rb +1 -0
  12. data/lib/airbrake-ruby/filters/exception_attributes_filter.rb +1 -1
  13. data/lib/airbrake-ruby/filters/gem_root_filter.rb +1 -0
  14. data/lib/airbrake-ruby/filters/git_last_checkout_filter.rb +3 -4
  15. data/lib/airbrake-ruby/filters/git_repository_filter.rb +11 -2
  16. data/lib/airbrake-ruby/filters/git_revision_filter.rb +3 -1
  17. data/lib/airbrake-ruby/filters/keys_filter.rb +23 -15
  18. data/lib/airbrake-ruby/filters/root_directory_filter.rb +1 -0
  19. data/lib/airbrake-ruby/filters/sql_filter.rb +11 -11
  20. data/lib/airbrake-ruby/filters/system_exit_filter.rb +1 -0
  21. data/lib/airbrake-ruby/filters/thread_filter.rb +4 -3
  22. data/lib/airbrake-ruby/grouppable.rb +1 -1
  23. data/lib/airbrake-ruby/ignorable.rb +1 -2
  24. data/lib/airbrake-ruby/mergeable.rb +1 -1
  25. data/lib/airbrake-ruby/monotonic_time.rb +1 -1
  26. data/lib/airbrake-ruby/notice.rb +1 -8
  27. data/lib/airbrake-ruby/notice_notifier.rb +4 -4
  28. data/lib/airbrake-ruby/performance_breakdown.rb +1 -6
  29. data/lib/airbrake-ruby/performance_notifier.rb +40 -54
  30. data/lib/airbrake-ruby/promise.rb +1 -0
  31. data/lib/airbrake-ruby/query.rb +1 -6
  32. data/lib/airbrake-ruby/queue.rb +1 -8
  33. data/lib/airbrake-ruby/remote_settings/callback.rb +44 -0
  34. data/lib/airbrake-ruby/remote_settings/settings_data.rb +116 -0
  35. data/lib/airbrake-ruby/remote_settings.rb +128 -0
  36. data/lib/airbrake-ruby/request.rb +1 -8
  37. data/lib/airbrake-ruby/stat.rb +2 -13
  38. data/lib/airbrake-ruby/sync_sender.rb +3 -2
  39. data/lib/airbrake-ruby/tdigest.rb +12 -9
  40. data/lib/airbrake-ruby/thread_pool.rb +9 -6
  41. data/lib/airbrake-ruby/time_truncate.rb +2 -2
  42. data/lib/airbrake-ruby/timed_trace.rb +1 -3
  43. data/lib/airbrake-ruby/truncator.rb +8 -2
  44. data/lib/airbrake-ruby/version.rb +11 -1
  45. data/lib/airbrake-ruby.rb +44 -54
  46. data/spec/airbrake_spec.rb +178 -92
  47. data/spec/async_sender_spec.rb +10 -8
  48. data/spec/backtrace_spec.rb +39 -36
  49. data/spec/benchmark_spec.rb +7 -5
  50. data/spec/code_hunk_spec.rb +26 -17
  51. data/spec/config/processor_spec.rb +167 -0
  52. data/spec/config/validator_spec.rb +23 -3
  53. data/spec/config_spec.rb +43 -55
  54. data/spec/context_spec.rb +54 -0
  55. data/spec/deploy_notifier_spec.rb +6 -4
  56. data/spec/file_cache_spec.rb +1 -0
  57. data/spec/filter_chain_spec.rb +29 -24
  58. data/spec/filters/context_filter_spec.rb +14 -5
  59. data/spec/filters/dependency_filter_spec.rb +3 -1
  60. data/spec/filters/exception_attributes_filter_spec.rb +5 -3
  61. data/spec/filters/gem_root_filter_spec.rb +9 -6
  62. data/spec/filters/git_last_checkout_filter_spec.rb +10 -12
  63. data/spec/filters/{git_repository_filter.rb → git_repository_filter_spec.rb} +26 -15
  64. data/spec/filters/git_revision_filter_spec.rb +20 -20
  65. data/spec/filters/keys_allowlist_spec.rb +26 -16
  66. data/spec/filters/keys_blocklist_spec.rb +35 -18
  67. data/spec/filters/root_directory_filter_spec.rb +7 -7
  68. data/spec/filters/sql_filter_spec.rb +28 -28
  69. data/spec/filters/system_exit_filter_spec.rb +4 -2
  70. data/spec/filters/thread_filter_spec.rb +16 -14
  71. data/spec/loggable_spec.rb +2 -2
  72. data/spec/monotonic_time_spec.rb +8 -6
  73. data/spec/nested_exception_spec.rb +46 -46
  74. data/spec/notice_notifier/options_spec.rb +25 -15
  75. data/spec/notice_notifier_spec.rb +54 -49
  76. data/spec/notice_spec.rb +7 -3
  77. data/spec/performance_breakdown_spec.rb +0 -12
  78. data/spec/performance_notifier_spec.rb +69 -87
  79. data/spec/promise_spec.rb +38 -32
  80. data/spec/query_spec.rb +1 -11
  81. data/spec/queue_spec.rb +1 -13
  82. data/spec/remote_settings/callback_spec.rb +162 -0
  83. data/spec/remote_settings/settings_data_spec.rb +348 -0
  84. data/spec/remote_settings_spec.rb +201 -0
  85. data/spec/request_spec.rb +1 -13
  86. data/spec/response_spec.rb +34 -12
  87. data/spec/spec_helper.rb +4 -4
  88. data/spec/stashable_spec.rb +5 -5
  89. data/spec/stat_spec.rb +7 -14
  90. data/spec/sync_sender_spec.rb +52 -17
  91. data/spec/tdigest_spec.rb +61 -56
  92. data/spec/thread_pool_spec.rb +67 -58
  93. data/spec/time_truncate_spec.rb +23 -6
  94. data/spec/timed_trace_spec.rb +32 -30
  95. data/spec/truncator_spec.rb +72 -43
  96. metadata +67 -51
@@ -1,4 +1,6 @@
1
1
  RSpec.describe Airbrake::PerformanceNotifier do
2
+ subject(:perf_notifier) { described_class.new }
3
+
2
4
  let(:routes) { 'https://api.airbrake.io/api/v5/projects/1/routes-stats' }
3
5
  let(:queries) { 'https://api.airbrake.io/api/v5/projects/1/queries-stats' }
4
6
  let(:breakdowns) { 'https://api.airbrake.io/api/v5/projects/1/routes-breakdowns' }
@@ -22,7 +24,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
22
24
 
23
25
  describe "#notify" do
24
26
  it "sends full query" do
25
- subject.notify(
27
+ perf_notifier.notify(
26
28
  Airbrake::Query.new(
27
29
  method: 'POST',
28
30
  route: '/foo',
@@ -34,7 +36,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
34
36
  time: Time.new(2018, 1, 1, 0, 49, 0, 0),
35
37
  ),
36
38
  )
37
- subject.close
39
+ perf_notifier.close
38
40
 
39
41
  expect(
40
42
  a_request(:put, queries).with(body: %r|
@@ -55,7 +57,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
55
57
  end
56
58
 
57
59
  it "sends full request" do
58
- subject.notify(
60
+ perf_notifier.notify(
59
61
  Airbrake::Request.new(
60
62
  method: 'POST',
61
63
  route: '/foo',
@@ -64,7 +66,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
64
66
  time: Time.new(2018, 1, 1, 0, 49, 0, 0),
65
67
  ),
66
68
  )
67
- subject.close
69
+ perf_notifier.close
68
70
 
69
71
  expect(
70
72
  a_request(:put, routes).with(body: %r|
@@ -82,7 +84,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
82
84
  end
83
85
 
84
86
  it "sends full performance breakdown" do
85
- subject.notify(
87
+ perf_notifier.notify(
86
88
  Airbrake::PerformanceBreakdown.new(
87
89
  method: 'DELETE',
88
90
  route: '/routes-breakdowns',
@@ -92,7 +94,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
92
94
  groups: { db: 131, view: 421 },
93
95
  ),
94
96
  )
95
- subject.close
97
+ perf_notifier.close
96
98
 
97
99
  expect(
98
100
  a_request(:put, breakdowns).with(body: %r|
@@ -124,7 +126,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
124
126
  end
125
127
 
126
128
  it "sends full queue" do
127
- subject.notify(
129
+ perf_notifier.notify(
128
130
  Airbrake::Queue.new(
129
131
  queue: 'emails',
130
132
  error_count: 2,
@@ -133,7 +135,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
133
135
  time: Time.new(2018, 1, 1, 0, 49, 0, 0),
134
136
  ),
135
137
  )
136
- subject.close
138
+ perf_notifier.close
137
139
 
138
140
  expect(
139
141
  a_request(:put, queues).with(body: /
@@ -164,7 +166,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
164
166
  end
165
167
 
166
168
  it "rounds time to the floor minute" do
167
- subject.notify(
169
+ perf_notifier.notify(
168
170
  Airbrake::Request.new(
169
171
  method: 'GET',
170
172
  route: '/foo',
@@ -173,7 +175,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
173
175
  time: Time.new(2018, 1, 1, 0, 0, 20, 0),
174
176
  ),
175
177
  )
176
- subject.close
178
+ perf_notifier.close
177
179
 
178
180
  expect(
179
181
  a_request(:put, routes).with(body: /"time":"2018-01-01T00:00:00\+00:00"/),
@@ -181,7 +183,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
181
183
  end
182
184
 
183
185
  it "increments routes with the same key" do
184
- subject.notify(
186
+ perf_notifier.notify(
185
187
  Airbrake::Request.new(
186
188
  method: 'GET',
187
189
  route: '/foo',
@@ -189,7 +191,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
189
191
  timing: 213,
190
192
  ),
191
193
  )
192
- subject.notify(
194
+ perf_notifier.notify(
193
195
  Airbrake::Request.new(
194
196
  method: 'GET',
195
197
  route: '/foo',
@@ -197,7 +199,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
197
199
  timing: 123,
198
200
  ),
199
201
  )
200
- subject.close
202
+ perf_notifier.close
201
203
 
202
204
  expect(
203
205
  a_request(:put, routes).with(body: /"count":2/),
@@ -205,7 +207,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
205
207
  end
206
208
 
207
209
  it "groups routes by time" do
208
- subject.notify(
210
+ perf_notifier.notify(
209
211
  Airbrake::Request.new(
210
212
  method: 'GET',
211
213
  route: '/foo',
@@ -214,7 +216,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
214
216
  time: Time.new(2018, 1, 1, 0, 0, 49, 0),
215
217
  ),
216
218
  )
217
- subject.notify(
219
+ perf_notifier.notify(
218
220
  Airbrake::Request.new(
219
221
  method: 'GET',
220
222
  route: '/foo',
@@ -223,7 +225,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
223
225
  time: Time.new(2018, 1, 1, 0, 1, 49, 0),
224
226
  ),
225
227
  )
226
- subject.close
228
+ perf_notifier.close
227
229
 
228
230
  expect(
229
231
  a_request(:put, routes).with(
@@ -241,7 +243,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
241
243
  end
242
244
 
243
245
  it "groups routes by route key" do
244
- subject.notify(
246
+ perf_notifier.notify(
245
247
  Airbrake::Request.new(
246
248
  method: 'GET',
247
249
  route: '/foo',
@@ -250,7 +252,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
250
252
  time: Time.new(2018, 1, 1, 0, 49, 0, 0),
251
253
  ),
252
254
  )
253
- subject.notify(
255
+ perf_notifier.notify(
254
256
  Airbrake::Request.new(
255
257
  method: 'POST',
256
258
  route: '/foo',
@@ -259,7 +261,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
259
261
  time: Time.new(2018, 1, 1, 0, 49, 0, 0),
260
262
  ),
261
263
  )
262
- subject.close
264
+ perf_notifier.close
263
265
 
264
266
  expect(
265
267
  a_request(:put, routes).with(
@@ -277,7 +279,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
277
279
  end
278
280
 
279
281
  it "groups performance breakdowns by route key" do
280
- subject.notify(
282
+ perf_notifier.notify(
281
283
  Airbrake::PerformanceBreakdown.new(
282
284
  method: 'DELETE',
283
285
  route: '/routes-breakdowns',
@@ -287,7 +289,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
287
289
  groups: { db: 131, view: 421 },
288
290
  ),
289
291
  )
290
- subject.notify(
292
+ perf_notifier.notify(
291
293
  Airbrake::PerformanceBreakdown.new(
292
294
  method: 'DELETE',
293
295
  route: '/routes-breakdowns',
@@ -297,7 +299,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
297
299
  groups: { db: 55, view: 11 },
298
300
  ),
299
301
  )
300
- subject.close
302
+ perf_notifier.close
301
303
 
302
304
  expect(
303
305
  a_request(:put, breakdowns).with(body: %r|
@@ -329,7 +331,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
329
331
  end
330
332
 
331
333
  it "groups queues by queue key" do
332
- subject.notify(
334
+ perf_notifier.notify(
333
335
  Airbrake::Queue.new(
334
336
  queue: 'emails',
335
337
  error_count: 2,
@@ -338,7 +340,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
338
340
  time: Time.new(2018, 1, 1, 0, 49, 0, 0),
339
341
  ),
340
342
  )
341
- subject.notify(
343
+ perf_notifier.notify(
342
344
  Airbrake::Queue.new(
343
345
  queue: 'emails',
344
346
  error_count: 3,
@@ -347,7 +349,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
347
349
  time: Time.new(2018, 1, 1, 0, 49, 0, 0),
348
350
  ),
349
351
  )
350
- subject.close
352
+ perf_notifier.close
351
353
 
352
354
  expect(
353
355
  a_request(:put, queues).with(body: /
@@ -378,7 +380,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
378
380
  end
379
381
 
380
382
  it "returns a promise" do
381
- promise = subject.notify(
383
+ promise = perf_notifier.notify(
382
384
  Airbrake::Request.new(
383
385
  method: 'GET',
384
386
  route: '/foo',
@@ -386,7 +388,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
386
388
  timing: 123,
387
389
  ),
388
390
  )
389
- subject.close
391
+ perf_notifier.close
390
392
 
391
393
  expect(promise).to be_an(Airbrake::Promise)
392
394
  expect(promise.value).to eq('' => '')
@@ -396,16 +398,19 @@ RSpec.describe Airbrake::PerformanceNotifier do
396
398
  request = Airbrake::Request.new(
397
399
  method: 'GET', route: '/foo', status_code: 200, timing: 123,
398
400
  )
399
- expect(Airbrake::Config.instance).to receive(:check_performance_options)
400
- .with(request).and_return(Airbrake::Promise.new)
401
- subject.notify(request)
402
- subject.close
401
+ allow(Airbrake::Config.instance).to receive(:check_performance_options)
402
+ .and_return(Airbrake::Promise.new)
403
+ perf_notifier.notify(request)
404
+ perf_notifier.close
405
+
406
+ expect(Airbrake::Config.instance)
407
+ .to have_received(:check_performance_options).with(request)
403
408
  end
404
409
 
405
410
  it "sends environment when it's specified" do
406
411
  Airbrake::Config.instance.merge(performance_stats: true, environment: 'test')
407
412
 
408
- subject.notify(
413
+ perf_notifier.notify(
409
414
  Airbrake::Request.new(
410
415
  method: 'POST',
411
416
  route: '/foo',
@@ -413,7 +418,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
413
418
  timing: 123,
414
419
  ),
415
420
  )
416
- subject.close
421
+ perf_notifier.close
417
422
 
418
423
  expect(
419
424
  a_request(:put, routes).with(
@@ -426,7 +431,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
426
431
  before { Airbrake::Config.instance.merge(project_id: nil) }
427
432
 
428
433
  it "returns a rejected promise" do
429
- promise = subject.notify({})
434
+ promise = perf_notifier.notify({})
430
435
  expect(promise).to be_rejected
431
436
  end
432
437
  end
@@ -442,7 +447,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
442
447
  performance_stats_flush_period: flush_period,
443
448
  )
444
449
 
445
- subject.notify(
450
+ perf_notifier.notify(
446
451
  Airbrake::Request.new(
447
452
  method: 'GET',
448
453
  route: '/foo',
@@ -451,7 +456,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
451
456
  ),
452
457
  )
453
458
 
454
- subject.notify(
459
+ perf_notifier.notify(
455
460
  Airbrake::Query.new(
456
461
  method: 'POST',
457
462
  route: '/foo',
@@ -468,10 +473,10 @@ RSpec.describe Airbrake::PerformanceNotifier do
468
473
  end
469
474
 
470
475
  context "when an ignore filter was defined" do
471
- before { subject.add_filter(&:ignore!) }
476
+ before { perf_notifier.add_filter(&:ignore!) }
472
477
 
473
478
  it "doesn't notify airbrake of requests" do
474
- subject.notify(
479
+ perf_notifier.notify(
475
480
  Airbrake::Request.new(
476
481
  method: 'GET',
477
482
  route: '/foo',
@@ -479,13 +484,13 @@ RSpec.describe Airbrake::PerformanceNotifier do
479
484
  timing: 1,
480
485
  ),
481
486
  )
482
- subject.close
487
+ perf_notifier.close
483
488
 
484
489
  expect(a_request(:put, routes)).not_to have_been_made
485
490
  end
486
491
 
487
492
  it "doesn't notify airbrake of queries" do
488
- subject.notify(
493
+ perf_notifier.notify(
489
494
  Airbrake::Query.new(
490
495
  method: 'POST',
491
496
  route: '/foo',
@@ -493,13 +498,13 @@ RSpec.describe Airbrake::PerformanceNotifier do
493
498
  timing: 1,
494
499
  ),
495
500
  )
496
- subject.close
501
+ perf_notifier.close
497
502
 
498
503
  expect(a_request(:put, queries)).not_to have_been_made
499
504
  end
500
505
 
501
506
  it "returns a rejected promise" do
502
- promise = subject.notify(
507
+ promise = perf_notifier.notify(
503
508
  Airbrake::Query.new(
504
509
  method: 'POST',
505
510
  route: '/foo',
@@ -507,7 +512,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
507
512
  timing: 1,
508
513
  ),
509
514
  )
510
- subject.close
515
+ perf_notifier.close
511
516
 
512
517
  expect(promise.value).to eq(
513
518
  'error' => 'Airbrake::Query was ignored by a filter',
@@ -517,13 +522,13 @@ RSpec.describe Airbrake::PerformanceNotifier do
517
522
 
518
523
  context "when a filter that modifies payload was defined" do
519
524
  before do
520
- subject.add_filter do |resource|
521
- resource.route = '[Filtered]'
525
+ perf_notifier.add_filter do |metric|
526
+ metric.route = '[Filtered]'
522
527
  end
523
528
  end
524
529
 
525
530
  it "notifies airbrake with modified payload" do
526
- subject.notify(
531
+ perf_notifier.notify(
527
532
  Airbrake::Query.new(
528
533
  method: 'POST',
529
534
  route: '/foo',
@@ -531,7 +536,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
531
536
  timing: 123,
532
537
  ),
533
538
  )
534
- subject.close
539
+ perf_notifier.close
535
540
 
536
541
  expect(
537
542
  a_request(:put, queries).with(
@@ -541,44 +546,19 @@ RSpec.describe Airbrake::PerformanceNotifier do
541
546
  end
542
547
  end
543
548
 
544
- context "when :start_time is specified (deprecated)" do
545
- before do
546
- allow(Kernel).to receive(:warn)
547
- end
548
-
549
- it "uses the value of :start_time to update stat" do
550
- subject.notify(
551
- Airbrake::Query.new(
552
- method: 'POST',
553
- route: '/foo',
554
- query: 'SELECT * FROM things',
555
- start_time: Time.new(2018, 1, 1, 0, 49, 0, 0),
556
- end_time: Time.new(2018, 1, 1, 0, 50, 0, 0),
557
- ),
558
- )
559
- subject.close
560
-
561
- expect(
562
- a_request(:put, queries).with(
563
- body: /"count":1,"sum":60000.0,"sumsq":3600000000.0/,
564
- ),
565
- ).to have_been_made
566
- end
567
- end
568
-
569
549
  context "when provided :timing is zero" do
570
550
  it "doesn't notify" do
571
551
  queue = Airbrake::Queue.new(queue: 'bananas', error_count: 0, timing: 0)
572
- subject.notify(queue)
573
- subject.close
552
+ perf_notifier.notify(queue)
553
+ perf_notifier.close
574
554
 
575
555
  expect(a_request(:put, queues)).not_to have_been_made
576
556
  end
577
557
 
578
558
  it "returns a rejected promise" do
579
559
  queue = Airbrake::Queue.new(queue: 'bananas', error_count: 0, timing: 0)
580
- promise = subject.notify(queue)
581
- subject.close
560
+ promise = perf_notifier.notify(queue)
561
+ perf_notifier.close
582
562
 
583
563
  expect(promise.value).to eq('error' => ':timing cannot be zero')
584
564
  end
@@ -587,7 +567,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
587
567
 
588
568
  describe "#notify_sync" do
589
569
  it "notifies synchronously" do
590
- retval = subject.notify_sync(
570
+ retval = perf_notifier.notify_sync(
591
571
  Airbrake::Query.new(
592
572
  method: 'POST',
593
573
  route: '/foo',
@@ -616,7 +596,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
616
596
 
617
597
  it "kills the background thread" do
618
598
  expect_any_instance_of(Thread).to receive(:kill).and_call_original
619
- subject.notify(
599
+ perf_notifier.notify(
620
600
  Airbrake::Query.new(
621
601
  method: 'POST',
622
602
  route: '/foo',
@@ -624,30 +604,32 @@ RSpec.describe Airbrake::PerformanceNotifier do
624
604
  timing: 123,
625
605
  ),
626
606
  )
627
- subject.close
607
+ perf_notifier.close
628
608
  end
629
609
 
630
610
  it "logs the exit message" do
631
611
  allow(Airbrake::Loggable.instance).to receive(:debug)
632
- expect(Airbrake::Loggable.instance).to receive(:debug).with(
633
- /performance notifier closed/,
612
+
613
+ perf_notifier.close
614
+
615
+ expect(Airbrake::Loggable.instance).to have_received(:debug).with(
616
+ /Airbrake::PerformanceNotifier thread pool closed/,
634
617
  )
635
- subject.close
636
618
  end
637
619
  end
638
620
 
639
621
  describe "#delete_filter" do
640
622
  let(:filter) do
641
623
  Class.new do
642
- def call(resource); end
624
+ def call(metric); end
643
625
  end
644
626
  end
645
627
 
646
- before { subject.add_filter(filter.new) }
628
+ before { perf_notifier.add_filter(filter.new) }
647
629
 
648
630
  it "deletes a filter" do
649
- subject.delete_filter(filter)
650
- subject.notify(
631
+ perf_notifier.delete_filter(filter)
632
+ perf_notifier.notify(
651
633
  Airbrake::Request.new(
652
634
  method: 'POST',
653
635
  route: '/foo',
@@ -655,7 +637,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
655
637
  timing: 123,
656
638
  ),
657
639
  )
658
- subject.close
640
+ perf_notifier.close
659
641
 
660
642
  expect(a_request(:put, routes)).to have_been_made
661
643
  end