airbrake-ruby 4.12.0-java → 4.13.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45c3ebd1f38646e8f8d50a6e0956ef75778130cf9b5dc7c54b36e302f4769391
4
- data.tar.gz: 34e30b5ce530edc18c512ba0be5392a2c53cdee68ec23eb43174e9690715f821
3
+ metadata.gz: e63f9645cf849006496087d1fefe38eb42ad4c448ff289aa4f84d5a95244d816
4
+ data.tar.gz: fd3eeb0af67ed2e24496268829513c650e2fd2270514febd0a512c07d12119d2
5
5
  SHA512:
6
- metadata.gz: 1a84c05b12db0d025f1e8a0311340ef41f954ac31f2d4e96cc69c576554beffa34ca17d8b01ce33760caf211b854b15869adc9d9bd701f8f5739acbdbcdafb1c
7
- data.tar.gz: c9c58c197046e16f7706cddbfb4caab70837f03b457418ff22f756499efe6bd98762eca8547a9e716af9d04e20c53a4440a9ca83affc7c1713623d3a191cb560
6
+ metadata.gz: e7464407b11639d0bef4af861e98b506ffb04454ec0910ac9fc86276b471fbf4b6e141d636569c84f69dc2c0dce85c89452c424775b4aed9b54dfb47cd0640df
7
+ data.tar.gz: 4f3fd32bd982ba1a71906ff4ba44d53bd5be061b94426786e5f975725757e365c9a22f5aa7ce08636ef1847662941ded3c052b9c5708ba113fc251d952e99a49
@@ -84,6 +84,13 @@ module Airbrake
84
84
  # special cases where we need to work around older implementations
85
85
  JRUBY = (RUBY_ENGINE == 'jruby')
86
86
 
87
+ # @return [Boolean] true if this Ruby supports safe levels and tainting,
88
+ # to guard against using deprecated or unsupported features.
89
+ HAS_SAFE_LEVEL = (
90
+ RUBY_ENGINE == 'ruby' &&
91
+ Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7')
92
+ )
93
+
87
94
  class << self
88
95
  # @since v4.2.3
89
96
  # @api private
@@ -364,7 +371,7 @@ module Airbrake
364
371
  # @since v3.0.0
365
372
  # @see Airbrake::PerformanceNotifier#notify
366
373
  def notify_request(request_info, stash = {})
367
- request = Request.new(request_info)
374
+ request = Request.new(**request_info)
368
375
  request.stash.merge!(stash)
369
376
  performance_notifier.notify(request)
370
377
  end
@@ -374,7 +381,7 @@ module Airbrake
374
381
  # @since v4.10.0
375
382
  # @see .notify_request
376
383
  def notify_request_sync(request_info, stash = {})
377
- request = Request.new(request_info)
384
+ request = Request.new(**request_info)
378
385
  request.stash.merge!(stash)
379
386
  performance_notifier.notify_sync(request)
380
387
  end
@@ -407,7 +414,7 @@ module Airbrake
407
414
  # @since v3.2.0
408
415
  # @see Airbrake::PerformanceNotifier#notify
409
416
  def notify_query(query_info, stash = {})
410
- query = Query.new(query_info)
417
+ query = Query.new(**query_info)
411
418
  query.stash.merge!(stash)
412
419
  performance_notifier.notify(query)
413
420
  end
@@ -418,7 +425,7 @@ module Airbrake
418
425
  # @since v4.10.0
419
426
  # @see .notify_query
420
427
  def notify_query_sync(query_info, stash = {})
421
- query = Query.new(query_info)
428
+ query = Query.new(**query_info)
422
429
  query.stash.merge!(stash)
423
430
  performance_notifier.notify_sync(query)
424
431
  end
@@ -446,7 +453,7 @@ module Airbrake
446
453
  # @return [void]
447
454
  # @since v4.2.0
448
455
  def notify_performance_breakdown(breakdown_info, stash = {})
449
- performance_breakdown = PerformanceBreakdown.new(breakdown_info)
456
+ performance_breakdown = PerformanceBreakdown.new(**breakdown_info)
450
457
  performance_breakdown.stash.merge!(stash)
451
458
  performance_notifier.notify(performance_breakdown)
452
459
  end
