airbrake-ruby 5.1.1 → 5.2.0

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: a9438fdfe9308d48989fc04e1f9873c4cab46f7c22487ae1bd3d22e917d73f60
4
- data.tar.gz: '08e6b8f6af0fd1ff980e642d9ce540c6c407844d34249bb921b9a15cd5f74ad7'
3
+ metadata.gz: 8102082d97168a2204b3e730fc2085d30d06d4ab501e6207d91ce9d67bd91584
4
+ data.tar.gz: cf2234bd6fc61e439796b0f664163a12fdd4c39c4256a1c469f06dd1f8132de3
5
5
  SHA512:
6
- metadata.gz: e6e892017febffa214ab8ea921fa8c09b1a27e6c2b0874d669e0dd64004b21fa27bd13ea65b750505e9c702c7248314e8d77ca6b57cb1ec4332c9157712d866d
7
- data.tar.gz: c1ebc53b428eca54eb4c85e4fc094819c9c2972308b97069c6234502159d57c2b5977203fb8a60dd3865e7f8dca2f0430dd0f1500ef2df89f8f059a881433740
6
+ metadata.gz: d5b353597aa2bf9d59fa454f8a6a87fadcdc71685a7e21ef3ec9f74e57b20268e5d6cad2d6d0fe061bdcdbe02e65cf2e5761d4e92c6370ea1d1316972da9d9af
7
+ data.tar.gz: d13b77d0f959ff3a5326f054b8df67c9402b216038afd25672df8b6803623ac135bb5366739687fc5c234ae2e127d075828f747bb945d9ba4d48f3f354775f17
@@ -121,15 +121,21 @@ module Airbrake
121
121
  # @return [Boolean] true if the library should send error reports to
122
122
  # Airbrake, false otherwise
123
123
  # @api public
124
- # @since 5.0.0
124
+ # @since v5.0.0
125
125
  attr_accessor :error_notifications
126
126
 
127
- # @return [String] the host such as which should be used for fetching remote
128
- # configuration options (example: "https://bucket-name.s3.amazonaws.com")
129
- # @api private
130
- # @since 5.0.0
127
+ # @return [String] the host which should be used for fetching remote
128
+ # configuration options
129
+ # @api public
130
+ # @since v5.0.0
131
131
  attr_accessor :remote_config_host
132
132
 
133
+ # @return [String] true if notifier should periodically fetch remote
134
+ # configuration, false otherwise
135
+ # @api public
136
+ # @since v5.2.0
137
+ attr_accessor :remote_config
138
+
133
139
  class << self
134
140
  # @return [Config]
135
141
  attr_writer :instance
@@ -142,7 +148,7 @@ module Airbrake
142
148
 
143
149
  # @param [Hash{Symbol=>Object}] user_config the hash to be used to build the
144
150
  # config
145
- # rubocop:disable Metrics/AbcSize
151
+ # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
146
152
  def initialize(user_config = {})
147
153
  self.proxy = {}
148
154
  self.queue_size = 100
@@ -173,10 +179,11 @@ module Airbrake
173
179
  self.query_stats = true
174
180
  self.job_stats = true
175
181
  self.error_notifications = true
182
+ self.remote_config = true
176
183
 
177
184
  merge(user_config)
178
185
  end
179
- # rubocop:enable Metrics/AbcSize
186
+ # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
180
187
 
181
188
  # The full URL to the Airbrake Notice API. Based on the +:error_host+ option.
182
189
  # @return [URI] the endpoint address
@@ -3,7 +3,7 @@ module Airbrake
3
3
  # Processor is a helper class, which is responsible for setting default
4
4
  # config values, default notifier filters and remote configuration changes.
5
5
  #
6
- # @since 5.0.0
6
+ # @since v5.0.0
7
7
  # @api private
8
8
  class Processor
9
9
  # @param [Airbrake::Config] config
@@ -41,6 +41,7 @@ module Airbrake
41
41
 
42
42
  # @return [Airbrake::RemoteSettings]
43
43
  def process_remote_configuration
44
+ return unless @config.remote_config
44
45
  return unless @project_id
45
46
  return if @config.environment == 'test'
46
47
 
@@ -40,7 +40,7 @@ module Airbrake
40
40
  data.empty?
41
41
  end
42
42
 
43
- # @since 4.7.0
43
+ # @since v4.7.0
44
44
  # @return [void]
45
45
  def self.reset
46
46
  @data = {}
@@ -41,8 +41,7 @@ module Airbrake
41
41
  thread_info[:fiber_variables] = vars
