airbrake-ruby 4.10.1-java → 4.11.0-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.rb +23 -26
- data/lib/airbrake-ruby/benchmark.rb +1 -1
- data/lib/airbrake-ruby/notice_notifier.rb +2 -1
- data/lib/airbrake-ruby/performance_breakdown.rb +11 -6
- data/lib/airbrake-ruby/performance_notifier.rb +14 -1
- data/lib/airbrake-ruby/query.rb +12 -6
- data/lib/airbrake-ruby/queue.rb +12 -8
- data/lib/airbrake-ruby/request.rb +12 -8
- data/lib/airbrake-ruby/version.rb +1 -1
- data/spec/notice_notifier_spec.rb +2 -2
- data/spec/performance_notifier_spec.rb +62 -36
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2583597d5f9ccbfe09e3d861ebdc75ca8258e24fb829e265501f10b084ac0c32
|
4
|
+
data.tar.gz: 2117a15ce8ee4de598ad3da47562614087c76765573e76b66d300fbb85f0a8ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d519aacd0c4f2b16e31cf08a45c00db1290a8260e93f5eacc650b96dda8f42930876cd028e0ecc5cae94526d0caaaf0dcd453025b8b909a46e3b2d0f4995bbcf
|
7
|
+
data.tar.gz: cdf685b1acae7c8d94103561cf28597775638fb6d8e1a9635775fc3966d91006e46defdb0ac2ed4d917ad168b664ab2c9db1c2f3aab33fb87ec5ff8b929a906c
|
data/lib/airbrake-ruby.rb
CHANGED
@@ -328,9 +328,8 @@ module Airbrake
|
|
328
328
|
notice_notifier.merge_context(context)
|
329
329
|
end
|
330
330
|
|
331
|
-
# Increments request statistics of a certain +route+
|
332
|
-
#
|
333
|
-
# +status_code+.
|
331
|
+
# Increments request statistics of a certain +route+ invoked with +method+,
|
332
|
+
# which returned +status_code+.
|
334
333
|
#
|
335
334
|
# After a certain amount of time (n seconds) the aggregated route
|
336
335
|
# information will be sent to Airbrake.
|
@@ -343,8 +342,7 @@ module Airbrake
|
|
343
342
|
# func: 'do_stuff',
|
344
343
|
# file: 'app/models/foo.rb',
|
345
344
|
# line: 452,
|
346
|
-
#
|
347
|
-
# end_time: Time.now
|
345
|
+
# timing: 123.45 # ms
|
348
346
|
# )
|
349
347
|
#
|
350
348
|
# @param [Hash{Symbol=>Object}] request_info
|
@@ -358,8 +356,8 @@ module Airbrake
|
|
358
356
|
# called the query (optional)
|
359
357
|
# @option request_info [Integer] :line The line that executes the query
|
360
358
|
# (optional)
|
361
|
-
# @option request_info [
|
362
|
-
#
|
359
|
+
# @option request_info [Float] :timing How much time it took to process the
|
360
|
+
# request (in ms)
|
363
361
|
# @param [Hash] stash What needs to be appeneded to the stash, so it's
|
364
362
|
# available in filters
|
365
363
|
# @return [void]
|
@@ -371,9 +369,8 @@ module Airbrake
|
|
371
369
|
performance_notifier.notify(request)
|
372
370
|
end
|
373
371
|
|
374
|
-
# Synchronously
|
375
|
-
#
|
376
|
-
# returned +status_code+.
|
372
|
+
# Synchronously increments request statistics of a certain +route+ invoked
|
373
|
+
# with +method+, which returned +status_code+.
|
377
374
|
# @since v4.10.0
|
378
375
|
# @see .notify_request
|
379
376
|
def notify_request_sync(request_info, stash = {})
|
@@ -382,9 +379,8 @@ module Airbrake
|
|
382
379
|
performance_notifier.notify_sync(request)
|
383
380
|
end
|
384
381
|
|
385
|
-
# Increments SQL statistics of a certain +query
|
386
|
-
#
|
387
|
-
# provided, the query is grouped by these parameters.
|
382
|
+
# Increments SQL statistics of a certain +query+. When +method+ and +route+
|
383
|
+
# are provided, the query is grouped by these parameters.
|
388
384
|
#
|
389
385
|
# After a certain amount of time (n seconds) the aggregated query
|
390
386
|
# information will be sent to Airbrake.
|
@@ -394,18 +390,17 @@ module Airbrake
|
|
394
390
|
# method: 'GET',
|
395
391
|
# route: '/things',
|
396
392
|
# query: 'SELECT * FROM things',
|
397
|
-
#
|
398
|
-
# end_time: Time.now
|
393
|
+
# timing: 123.45 # ms
|
399
394
|
# )
|
400
395
|
#
|
401
396
|
# @param [Hash{Symbol=>Object}] query_info
|
402
|
-
# @option
|
397
|
+
# @option query_info [String] :method The HTTP method that triggered this
|
403
398
|
# SQL query (optional)
|
404
|
-
# @option
|
399
|
+
# @option query_info [String] :route The route that triggered this SQL
|
405
400
|
# query (optional)
|
406
|
-
# @option
|
407
|
-
# @option
|
408
|
-
#
|
401
|
+
# @option query_info [String] :query The query that was executed
|
402
|
+
# @option query_info [Float] :timing How much time it took to process the
|
403
|
+
# query (in ms)
|
409
404
|
# @param [Hash] stash What needs to be appeneded to the stash, so it's
|
410
405
|
# available in filters
|
411
406
|
# @return [void]
|
@@ -417,9 +412,9 @@ module Airbrake
|
|
417
412
|
performance_notifier.notify(query)
|
418
413
|
end
|
419
414
|
|
420
|
-
# Synchronously increments SQL statistics of a certain +query
|
421
|
-
#
|
422
|
-
#
|
415
|
+
# Synchronously increments SQL statistics of a certain +query+. When
|
416
|
+
# +method+ and +route+ are provided, the query is grouped by these
|
417
|
+
# parameters.
|
423
418
|
# @since v4.10.0
|
424
419
|
# @see .notify_query
|
425
420
|
def notify_query_sync(query_info, stash = {})
|
@@ -436,8 +431,7 @@ module Airbrake
|
|
436
431
|
# route: '/thing/:id/create',
|
437
432
|
# response_type: 'json',
|
438
433
|
# groups: { db: 24.0, view: 0.4 }, # ms
|
439
|
-
#
|
440
|
-
# end_time: Time.now
|
434
|
+
# timing: 123.45 # ms
|
441
435
|
# )
|
442
436
|
#
|
443
437
|
# @param [Hash{Symbol=>Object}] breakdown_info
|
@@ -445,7 +439,8 @@ module Airbrake
|
|
445
439
|
# @option breakdown_info [String] :route
|
446
440
|
# @option breakdown_info [String] :response_type
|
447
441
|
# @option breakdown_info [Array<Hash{Symbol=>Float}>] :groups
|
448
|
-
# @option breakdown_info [
|
442
|
+
# @option breakdown_info [Float] :timing How much time it took to process
|
443
|
+
# the performance breakdown (in ms)
|
449
444
|
# @param [Hash] stash What needs to be appeneded to the stash, so it's
|
450
445
|
# available in filters
|
451
446
|
# @return [void]
|
@@ -481,6 +476,8 @@ module Airbrake
|
|
481
476
|
# failed
|
482
477
|
# @option queue_info [Array<Hash{Symbol=>Float}>] :groups Where the job
|
483
478
|
# spent its time
|
479
|
+
# @option breakdown_info [Float] :timing How much time it took to process
|
480
|
+
# the queue (in ms)
|
484
481
|
# @param [Hash] stash What needs to be appended to the stash, so it's
|
485
482
|
# available in filters
|
486
483
|
# @return [void]
|
@@ -55,7 +55,8 @@ module Airbrake
|
|
55
55
|
def build_notice(exception, params = {})
|
56
56
|
if @async_sender.closed?
|
57
57
|
raise Airbrake::Error,
|
58
|
-
"
|
58
|
+
"Airbrake is closed; can't build exception: " \
|
59
|
+
"#{exception.class}: #{exception}"
|
59
60
|
end
|
60
61
|
|
61
62
|
if exception.is_a?(Airbrake::Notice)
|
@@ -7,7 +7,8 @@ module Airbrake
|
|
7
7
|
# @since v4.2.0
|
8
8
|
# rubocop:disable Metrics/BlockLength, Metrics/ParameterLists
|
9
9
|
PerformanceBreakdown = Struct.new(
|
10
|
-
:method, :route, :response_type, :groups, :start_time, :end_time
|
10
|
+
:method, :route, :response_type, :groups, :start_time, :end_time, :timing,
|
11
|
+
:time
|
11
12
|
) do
|
12
13
|
include HashKeyable
|
13
14
|
include Ignorable
|
@@ -19,11 +20,15 @@ module Airbrake
|
|
19
20
|
route:,
|
20
21
|
response_type:,
|
21
22
|
groups:,
|
22
|
-
start_time
|
23
|
-
end_time: start_time + 1
|
23
|
+
start_time: Time.now,
|
24
|
+
end_time: start_time + 1,
|
25
|
+
timing: nil,
|
26
|
+
time: Time.now
|
24
27
|
)
|
25
|
-
@
|
26
|
-
super(
|
28
|
+
@time_utc = TimeTruncate.utc_truncate_minutes(time)
|
29
|
+
super(
|
30
|
+
method, route, response_type, groups, start_time, end_time, timing, time
|
31
|
+
)
|
27
32
|
end
|
28
33
|
|
29
34
|
def destination
|
@@ -39,7 +44,7 @@ module Airbrake
|
|
39
44
|
'method' => method,
|
40
45
|
'route' => route,
|
41
46
|
'responseType' => response_type,
|
42
|
-
'time' => @
|
47
|
+
'time' => @time_utc,
|
43
48
|
}.delete_if { |_key, val| val.nil? }
|
44
49
|
end
|
45
50
|
end
|
@@ -62,7 +62,7 @@ module Airbrake
|
|
62
62
|
@payload[resource] = { total: Airbrake::Stat.new }
|
63
63
|
end
|
64
64
|
|
65
|
-
@payload[resource][:total]
|
65
|
+
update_total(resource, @payload[resource][:total])
|
66
66
|
|
67
67
|
resource.groups.each do |name, ms|
|
68
68
|
@payload[resource][name] ||= Airbrake::Stat.new
|
@@ -70,6 +70,19 @@ module Airbrake
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
+
def update_total(resource, total)
|
74
|
+
if resource.timing
|
75
|
+
total.increment_ms(resource.timing)
|
76
|
+
else
|
77
|
+
loc = caller_locations(6..6).first
|
78
|
+
Kernel.warn(
|
79
|
+
"#{loc.path}:#{loc.lineno}: warning: :start_time and :end_time are " \
|
80
|
+
"deprecated. Use :timing & :time instead",
|
81
|
+
)
|
82
|
+
total.increment(resource.start_time, resource.end_time)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
73
86
|
def schedule_flush
|
74
87
|
return if @payload.empty?
|
75
88
|
|
data/lib/airbrake-ruby/query.rb
CHANGED
@@ -6,7 +6,8 @@ module Airbrake
|
|
6
6
|
# @since v3.2.0
|
7
7
|
# rubocop:disable Metrics/ParameterLists, Metrics/BlockLength
|
8
8
|
Query = Struct.new(
|
9
|
-
:method, :route, :query, :func, :file, :line, :start_time, :end_time
|
9
|
+
:method, :route, :query, :func, :file, :line, :start_time, :end_time,
|
10
|
+
:timing, :time
|
10
11
|
) do
|
11
12
|
include HashKeyable
|
12
13
|
include Ignorable
|
@@ -21,11 +22,16 @@ module Airbrake
|
|
21
22
|
func: nil,
|
22
23
|
file: nil,
|
23
24
|
line: nil,
|
24
|
-
start_time
|
25
|
-
end_time: start_time + 1
|
25
|
+
start_time: Time.now,
|
26
|
+
end_time: start_time + 1,
|
27
|
+
timing: nil,
|
28
|
+
time: Time.now
|
26
29
|
)
|
27
|
-
@
|
28
|
-
super(
|
30
|
+
@time_utc = TimeTruncate.utc_truncate_minutes(time)
|
31
|
+
super(
|
32
|
+
method, route, query, func, file, line, start_time, end_time, timing,
|
33
|
+
time
|
34
|
+
)
|
29
35
|
end
|
30
36
|
|
31
37
|
def destination
|
@@ -41,7 +47,7 @@ module Airbrake
|
|
41
47
|
'method' => method,
|
42
48
|
'route' => route,
|
43
49
|
'query' => query,
|
44
|
-
'time' => @
|
50
|
+
'time' => @time_utc,
|
45
51
|
'function' => func,
|
46
52
|
'file' => file,
|
47
53
|
'line' => line,
|
data/lib/airbrake-ruby/queue.rb
CHANGED
@@ -4,8 +4,10 @@ module Airbrake
|
|
4
4
|
# @see Airbrake.notify_queue
|
5
5
|
# @api public
|
6
6
|
# @since v4.9.0
|
7
|
-
# rubocop:disable Metrics/BlockLength
|
8
|
-
Queue = Struct.new(
|
7
|
+
# rubocop:disable Metrics/BlockLength, Metrics/ParameterLists
|
8
|
+
Queue = Struct.new(
|
9
|
+
:queue, :error_count, :groups, :start_time, :end_time, :timing, :time
|
10
|
+
) do
|
9
11
|
include HashKeyable
|
10
12
|
include Ignorable
|
11
13
|
include Stashable
|
@@ -15,10 +17,12 @@ module Airbrake
|
|
15
17
|
error_count:,
|
16
18
|
groups: {},
|
17
19
|
start_time: Time.now,
|
18
|
-
end_time: start_time + 1
|
20
|
+
end_time: start_time + 1,
|
21
|
+
timing: nil,
|
22
|
+
time: Time.now
|
19
23
|
)
|
20
|
-
@
|
21
|
-
super(queue, error_count, groups, start_time, end_time)
|
24
|
+
@time_utc = TimeTruncate.utc_truncate_minutes(time)
|
25
|
+
super(queue, error_count, groups, start_time, end_time, timing, time)
|
22
26
|
end
|
23
27
|
|
24
28
|
def destination
|
@@ -33,14 +37,14 @@ module Airbrake
|
|
33
37
|
{
|
34
38
|
'queue' => queue,
|
35
39
|
'errorCount' => error_count,
|
36
|
-
'time' => @
|
40
|
+
'time' => @time_utc,
|
37
41
|
}
|
38
42
|
end
|
39
43
|
|
40
44
|
def hash
|
41
45
|
{
|
42
46
|
'queue' => queue,
|
43
|
-
'time' => @
|
47
|
+
'time' => @time_utc,
|
44
48
|
}.hash
|
45
49
|
end
|
46
50
|
|
@@ -48,5 +52,5 @@ module Airbrake
|
|
48
52
|
self.error_count += other.error_count
|
49
53
|
end
|
50
54
|
end
|
51
|
-
# rubocop:enable Metrics/BlockLength
|
55
|
+
# rubocop:enable Metrics/BlockLength, Metrics/ParameterLists
|
52
56
|
end
|
@@ -4,8 +4,10 @@ module Airbrake
|
|
4
4
|
# @see Airbrake.notify_request
|
5
5
|
# @api public
|
6
6
|
# @since v3.2.0
|
7
|
-
# rubocop:disable Metrics/BlockLength
|
8
|
-
Request = Struct.new(
|
7
|
+
# rubocop:disable Metrics/BlockLength, Metrics/ParameterLists
|
8
|
+
Request = Struct.new(
|
9
|
+
:method, :route, :status_code, :start_time, :end_time, :timing, :time
|
10
|
+
) do
|
9
11
|
include HashKeyable
|
10
12
|
include Ignorable
|
11
13
|
include Stashable
|
@@ -16,11 +18,13 @@ module Airbrake
|
|
16
18
|
method:,
|
17
19
|
route:,
|
18
20
|
status_code:,
|
19
|
-
start_time
|
20
|
-
end_time: start_time + 1
|
21
|
+
start_time: Time.now,
|
22
|
+
end_time: start_time + 1,
|
23
|
+
timing: nil,
|
24
|
+
time: Time.now
|
21
25
|
)
|
22
|
-
@
|
23
|
-
super(method, route, status_code, start_time, end_time)
|
26
|
+
@time_utc = TimeTruncate.utc_truncate_minutes(time)
|
27
|
+
super(method, route, status_code, start_time, end_time, timing, time)
|
24
28
|
end
|
25
29
|
|
26
30
|
def destination
|
@@ -36,9 +40,9 @@ module Airbrake
|
|
36
40
|
'method' => method,
|
37
41
|
'route' => route,
|
38
42
|
'statusCode' => status_code,
|
39
|
-
'time' => @
|
43
|
+
'time' => @time_utc,
|
40
44
|
}.delete_if { |_key, val| val.nil? }
|
41
45
|
end
|
42
46
|
end
|
43
|
-
# rubocop:enable Metrics/BlockLength
|
47
|
+
# rubocop:enable Metrics/BlockLength, Metrics/ParameterLists
|
44
48
|
end
|
@@ -328,9 +328,9 @@ RSpec.describe Airbrake::NoticeNotifier do
|
|
328
328
|
end
|
329
329
|
|
330
330
|
it "raises error" do
|
331
|
-
expect { subject.build_notice(Exception.new) }.to raise_error(
|
331
|
+
expect { subject.build_notice(Exception.new('oops')) }.to raise_error(
|
332
332
|
Airbrake::Error,
|
333
|
-
|
333
|
+
"Airbrake is closed; can't build exception: Exception: oops",
|
334
334
|
)
|
335
335
|
end
|
336
336
|
end
|
@@ -29,8 +29,8 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
29
29
|
func: 'foo',
|
30
30
|
file: 'foo.rb',
|
31
31
|
line: 123,
|
32
|
-
|
33
|
-
|
32
|
+
timing: 60000,
|
33
|
+
time: Time.new(2018, 1, 1, 0, 49, 0, 0),
|
34
34
|
),
|
35
35
|
)
|
36
36
|
subject.close
|
@@ -59,8 +59,8 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
59
59
|
method: 'POST',
|
60
60
|
route: '/foo',
|
61
61
|
status_code: 200,
|
62
|
-
|
63
|
-
|
62
|
+
timing: 60000,
|
63
|
+
time: Time.new(2018, 1, 1, 0, 49, 0, 0),
|
64
64
|
),
|
65
65
|
)
|
66
66
|
subject.close
|
@@ -86,8 +86,8 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
86
86
|
method: 'DELETE',
|
87
87
|
route: '/routes-breakdowns',
|
88
88
|
response_type: 'json',
|
89
|
-
|
90
|
-
|
89
|
+
timing: 60000,
|
90
|
+
time: Time.new(2018, 1, 1, 0, 49, 0, 0),
|
91
91
|
groups: { db: 131, view: 421 },
|
92
92
|
),
|
93
93
|
)
|
@@ -128,8 +128,8 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
128
128
|
queue: 'emails',
|
129
129
|
error_count: 2,
|
130
130
|
groups: { redis: 131, sql: 421 },
|
131
|
-
|
132
|
-
|
131
|
+
timing: 60000,
|
132
|
+
time: Time.new(2018, 1, 1, 0, 49, 0, 0),
|
133
133
|
),
|
134
134
|
)
|
135
135
|
subject.close
|
@@ -168,7 +168,8 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
168
168
|
method: 'GET',
|
169
169
|
route: '/foo',
|
170
170
|
status_code: 200,
|
171
|
-
|
171
|
+
timing: 60000,
|
172
|
+
time: Time.new(2018, 1, 1, 0, 0, 20, 0),
|
172
173
|
),
|
173
174
|
)
|
174
175
|
subject.close
|
@@ -184,7 +185,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
184
185
|
method: 'GET',
|
185
186
|
route: '/foo',
|
186
187
|
status_code: 200,
|
187
|
-
|
188
|
+
timing: 213,
|
188
189
|
),
|
189
190
|
)
|
190
191
|
subject.notify(
|
@@ -192,7 +193,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
192
193
|
method: 'GET',
|
193
194
|
route: '/foo',
|
194
195
|
status_code: 200,
|
195
|
-
|
196
|
+
timing: 123,
|
196
197
|
),
|
197
198
|
)
|
198
199
|
subject.close
|
@@ -208,8 +209,8 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
208
209
|
method: 'GET',
|
209
210
|
route: '/foo',
|
210
211
|
status_code: 200,
|
211
|
-
|
212
|
-
|
212
|
+
timing: 1000,
|
213
|
+
time: Time.new(2018, 1, 1, 0, 0, 49, 0),
|
213
214
|
),
|
214
215
|
)
|
215
216
|
subject.notify(
|
@@ -217,8 +218,8 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
217
218
|
method: 'GET',
|
218
219
|
route: '/foo',
|
219
220
|
status_code: 200,
|
220
|
-
|
221
|
-
|
221
|
+
timing: 6000,
|
222
|
+
time: Time.new(2018, 1, 1, 0, 1, 49, 0),
|
222
223
|
),
|
223
224
|
)
|
224
225
|
subject.close
|
@@ -244,8 +245,8 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
244
245
|
method: 'GET',
|
245
246
|
route: '/foo',
|
246
247
|
status_code: 200,
|
247
|
-
|
248
|
-
|
248
|
+
timing: 60000,
|
249
|
+
time: Time.new(2018, 1, 1, 0, 49, 0, 0),
|
249
250
|
),
|
250
251
|
)
|
251
252
|
subject.notify(
|
@@ -253,8 +254,8 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
253
254
|
method: 'POST',
|
254
255
|
route: '/foo',
|
255
256
|
status_code: 200,
|
256
|
-
|
257
|
-
|
257
|
+
timing: 60000,
|
258
|
+
time: Time.new(2018, 1, 1, 0, 49, 0, 0),
|
258
259
|
),
|
259
260
|
)
|
260
261
|
subject.close
|
@@ -280,8 +281,8 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
280
281
|
method: 'DELETE',
|
281
282
|
route: '/routes-breakdowns',
|
282
283
|
response_type: 'json',
|
283
|
-
|
284
|
-
|
284
|
+
timing: 2000,
|
285
|
+
time: Time.new(2018, 1, 1, 0, 0, 20, 0),
|
285
286
|
groups: { db: 131, view: 421 },
|
286
287
|
),
|
287
288
|
)
|
@@ -290,8 +291,8 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
290
291
|
method: 'DELETE',
|
291
292
|
route: '/routes-breakdowns',
|
292
293
|
response_type: 'json',
|
293
|
-
|
294
|
-
|
294
|
+
timing: 2000,
|
295
|
+
time: Time.new(2018, 1, 1, 0, 0, 30, 0),
|
295
296
|
groups: { db: 55, view: 11 },
|
296
297
|
),
|
297
298
|
)
|
@@ -332,8 +333,8 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
332
333
|
queue: 'emails',
|
333
334
|
error_count: 2,
|
334
335
|
groups: { redis: 131, sql: 421 },
|
335
|
-
|
336
|
-
|
336
|
+
timing: 60000,
|
337
|
+
time: Time.new(2018, 1, 1, 0, 49, 0, 0),
|
337
338
|
),
|
338
339
|
)
|
339
340
|
subject.notify(
|
@@ -341,8 +342,8 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
341
342
|
queue: 'emails',
|
342
343
|
error_count: 3,
|
343
344
|
groups: { redis: 131, sql: 421 },
|
344
|
-
|
345
|
-
|
345
|
+
timing: 60000,
|
346
|
+
time: Time.new(2018, 1, 1, 0, 49, 0, 0),
|
346
347
|
),
|
347
348
|
)
|
348
349
|
subject.close
|
@@ -381,7 +382,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
381
382
|
method: 'GET',
|
382
383
|
route: '/foo',
|
383
384
|
status_code: 200,
|
384
|
-
|
385
|
+
timing: 123,
|
385
386
|
),
|
386
387
|
)
|
387
388
|
subject.close
|
@@ -392,7 +393,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
392
393
|
|
393
394
|
it "checks performance stat configuration" do
|
394
395
|
request = Airbrake::Request.new(
|
395
|
-
method: 'GET', route: '/foo', status_code: 200,
|
396
|
+
method: 'GET', route: '/foo', status_code: 200, timing: 123,
|
396
397
|
)
|
397
398
|
expect(Airbrake::Config.instance).to receive(:check_performance_options)
|
398
399
|
.with(request).and_return(Airbrake::Promise.new)
|
@@ -408,7 +409,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
408
409
|
method: 'POST',
|
409
410
|
route: '/foo',
|
410
411
|
status_code: 200,
|
411
|
-
|
412
|
+
timing: 123,
|
412
413
|
),
|
413
414
|
)
|
414
415
|
subject.close
|
@@ -445,7 +446,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
445
446
|
method: 'GET',
|
446
447
|
route: '/foo',
|
447
448
|
status_code: 200,
|
448
|
-
|
449
|
+
timing: 123,
|
449
450
|
),
|
450
451
|
)
|
451
452
|
|
@@ -454,7 +455,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
454
455
|
method: 'POST',
|
455
456
|
route: '/foo',
|
456
457
|
query: 'SELECT * FROM things',
|
457
|
-
|
458
|
+
timing: 123,
|
458
459
|
),
|
459
460
|
)
|
460
461
|
|
@@ -510,7 +511,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
510
511
|
method: 'POST',
|
511
512
|
route: '/foo',
|
512
513
|
query: 'SELECT * FROM things',
|
513
|
-
|
514
|
+
timing: 123,
|
514
515
|
),
|
515
516
|
)
|
516
517
|
subject.close
|
@@ -522,6 +523,31 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
522
523
|
).to have_been_made
|
523
524
|
end
|
524
525
|
end
|
526
|
+
|
527
|
+
context "when :start_time is specified (deprecated)" do
|
528
|
+
before do
|
529
|
+
allow(Kernel).to receive(:warn)
|
530
|
+
end
|
531
|
+
|
532
|
+
it "uses the value of :start_time to update stat" do
|
533
|
+
subject.notify(
|
534
|
+
Airbrake::Query.new(
|
535
|
+
method: 'POST',
|
536
|
+
route: '/foo',
|
537
|
+
query: 'SELECT * FROM things',
|
538
|
+
start_time: Time.new(2018, 1, 1, 0, 49, 0, 0),
|
539
|
+
end_time: Time.new(2018, 1, 1, 0, 50, 0, 0),
|
540
|
+
),
|
541
|
+
)
|
542
|
+
subject.close
|
543
|
+
|
544
|
+
expect(
|
545
|
+
a_request(:put, queries).with(
|
546
|
+
body: /"count":1,"sum":60000.0,"sumsq":3600000000.0/,
|
547
|
+
),
|
548
|
+
).to have_been_made
|
549
|
+
end
|
550
|
+
end
|
525
551
|
end
|
526
552
|
|
527
553
|
describe "#notify_sync" do
|
@@ -531,7 +557,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
531
557
|
method: 'POST',
|
532
558
|
route: '/foo',
|
533
559
|
query: 'SELECT * FROM things',
|
534
|
-
|
560
|
+
timing: 123,
|
535
561
|
),
|
536
562
|
)
|
537
563
|
|
@@ -560,7 +586,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
560
586
|
method: 'POST',
|
561
587
|
route: '/foo',
|
562
588
|
query: 'SELECT * FROM things',
|
563
|
-
|
589
|
+
timing: 123,
|
564
590
|
),
|
565
591
|
)
|
566
592
|
subject.close
|
@@ -591,7 +617,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
|
|
591
617
|
method: 'POST',
|
592
618
|
route: '/foo',
|
593
619
|
status_code: 200,
|
594
|
-
|
620
|
+
timing: 123,
|
595
621
|
),
|
596
622
|
)
|
597
623
|
subject.close
|
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.
|
4
|
+
version: 4.11.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-
|
11
|
+
date: 2019-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbtree-jruby
|