@@ -456,7 +463,7 @@ module Airbrake
456
463
  # @since v4.10.0
457
464
  # @see .notify_performance_breakdown
458
465
  def notify_performance_breakdown_sync(breakdown_info, stash = {})
459
- performance_breakdown = PerformanceBreakdown.new(breakdown_info)
466
+ performance_breakdown = PerformanceBreakdown.new(**breakdown_info)
460
467
  performance_breakdown.stash.merge!(stash)
461
468
  performance_notifier.notify_sync(performance_breakdown)
462
469
  end
@@ -484,7 +491,7 @@ module Airbrake
484
491
  # @since v4.9.0
485
492
  # @see .notify_queue_sync
486
493
  def notify_queue(queue_info, stash = {})
487
- queue = Queue.new(queue_info)
494
+ queue = Queue.new(**queue_info)
488
495
  queue.stash.merge!(stash)
489
496
  performance_notifier.notify(queue)
490
497
  end
@@ -493,7 +500,7 @@ module Airbrake
493
500
  # @since v4.10.0
494
501
  # @see .notify_queue
495
502
  def notify_queue_sync(queue_info, stash = {})
496
- queue = Queue.new(queue_info)
503
+ queue = Queue.new(**queue_info)
497
504
  queue.stash.merge!(stash)
498
505
  performance_notifier.notify_sync(queue)
499
506
  end
@@ -72,7 +72,7 @@ module Airbrake
72
72
  thread_info[:group] = th.group.list.map(&:inspect)
73
73
  thread_info[:priority] = th.priority
74
74
 
75
- thread_info[:safe_level] = th.safe_level unless Airbrake::JRUBY
75
+ thread_info[:safe_level] = th.safe_level if Airbrake::HAS_SAFE_LEVEL
76
76
  end
77
77
 
78
78
  def sanitize_value(value)
@@ -5,16 +5,16 @@ module Airbrake
5
5
  # @see Airbrake.notify_breakdown
6
6
  # @api public
7
7
  # @since v4.2.0
8
- # rubocop:disable Metrics/BlockLength, Metrics/ParameterLists
9
- PerformanceBreakdown = Struct.new(
10
- :method, :route, :response_type, :groups, :start_time, :end_time, :timing,
11
- :time
12
- ) do
8
+ # rubocop:disable Metrics/ParameterLists
9
+ class PerformanceBreakdown
13
10
  include HashKeyable
14
11
  include Ignorable
15
12
  include Stashable
16
13
  include Mergeable
17
14
 
15
+ attr_accessor :method, :route, :response_type, :groups, :start_time,
16
+ :end_time, :timing, :time
17
+
18
18
  def initialize(
19
19
  method:,
20
20
  route:,
@@ -26,9 +26,14 @@ module Airbrake
26
26
  time: Time.now
27
27
  )
28
28
  @time_utc = TimeTruncate.utc_truncate_minutes(time)
29
- super(
30
- method, route, response_type, groups, start_time, end_time, timing, time
31
- )
29
+ @method = method
30
+ @route = route
31
+ @response_type = response_type
32
+ @groups = groups
33
+ @start_time = start_time
34
+ @end_time = end_time
35
+ @timing = timing
36
+ @time = time
32
37
  end
33
38
 
34
39
  def destination
@@ -48,5 +53,5 @@ module Airbrake
48
53
  }.delete_if { |_key, val| val.nil? }
49
54
  end
50
55
  end
51
- # rubocop:enable Metrics/BlockLength, Metrics/ParameterLists
56
+ # rubocop:enable Metrics/ParameterLists
52
57
  end
@@ -4,17 +4,17 @@ module Airbrake
4
4
  # @see Airbrake.notify_query
5
5
  # @api public
6
6
  # @since v3.2.0
7
- # rubocop:disable Metrics/ParameterLists, Metrics/BlockLength
8
- Query = Struct.new(
9
- :method, :route, :query, :func, :file, :line, :start_time, :end_time,
10
- :timing, :time
11
- ) do
7
+ # rubocop:disable Metrics/ParameterLists
8
+ class Query
12
9
  include HashKeyable
13
10
  include Ignorable
14
11
  include Stashable
15
12
  include Mergeable
16
13
  include Grouppable
17
14
 
15
+ attr_accessor :method, :route, :query, :func, :file, :line, :start_time,
16
+ :end_time, :timing, :time
17
+
18
18
  def initialize(
19
19
  method:,
20
20
  route:,
@@ -28,10 +28,16 @@ module Airbrake
28
28
  time: Time.now
29
29
  )
30
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
- )
31
+ @method = method
32
+ @route = route
33
+ @query = query
34
+ @func = func
35
+ @file = file
36
+ @line = line
37
+ @start_time = start_time
38
+ @end_time = end_time
39
+ @timing = timing
40
+ @time = time
35
41
  end
36
42
 
37
43
  def destination
@@ -53,6 +59,6 @@ module Airbrake
53
59
  'line' => line,
54
60
  }.delete_if { |_key, val| val.nil? }
55
61
  end
56
- # rubocop:enable Metrics/ParameterLists, Metrics/BlockLength
62
+ # rubocop:enable Metrics/ParameterLists
57
63
  end
58
64
  end
@@ -4,14 +4,15 @@ module Airbrake
4
4
  # @see Airbrake.notify_queue
5
5
  # @api public
6
6
  # @since v4.9.0
7
- # rubocop:disable Metrics/BlockLength, Metrics/ParameterLists
8
- Queue = Struct.new(
9
- :queue, :error_count, :groups, :start_time, :end_time, :timing, :time
10
- ) do
7
+ # rubocop:disable Metrics/ParameterLists
8
+ class Queue
11
9
  include HashKeyable
12
10
  include Ignorable
13
11
  include Stashable
14
12
 
13
+ attr_accessor :queue, :error_count, :groups, :start_time, :end_time,
14
+ :timing, :time
15
+
15
16
  def initialize(
16
17
  queue:,
17
18
  error_count:,
@@ -22,7 +23,13 @@ module Airbrake
22
23
  time: Time.now
23
24
  )
24
25
  @time_utc = TimeTruncate.utc_truncate_minutes(time)
25
- super(queue, error_count, groups, start_time, end_time, timing, time)
26
+ @queue = queue
27
+ @error_count = error_count
28
+ @groups = groups
29
+ @start_time = start_time
30
+ @end_time = end_time
31
+ @timing = timing
32
+ @time = time
26
33
  end
27
34
 
28
35
  def destination
@@ -51,6 +58,15 @@ module Airbrake
51
58
  def merge(other)
52
59
  self.error_count += other.error_count
53
60
  end
61
+
62
+ # Queues don't have routes, but we want to define this to make sure our
63
+ # filter API is consistent (other models define this property)
64
+ #
65
+ # @return [String] empty route
66
+ # @see https://github.com/airbrake/airbrake-ruby/pull/537
67
+ def route
68
+ ''
69
+ end
54
70
  end
55
- # rubocop:enable Metrics/BlockLength, Metrics/ParameterLists
71
+ # rubocop:enable Metrics/ParameterLists
56
72
  end
@@ -4,16 +4,17 @@ module Airbrake
4
4
  # @see Airbrake.notify_request
5
5
  # @api public
6
6
  # @since v3.2.0
7
- # rubocop:disable Metrics/BlockLength, Metrics/ParameterLists
8
- Request = Struct.new(
9
- :method, :route, :status_code, :start_time, :end_time, :timing, :time
10
- ) do
7
+ # rubocop:disable Metrics/ParameterLists
8
+ class Request
11
9
  include HashKeyable
12
10
  include Ignorable
13
11
  include Stashable
14
12
  include Mergeable
15
13
  include Grouppable
16
14
 
15
+ attr_accessor :method, :route, :status_code, :start_time, :end_time,
16
+ :timing, :time
17
+
17
18
  def initialize(
18
19
  method:,
19
20
  route:,
@@ -24,7 +25,13 @@ module Airbrake
24
25
  time: Time.now
25
26
  )
26
27
  @time_utc = TimeTruncate.utc_truncate_minutes(time)
27
- super(method, route, status_code, start_time, end_time, timing, time)
28
+ @method = method
29
+ @route = route
30
+ @status_code = status_code
31
+ @start_time = start_time
32
+ @end_time = end_time
33
+ @timing = timing
34
+ @time = time
28
35
  end
29
36
 
30
37
  def destination
@@ -44,5 +51,5 @@ module Airbrake
44
51
  }.delete_if { |_key, val| val.nil? }
45
52
  end
46
53
  end
47
- # rubocop:enable Metrics/BlockLength, Metrics/ParameterLists
54
+ # rubocop:enable Metrics/ParameterLists
48
55
  end
@@ -1,6 +1,5 @@
1
1
  require 'base64'
2
2
 
3
- # rubocop:disable Metrics/BlockLength
4
3
  module Airbrake
5
4
  # Stat is a data structure that allows accumulating performance data (route
6
5
  # performance, SQL query performance and such). It's powered by TDigests.
@@ -14,14 +13,19 @@ module Airbrake
14
13
  # stat.to_h # Pack and serialize data so it can be transmitted.
15
14
  #
16
15
  # @since v3.2.0
17
- Stat = Struct.new(:count, :sum, :sumsq, :tdigest) do
16
+ class Stat
17
+ attr_accessor :count, :sum, :sumsq, :tdigest
18
+
18
19
  # @param [Integer] count How many times this stat was incremented
19
20
  # @param [Float] sum The sum of duration in milliseconds
20
21
  # @param [Float] sumsq The squared sum of duration in milliseconds
21
22
  # @param [TDigest::TDigest] tdigest Packed durations. By default,
22
23
  # compression is 20
23
24
  def initialize(count: 0, sum: 0.0, sumsq: 0.0, tdigest: TDigest.new(0.05))
24
- super(count, sum, sumsq, tdigest)
25
+ @count = count
26
+ @sum = sum
27
+ @sumsq = sumsq
28
+ @tdigest = tdigest
25
29
  end
26
30
 
27
31
  # @return [Hash{String=>Object}] stats as a hash with compressed TDigest
@@ -67,7 +71,6 @@ module Airbrake
67
71
  def inspect
68
72
  "#<struct Airbrake::Stat count=#{count}, sum=#{sum}, sumsq=#{sumsq}>"
69
73
  end
70
- alias_method :pretty_print, :inspect
74
+ alias pretty_print inspect
71
75
  end
72
76
  end
73
- # rubocop:enable Metrics/BlockLength
@@ -108,8 +108,8 @@ module Airbrake
108
108
  return str if utf8_string && str.valid_encoding?
109
109
 
110
110
  temp_str = str.dup
111
- temp_str.encode!(TEMP_ENCODING, ENCODING_OPTIONS) if utf8_string
112
- temp_str.encode!('utf-8', ENCODING_OPTIONS)
111
+ temp_str.encode!(TEMP_ENCODING, **ENCODING_OPTIONS) if utf8_string
112
+ temp_str.encode!('utf-8', **ENCODING_OPTIONS)
113
113
  end
114
114
  end
115
115
  end
@@ -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.12.0'.freeze
5
+ AIRBRAKE_RUBY_VERSION = '4.13.0'.freeze
6
6
  end
@@ -258,7 +258,9 @@ RSpec.describe Airbrake::Filters::ThreadFilter do
258
258
  expect(notice[:params][:thread][:priority]).to eq(0)
259
259
  end
260
260
 
261
- it "appends safe_level", skip: Airbrake::JRUBY do
261
+ it "appends safe_level", skip: (
262
+ "Not supported on this version of Ruby." unless Airbrake::HAS_SAFE_LEVEL
263
+ ) do
262
264
  subject.call(notice)
263
265
  expect(notice[:params][:thread][:safe_level]).to eq(0)
264
266
  end
@@ -18,4 +18,13 @@ RSpec.describe Airbrake::Queue do
18
18
  expect(queue.end_time).to eq(time + 1)
19
19
  end
20
20
  end
21
+
22
+ describe "#route" do
23
+ it "always returns an empty route" do
24
+ queue = described_class.new(
25
+ queue: 'a', error_count: 0, start_time: Time.now,
26
+ )
27
+ expect(queue.route).to be_empty
28
+ end
29
+ end
21
30
  end
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.12.0
4
+ version: 4.13.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: 2020-01-07 00:00:00.000000000 Z
11
+ date: 2020-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbtree-jruby