42
42
  end
43
43
 
44
- # Present in Ruby 2.3+.
45
- if th.respond_to?(:name) && (name = th.name)
44
+ if (name = th.name)
46
45
  thread_info[:name] = name
47
46
  end
48
47
 
@@ -2,7 +2,7 @@ module Airbrake
2
2
  # Grouppable adds the `#groups` method, so that we don't need to define it in
3
3
  # all of performance models every time we add a model without groups.
4
4
  #
5
- # @since 4.9.0
5
+ # @since v4.9.0
6
6
  # @api private
7
7
  module Grouppable
8
8
  def groups
@@ -2,7 +2,7 @@ module Airbrake
2
2
  # Mergeable adds the `#merge` method, so that we don't need to define it in
3
3
  # all of performance models every time we add a model.
4
4
  #
5
- # @since 4.9.0
5
+ # @since v4.9.0
6
6
  # @api private
7
7
  module Mergeable
8
8
  def merge(_other)
@@ -8,7 +8,7 @@ module Airbrake
8
8
  # config.error_notifications = data.error_notifications?
9
9
  # end
10
10
  #
11
- # @since 5.0.0
11
+ # @since v5.0.0
12
12
  # @api private
13
13
  class RemoteSettings
14
14
  include Airbrake::Loggable
@@ -4,7 +4,7 @@ module Airbrake
4
4
  # updates the local config according to the data.
5
5
  #
6
6
  # @api private
7
- # @since 5.0.2
7
+ # @since v5.0.2
8
8
  class Callback
9
9
  def initialize(config)
10
10
  @config = config
@@ -11,7 +11,7 @@ module Airbrake
11
11
  #
12
12
  # settings_data.interval #=> 600
13
13
  #
14
- # @since 5.0.0
14
+ # @since v5.0.0
15
15
  # @api private
16
16
  class SettingsData
17
17
  # @return [Integer] how frequently we should poll the config API
@@ -3,10 +3,10 @@
3
3
  module Airbrake
4
4
  # @return [String] the library version
5
5
  # @api public
6
- AIRBRAKE_RUBY_VERSION = '5.1.1'.freeze
6
+ AIRBRAKE_RUBY_VERSION = '5.2.0'.freeze
7
7
 
8
8
  # @return [Hash{Symbol=>String}] the information about the notifier library
9
- # @since 5.0.0
9
+ # @since v5.0.0
10
10
  # @api public
11
11
  NOTIFIER_INFO = {
12
12
  name: 'airbrake-ruby'.freeze,
@@ -72,6 +72,15 @@ RSpec.describe Airbrake::Config::Processor do
72
72
  described_class.new(config).process_remote_configuration
73
73
  end
74
74
  end
75
+
76
+ context "when the config disables the remote_config option" do
77
+ let(:config) { Airbrake::Config.new(project_id: 123, remote_config: false) }
78
+
79
+ it "doesn't set remote settings" do
80
+ expect(Airbrake::RemoteSettings).not_to receive(:poll)
81
+ described_class.new(config).process_remote_configuration
82
+ end
83
+ end
75
84
  end
76
85
 
77
86
  describe "#add_filters" do
@@ -26,6 +26,7 @@ RSpec.describe Airbrake::Config do
26
26
  its(:query_stats) { is_expected.to eq(true) }
27
27
  its(:job_stats) { is_expected.to eq(true) }
28
28
  its(:error_notifications) { is_expected.to eq(true) }
29
+ its(:remote_config) { is_expected.to eq(true) }
29
30
 
30
31
  its(:remote_config_host) do
31
32
  is_expected.to eq('https://notifier-configs.airbrake.io')
@@ -234,7 +234,7 @@ RSpec.describe Airbrake::Filters::ThreadFilter do
234
234
  end
235
235
  end
236
236
 
237
- it "appends name", skip: !Thread.current.respond_to?(:name) do
237
+ it "appends name" do
238
238
  new_thread do |th|
239
239
  th.name = 'bingo'
240
240
  subject.call(notice)
@@ -86,7 +86,7 @@ RSpec.describe Airbrake::TDigest do
86
86
  maxerr = [maxerr, (i - q).abs].max
87
87
  end
88
88
 
89
- expect(maxerr).to be < 0.01
89
+ expect(maxerr).to be < 0.02
90
90
  end
91
91
  end
92
92
  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: 5.1.1
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-17 00:00:00.000000000 Z
11
+ date: 2020-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbtree3