apisonator 3.2.1 → 3.3.3

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: 1f414f062cdabb59cdcc29b67a862a4400baa6e8d92ebeec909907ed881aa806
4
- data.tar.gz: 2db24643307830c7cb2cef21da16a51aae8f9336b7bf35f90d4f22f82d15ff45
3
+ metadata.gz: 1a63aa45d4fa6c23fde95de0b422f771fc9fc104fa9dfebbcdc2c9c0d09219a1
4
+ data.tar.gz: 54809f95ad95b7cd4ab835a7ba3238fcd5d3bef1c9243bbabf1eb4fea95a7e97
5
5
  SHA512:
6
- metadata.gz: 71ad48dc02408cab0de7f8264832489a08b935f55b47139a81ee7228cd71c783d8ebe81c7737c9b3035327535bd9b561784838486194e4b2ab808bb740fad753
7
- data.tar.gz: 843744f70251b4d26365ab1fe2a4e7c73444b57629f3815c6043bbe467c70835050fdaabdd458e47323a11fb4294b01d1674dd5215f09b6647518adcfbf484da
6
+ metadata.gz: c6810598c592d306959e53c89fa602f1f866613f6b6e9001126785f26d688ca71d909a97caafcff1f56ea368d375f146874ff6fd978260c9a8ecd364725afa95
7
+ data.tar.gz: 011c656c600e048725a869a949316171d583fd0cdac4f7bec84ea7231753571cb6d2b5409a9e41f8600d94c5fbb773a187ffe6a3aa5942e7c6a53c7e8b2e05b7
data/CHANGELOG.md CHANGED
@@ -2,6 +2,76 @@
2
2
 
3
3
  Notable changes to Apisonator will be tracked in this document.
4
4
 
