airbrake-ruby 6.0.0 → 6.0.1
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/filters/git_last_checkout_filter.rb +1 -1
- data/lib/airbrake-ruby/remote_settings.rb +26 -3
- data/lib/airbrake-ruby/thread_pool.rb +3 -3
- data/lib/airbrake-ruby/version.rb +1 -1
- data/spec/filters/git_revision_filter_spec.rb +1 -1
- data/spec/remote_settings_spec.rb +5 -1
- data/spec/thread_pool_spec.rb +3 -4
- 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: f89d6e09b27f36f4d4450eeb9dd6fb9dff228ffe095769f8b9bcc24a02413842
|
4
|
+
data.tar.gz: a2b4daefe2139f002a42754b6df05c6c11dca9d80b0ecf440cd0620336a2d87e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 423f95e5781de19de642d880106b38feca43c98f9223956e4208b616929d6a63c56e1ca223d449115f232e60f0a84f9f0c52c140df708d2deaf20aa2dfca4a3e
|
7
|
+
data.tar.gz: e09266840dd038be725ad564d6db02696e5c6a0f188eae5206da30cbd2cf454eccbe56cbcf027b454821e6ef1bee29cb8fb2db7c7c61f81ffa6e0ecb1566c133
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Airbrake
|
2
2
|
# RemoteSettings polls the remote config of the passed project at fixed
|
3
3
|
# intervals. The fetched config is yielded as a callback parameter so that the
|
4
|
-
# invoker can define read config values.
|
4
|
+
# invoker can define read config values. Supports proxies.
|
5
5
|
#
|
6
6
|
# @example Disable/enable error notifications based on the remote value
|
7
7
|
# RemoteSettings.poll do |data|
|
@@ -43,6 +43,7 @@ module Airbrake
|
|
43
43
|
@data = SettingsData.new(project_id, {})
|
44
44
|
@host = host
|
45
45
|
@block = block
|
46
|
+
@config = Airbrake::Config.instance
|
46
47
|
@poll = nil
|
47
48
|
end
|
48
49
|
|
@@ -72,11 +73,16 @@ module Airbrake
|
|
72
73
|
private
|
73
74
|
|
74
75
|
def fetch_config
|
76
|
+
uri = build_config_uri
|
77
|
+
https = build_https(uri)
|
78
|
+
req = Net::HTTP::Get.new(uri.request_uri)
|
75
79
|
response = nil
|
80
|
+
|
76
81
|
begin
|
77
|
-
response =
|
82
|
+
response = https.request(req)
|
78
83
|
rescue StandardError => ex
|
79
|
-
|
84
|
+
reason = "#{LOG_LABEL} HTTP error: #{ex}"
|
85
|
+
logger.error(reason)
|
80
86
|
return {}
|
81
87
|
end
|
82
88
|
|
@@ -101,5 +107,22 @@ module Airbrake
|
|
101
107
|
uri.query = QUERY_PARAMS
|
102
108
|
uri
|
103
109
|
end
|
110
|
+
|
111
|
+
def build_https(uri)
|
112
|
+
Net::HTTP.new(uri.host, uri.port, *proxy_params).tap do |https|
|
113
|
+
https.use_ssl = uri.is_a?(URI::HTTPS)
|
114
|
+
if @config.timeout
|
115
|
+
https.open_timeout = @config.timeout
|
116
|
+
https.read_timeout = @config.timeout
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def proxy_params
|
122
|
+
return unless @config.proxy.key?(:host)
|
123
|
+
|
124
|
+
[@config.proxy[:host], @config.proxy[:port], @config.proxy[:user],
|
125
|
+
@config.proxy[:password]]
|
126
|
+
end
|
104
127
|
end
|
105
128
|
end
|
@@ -48,11 +48,11 @@ module Airbrake
|
|
48
48
|
# false if the queue is full
|
49
49
|
def <<(message)
|
50
50
|
if backlog >= @queue_size
|
51
|
-
logger.
|
51
|
+
logger.info do
|
52
52
|
"#{LOG_LABEL} ThreadPool has reached its capacity of " \
|
53
53
|
"#{@queue_size} and the following message will not be " \
|
54
|
-
"processed: #{message.inspect}"
|
55
|
-
|
54
|
+
"processed: #{message.inspect}"
|
55
|
+
end
|
56
56
|
return false
|
57
57
|
end
|
58
58
|
|
@@ -54,7 +54,7 @@ RSpec.describe Airbrake::Filters::GitRevisionFilter do
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
context "and also when HEAD starts with 'ref: " do
|
57
|
+
context "and also when HEAD starts with 'ref: '" do
|
58
58
|
before do
|
59
59
|
allow(File).to(
|
60
60
|
receive(:read).with('root/dir/.git/HEAD').and_return("ref: refs/foo\n"),
|
@@ -85,8 +85,12 @@ RSpec.describe Airbrake::RemoteSettings do
|
|
85
85
|
end
|
86
86
|
|
87
87
|
context "when an error is raised while making a HTTP request" do
|
88
|
+
let(:https) { instance_double(Net::HTTP) }
|
89
|
+
|
88
90
|
before do
|
89
|
-
allow(Net::HTTP).to receive(:
|
91
|
+
allow(Net::HTTP).to receive(:new).and_return(https)
|
92
|
+
allow(https).to receive(:use_ssl=).with(true)
|
93
|
+
allow(https).to receive(:request).and_raise(StandardError)
|
90
94
|
end
|
91
95
|
|
92
96
|
it "doesn't fetch remote settings" do
|
data/spec/thread_pool_spec.rb
CHANGED
@@ -55,14 +55,13 @@ RSpec.describe Airbrake::ThreadPool do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
it "logs discarded tasks" do
|
58
|
-
allow(Airbrake::Loggable.instance).to receive(:
|
58
|
+
allow(Airbrake::Loggable.instance).to receive(:info)
|
59
59
|
|
60
60
|
15.times { full_thread_pool << 1 }
|
61
61
|
full_thread_pool.close
|
62
62
|
|
63
|
-
expect(Airbrake::Loggable.instance)
|
64
|
-
|
65
|
-
).exactly(15).times
|
63
|
+
expect(Airbrake::Loggable.instance)
|
64
|
+
.to have_received(:info).exactly(15).times
|
66
65
|
end
|
67
66
|
end
|
68
67
|
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: 6.0.
|
4
|
+
version: 6.0.1
|
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: 2021-
|
11
|
+
date: 2021-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rbtree3
|