5
+ ## 3.3.3 - 2021-03-09
6
+
7
+ ### Changed
8
+
9
+ - Check if alerts can be raised before calculating utilization (perf
10
+ optimization) ([#275](https://github.com/3scale/apisonator/pull/275)).
11
+
12
+ ### Removed
13
+
14
+ - Stop maintaining unused "current_max" key in Alerts
15
+ ([#272](https://github.com/3scale/apisonator/pull/272)).
16
+
17
+ ## 3.3.2 - 2021-02-23
18
+
19
+ ### Fixed
20
+
21
+ - Fixed nil exception in `Aggregator.process`
22
+ ([#269](https://github.com/3scale/apisonator/pull/269)).
23
+
24
+ ### Changed
25
+
26
+ - Updated to Ruby 2.7 in Docker images
27
+ ([#265](https://github.com/3scale/apisonator/pull/265)) and
28
+ ([#266](https://github.com/3scale/apisonator/pull/266)).
29
+ - Updated pry to 0.14.0 and pry-doc to 1.1.0
30
+ ([#267](https://github.com/3scale/apisonator/pull/267)).
31
+ - Updated Docker image to be based on RHEL UBI 8
32
+ ([#268](https://github.com/3scale/apisonator/pull/268)).
33
+
34
+ ### Removed
35
+
36
+ - Removed redundant prometheus config params
37
+ (`listener_prometheus_metrics.enabled` and `listener_prometheus_metrics.port`)
38
+ ([#270](https://github.com/3scale/apisonator/pull/270)).
39
+
40
+ ## 3.3.1.1 - 2021-02-12
41
+
42
+ ### Changed
43
+
44
+ - Updated our Puma fork to v4.3.7
45
+ ([#261](https://github.com/3scale/apisonator/pull/261)).
46
+
47
+ ## 3.3.1 - 2021-02-11
48
+
49
+ ### Fixed
50
+
51
+ - Usages with `#0` (set to 0) no longer generate unnecessary stats keys in Redis
52
+ ([#258](https://github.com/3scale/apisonator/pull/258)).
53
+
54
+ ## 3.3.0 - 2021-02-09
55
+
56
+ ### Added
57
+
58
+ - Rake task to delete stats keys set to 0 in the DB left there because of [this
59
+ issue](https://github.com/3scale/apisonator/pull/247)
60
+ ([#250](https://github.com/3scale/apisonator/pull/250)).
61
+
62
+ ### Fixed
63
+
64
+ - Made the worker more reliable when configured in async mode. Now it handles
65
+ connection errors better
66
+ ([#253](https://github.com/3scale/apisonator/pull/253)),
67
+ ([#254](https://github.com/3scale/apisonator/pull/254)), and
68
+ ([#255](https://github.com/3scale/apisonator/pull/255)).
69
+
70
+ ### Changed
71
+
72
+ - Updated async-redis to v0.5.1
73
+ ([#251](https://github.com/3scale/apisonator/pull/251)).
74
+
5
75
  ## 3.2.1 - 2021-01-22
6
76
 
7
77
  ### Fixed
data/Gemfile.base CHANGED
@@ -15,11 +15,15 @@ platform :ruby do
15
15
  end
16
16
 
17
17
  group :test do
18
+ # Newer versions of rack-test don't work well with rspec-api-documentation.
19
+ # See https://github.com/rack/rack-test/pull/223 &
20
+ # https://github.com/zipmark/rspec_api_documentation/issues/342
21
+ gem 'rack-test', '= 0.8.2'
22
+
18
23
  gem 'benchmark-ips', '~> 2.7.2'
19
24
  gem 'mocha', '~> 1.3'
20
25
  gem 'nokogiri', '~> 1.10.8'
21
26
  gem 'pkg-config', '~> 1.1.7'
22
- gem 'rack-test', '~> 0.8.2'
23
27
  gem 'resque_unit', '~> 0.4.4', source: 'https://rubygems.org'
24
28
  gem 'test-unit', '~> 3.2.6'
25
29
  gem 'resque_spec', '~> 0.17.0'
@@ -32,8 +36,8 @@ end
32
36
  group :development do
33
37
  gem 'sshkit'
34
38
  gem 'source2swagger', git: 'https://github.com/3scale/source2swagger', branch: 'backend'
35
- gem 'pry', '~> 0.11.3'
36
- gem 'pry-doc', '~> 0.11.1'
39
+ gem 'pry', '~> 0.14'
40
+ gem 'pry-doc', '~> 1.1'
37
41
  gem 'license_finder', '~> 5'
38
42
  end
39
43
 
@@ -42,7 +46,7 @@ group :development, :test do
42
46
  end
43
47
 
44
48
  # Default server by platform
45
- gem 'puma', git: 'https://github.com/3scale/puma', ref: 'b034371406690d3e6c2a9301c4a48bd721f3efc3'
49
+ gem 'puma', git: 'https://github.com/3scale/puma', branch: '3scale-4.3.7'
46
50
  # gems required by the runner
47
51
  gem 'gli', '~> 2.16.1', require: nil
48
52
  # Workers
@@ -53,13 +57,14 @@ gem 'rake', '~> 13.0'
53
57
  gem 'builder', '= 3.2.3'
54
58
  # Use a patched resque to allow reusing their Airbrake Failure class
55
59
  gem 'resque', git: 'https://github.com/3scale/resque', branch: '3scale'
60
+ gem 'redis-namespace', '~>1.8.0'
56
61
  gem 'rack', '~> 2.1.4'
57
62
  gem 'sinatra', '~> 2.0.3'
58
63
  gem 'sinatra-contrib', '~> 2.0.3'
59
64
  # Optional external error logging services
60
65
  gem 'bugsnag', '~> 6', require: nil
61
66
  gem 'yabeda-prometheus', '~> 0.5.0'
62
- gem 'async-redis', '~> 0.5'
67
+ gem 'async-redis', '~> 0.5.1'
63
68
  gem 'falcon', '~> 0.35'
64
69
 
65
70
  # Use a patched redis-rb that fixes an issue when trying to connect with
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  GIT
2
2
  remote: https://github.com/3scale/puma
3
- revision: b034371406690d3e6c2a9301c4a48bd721f3efc3
4
- ref: b034371406690d3e6c2a9301c4a48bd721f3efc3
3
+ revision: c0601d08695839b8ffd0f380e91c3b91c1e8b754
4
+ branch: 3scale-4.3.7
5
5
  specs:
6
- puma (2.15.3)
6
+ puma (4.3.7)
7
+ nio4r (~> 2.0)
7
8
 
8
9
  GIT
9
10
  remote: https://github.com/3scale/redis-rb
@@ -35,7 +36,7 @@ GIT
35
36
  PATH
36
37
  remote: .
37
38
  specs:
38
- apisonator (3.2.1)
39
+ apisonator (3.3.3)
39
40
 
40
41
  GEM
41
42
  remote: https://rubygems.org/
@@ -70,7 +71,7 @@ GEM
70
71
  async (~> 1.14)
71
72
  async-pool (0.2.0)
72
73
  async (~> 1.8)
73
- async-redis (0.5.0)
74
+ async-redis (0.5.1)
74
75
  async (~> 1.8)
75
76
  async-io (~> 1.10)
76
77
  async-pool (~> 0.2)
@@ -95,7 +96,7 @@ GEM
95
96
  chronic (0.10.2)
96
97
  codeclimate-test-reporter (0.6.0)
97
98
  simplecov (>= 0.7.1, < 1.0.0)
98
- coderay (1.1.2)
99
+ coderay (1.1.3)
99
100
  concurrent-ruby (1.1.6)
100
101
  console (1.8.2)
101
102
  daemons (1.2.4)
@@ -130,7 +131,7 @@ GEM
130
131
  localhost (1.1.6)
131
132
  mapping (1.1.1)
132
133
  metaclass (0.0.4)
133
- method_source (0.9.0)
134
+ method_source (1.0.0)
134
135
  mini_portile2 (2.4.0)
135
136
  minitest (5.14.1)
136
137
  mocha (1.3.0)
@@ -142,7 +143,7 @@ GEM
142
143
  net-scp (1.2.1)
143
144
  net-ssh (>= 2.6.5)
144
145
  net-ssh (4.2.0)
145
- nio4r (2.5.2)
146
+ nio4r (2.5.4)
146
147
  nokogiri (1.10.9)
147
148
  mini_portile2 (~> 2.4.0)
148
149
  parslet (1.8.2)
@@ -163,22 +164,22 @@ GEM
163
164
  protocol-hpack (~> 1.4)
164
165
  protocol-http (~> 0.15)
165
166
  protocol-redis (0.5.0)
166
- pry (0.11.3)
167
- coderay (~> 1.1.0)
168
- method_source (~> 0.9.0)
167
+ pry (0.14.0)
168
+ coderay (~> 1.1)
169
+ method_source (~> 1.0)
169
170
  pry-byebug (3.5.1)
170
171
  byebug (~> 9.1)
171
172
  pry (~> 0.10)
172
- pry-doc (0.11.1)
173
- pry (~> 0.9)
174
- yard (~> 0.9)
173
+ pry-doc (1.1.0)
174
+ pry (~> 0.11)
175
+ yard (~> 0.9.11)
175
176
  rack (2.1.4)
176
177
  rack-protection (2.0.3)
177
178
  rack
178
179
  rack-test (0.8.2)
179
180
  rack (>= 1.0, < 3)
180
181
  rake (13.0.1)
181
- redis-namespace (1.6.0)
182
+ redis-namespace (1.8.0)
182
183
  redis (>= 3.0.4)
183
184
  resque_spec (0.17.0)
184
185
  resque (>= 1.19.0)
@@ -241,7 +242,7 @@ GEM
241
242
  thread_safe (0.3.6)
242
243
  tilt (2.0.8)
243
244
  timecop (0.9.1)
244
- timers (4.3.0)
245
+ timers (4.3.2)
245
246
  toml (0.2.0)
246
247
  parslet (~> 1.8.0)
247
248
  tzinfo (1.2.7)
@@ -259,7 +260,7 @@ GEM
259
260
  prometheus-client (~> 1.0)
260
261
  yabeda (~> 0.5)
261
262
  yajl-ruby (1.3.1)
262
- yard (0.9.20)
263
+ yard (0.9.26)
263
264
 
264
265
  PLATFORMS
265
266
  ruby
@@ -267,7 +268,7 @@ PLATFORMS
267
268
  DEPENDENCIES
268
269
  airbrake (= 4.3.1)
269
270
  apisonator!
270
- async-redis (~> 0.5)
271
+ async-redis (~> 0.5.1)
271
272
  async-rspec
272
273
  aws-sdk (= 2.4.2)
273
274
  benchmark-ips (~> 2.7.2)
@@ -283,14 +284,15 @@ DEPENDENCIES
283
284
  nokogiri (~> 1.10.8)
284
285
  pg (= 0.20.0)
285
286
  pkg-config (~> 1.1.7)
286
- pry (~> 0.11.3)
287
+ pry (~> 0.14)
287
288
  pry-byebug (~> 3.5.1)
288
- pry-doc (~> 0.11.1)
289
+ pry-doc (~> 1.1)
289
290
  puma!
290
291
  rack (~> 2.1.4)
291
- rack-test (~> 0.8.2)
292
+ rack-test (= 0.8.2)
292
293
  rake (~> 13.0)
293
294
  redis!
295
+ redis-namespace (~> 1.8.0)
294
296
  resque!
295
297
  resque_spec (~> 0.17.0)
296
298
  resque_unit (~> 0.4.4)!
data/Gemfile.on_prem.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  GIT
2
2
  remote: https://github.com/3scale/puma
3
- revision: b034371406690d3e6c2a9301c4a48bd721f3efc3
4
- ref: b034371406690d3e6c2a9301c4a48bd721f3efc3
3
+ revision: c0601d08695839b8ffd0f380e91c3b91c1e8b754
4
+ branch: 3scale-4.3.7
5
5
  specs:
6
- puma (2.15.3)
6
+ puma (4.3.7)
7
+ nio4r (~> 2.0)
7
8
 
8
9
  GIT
9
10
  remote: https://github.com/3scale/redis-rb
@@ -35,7 +36,7 @@ GIT
35
36
  PATH
36
37
  remote: .
37
38
  specs:
38
- apisonator (3.2.1)
39
+ apisonator (3.3.3)
39
40
 
40
41
  GEM
41
42
  remote: https://rubygems.org/
@@ -67,7 +68,7 @@ GEM
67
68
  async (~> 1.14)
68
69
  async-pool (0.2.0)
69
70
  async (~> 1.8)
70
- async-redis (0.5.0)
71
+ async-redis (0.5.1)
71
72
  async (~> 1.8)
72
73
  async-io (~> 1.10)
73
74
  async-pool (~> 0.2)
@@ -85,7 +86,7 @@ GEM
85
86
  byebug (9.1.0)
86
87
  codeclimate-test-reporter (0.6.0)
87
88
  simplecov (>= 0.7.1, < 1.0.0)
88
- coderay (1.1.2)
89
+ coderay (1.1.3)
89
90
  concurrent-ruby (1.1.6)
90
91
  console (1.8.2)
91
92
  daemons (1.2.4)
@@ -119,7 +120,7 @@ GEM
119
120
  localhost (1.1.6)
120
121
  mapping (1.1.1)
121
122
  metaclass (0.0.4)
122
- method_source (0.9.0)
123
+ method_source (1.0.0)
123
124
  mini_portile2 (2.4.0)
124
125
  minitest (5.14.1)
125
126
  mocha (1.3.0)
@@ -131,7 +132,7 @@ GEM
131
132
  net-scp (1.2.1)
132
133
  net-ssh (>= 2.6.5)
133
134
  net-ssh (4.2.0)
134
- nio4r (2.5.2)
135
+ nio4r (2.5.4)
135
136
  nokogiri (1.10.9)
136
137
  mini_portile2 (~> 2.4.0)
137
138
  parslet (1.8.2)
@@ -151,22 +152,22 @@ GEM
151
152
  protocol-hpack (~> 1.4)
152
153
  protocol-http (~> 0.15)
153
154
  protocol-redis (0.5.0)
154
- pry (0.11.3)
155
- coderay (~> 1.1.0)
156
- method_source (~> 0.9.0)
155
+ pry (0.14.0)
156
+ coderay (~> 1.1)
157
+ method_source (~> 1.0)
157
158
  pry-byebug (3.5.1)
158
159
  byebug (~> 9.1)
159
160
  pry (~> 0.10)
160
- pry-doc (0.11.1)
161
- pry (~> 0.9)
162
- yard (~> 0.9)
161
+ pry-doc (1.1.0)
162
+ pry (~> 0.11)
163
+ yard (~> 0.9.11)
163
164
  rack (2.1.4)
164
165
  rack-protection (2.0.3)
165
166
  rack
166
167
  rack-test (0.8.2)
167
168
  rack (>= 1.0, < 3)
168
169
  rake (13.0.1)
169
- redis-namespace (1.6.0)
170
+ redis-namespace (1.8.0)
170
171
  redis (>= 3.0.4)
171
172
  resque_spec (0.17.0)
172
173
  resque (>= 1.19.0)
@@ -227,7 +228,7 @@ GEM
227
228
  thread_safe (0.3.6)
228
229
  tilt (2.0.8)
229
230
  timecop (0.9.1)
230
- timers (4.3.0)
231
+ timers (4.3.2)
231
232
  toml (0.2.0)
232
233
  parslet (~> 1.8.0)
233
234
  tzinfo (1.2.7)
@@ -243,14 +244,14 @@ GEM
243
244
  prometheus-client (~> 1.0)
244
245
  yabeda (~> 0.5)
245
246
  yajl-ruby (1.3.1)
246
- yard (0.9.20)
247
+ yard (0.9.26)
247
248
 
248
249
  PLATFORMS
249
250
  ruby
250
251
 
251
252
  DEPENDENCIES
252
253
  apisonator!
253
- async-redis (~> 0.5)
254
+ async-redis (~> 0.5.1)
254
255
  async-rspec
255
256
  benchmark-ips (~> 2.7.2)
256
257
  bugsnag (~> 6)
@@ -264,14 +265,15 @@ DEPENDENCIES
264
265
  mocha (~> 1.3)
265
266
  nokogiri (~> 1.10.8)
266
267
  pkg-config (~> 1.1.7)
267
- pry (~> 0.11.3)
268
+ pry (~> 0.14)
268
269
  pry-byebug (~> 3.5.1)
269
- pry-doc (~> 0.11.1)
270
+ pry-doc (~> 1.1)
270
271
  puma!
271
272
  rack (~> 2.1.4)
272
- rack-test (~> 0.8.2)
273
+ rack-test (= 0.8.2)
273
274
  rake (~> 13.0)
274
275
  redis!
276
+ redis-namespace (~> 1.8.0)
275
277
  resque!
276
278
  resque_spec (~> 0.17.0)
277
279
  resque_unit (~> 0.4.4)!
data/Rakefile CHANGED
@@ -261,27 +261,49 @@ task :reschedule_failed_jobs do
261
261
  "Pending failed jobs: #{result[:failed_current]}."
262
262
  end
263
263
 
264
- desc 'Delete stats of services marked for deletion'
265
264
  namespace :stats do
265
+ desc 'Delete stats of services marked for deletion'
266
266
  task :cleanup, [:redis_urls, :log_deleted_keys] do |_, args|
267
- redis_urls = args[:redis_urls] && args[:redis_urls].split(' ')
267
+ redis_conns = redis_conns(args[:redis_urls])
268
268
 
269
- if redis_urls.nil? || redis_urls.empty?
269
+ if redis_conns.empty?
270
270
  puts 'No Redis URLs specified'
271
271
  exit(false)
272
272
  end
273
273
 
274
- redis_clients = redis_urls.map do |redis_url|
275
- parsed_uri = URI.parse(ThreeScale::Backend::Storage::Helpers.send(
276
- :to_redis_uri, redis_url)
277
- )
278
- Redis.new(host: parsed_uri.host, port: parsed_uri.port)
274
+ ThreeScale::Backend::Stats::Cleaner.delete!(
275
+ redis_conns, log_deleted_keys: logger_for_deleted_keys(args[:log_deleted_keys])
276
+ )
277
+ end
278
+
279
+ desc 'Delete stats keys set to 0'
280
+ task :delete_stats_keys_set_to_0, [:redis_urls, :log_deleted_keys] do |_, args|
281
+ redis_conns = redis_conns(args[:redis_urls])
282
+
283
+ if redis_conns.empty?
284
+ puts 'No Redis URLs specified'
285
+ exit(false)
279
286
  end
280
287
 
281
- log_deleted = args[:log_deleted_keys] == 'true' ? STDOUT : nil
288
+ ThreeScale::Backend::Stats::Cleaner.delete_stats_keys_set_to_0(
289
+ redis_conns, log_deleted_keys: logger_for_deleted_keys(args[:log_deleted_keys])
290
+ )
291
+ end
292
+ end
282
293
 
283
- ThreeScale::Backend::Stats::Cleaner.delete!(
284
- redis_clients, log_deleted_keys: log_deleted
294
+ def redis_conns(urls)
295
+ redis_urls = urls && urls.split(' ')
296
+
297
+ return [] if redis_urls.nil? || redis_urls.empty?
298
+
299
+ redis_urls.map do |redis_url|
300
+ parsed_uri = URI.parse(ThreeScale::Backend::Storage::Helpers.send(
301
+ :to_redis_uri, redis_url)
285
302
  )
303
+ Redis.new(host: parsed_uri.host, port: parsed_uri.port)
286
304
  end
287
305
  end
306
+
307
+ def logger_for_deleted_keys(arg_log_deleted_keys)
308
+ arg_log_deleted_keys == 'true' ? STDOUT : nil
309
+ end