apisonator 3.2.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/Gemfile.on_prem.lock +1 -1
- data/lib/3scale/backend/transactor.rb +31 -4
- data/lib/3scale/backend/version.rb +1 -1
- data/licenses.xml +1 -1
- 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: 1f414f062cdabb59cdcc29b67a862a4400baa6e8d92ebeec909907ed881aa806
|
4
|
+
data.tar.gz: 2db24643307830c7cb2cef21da16a51aae8f9336b7bf35f90d4f22f82d15ff45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71ad48dc02408cab0de7f8264832489a08b935f55b47139a81ee7228cd71c783d8ebe81c7737c9b3035327535bd9b561784838486194e4b2ab808bb740fad753
|
7
|
+
data.tar.gz: 843744f70251b4d26365ab1fe2a4e7c73444b57629f3815c6043bbe467c70835050fdaabdd458e47323a11fb4294b01d1674dd5215f09b6647518adcfbf484da
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
Notable changes to Apisonator will be tracked in this document.
|
4
4
|
|
5
|
+
## 3.2.1 - 2021-01-22
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
|
9
|
+
- Reports of 0 hits no longer generate unnecessary stats keys in Redis
|
10
|
+
([#247](https://github.com/3scale/apisonator/pull/247)).
|
11
|
+
|
5
12
|
## 3.2.0 - 2021-01-19
|
6
13
|
|
7
14
|
### Added
|
data/Gemfile.lock
CHANGED
data/Gemfile.on_prem.lock
CHANGED
@@ -20,8 +20,14 @@ module ThreeScale
|
|
20
20
|
def report(provider_key, service_id, transactions, context_info = {})
|
21
21
|
service = Service.load_with_provider_key!(service_id, provider_key)
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
# A usage of 0 does not affect rate-limits or stats, so we do not need
|
24
|
+
# to report it.
|
25
|
+
filtered_transactions = filter_usages_with_0(transactions.clone)
|
26
|
+
|
27
|
+
return if filtered_transactions.empty?
|
28
|
+
|
29
|
+
report_enqueue(service.id, filtered_transactions, context_info)
|
30
|
+
notify_report(provider_key, filtered_transactions.size)
|
25
31
|
end
|
26
32
|
|
27
33
|
def authorize(provider_key, params, context_info = {})
|
@@ -137,9 +143,17 @@ module ThreeScale
|
|
137
143
|
|
138
144
|
usage = params[:usage]
|
139
145
|
|
140
|
-
|
146
|
+
filtered_usage = filter_metrics_without_inc(usage.clone) if usage
|
147
|
+
|
148
|
+
if ((filtered_usage && !filtered_usage.empty?) || params[:log]) && status.authorized?
|
141
149
|
application_id = status.application.id
|
142
|
-
|
150
|
+
|
151
|
+
report_enqueue(
|
152
|
+
status.service_id,
|
153
|
+
{ 0 => {"app_id" => application_id, "usage" => filtered_usage, "log" => params[:log] } },
|
154
|
+
request: { extensions: request_info[:extensions] }
|
155
|
+
)
|
156
|
+
|
143
157
|
notify_authrep(provider_key, usage ? 1 : 0)
|
144
158
|
else
|
145
159
|
notify_authorize(provider_key)
|
@@ -182,6 +196,19 @@ module ThreeScale
|
|
182
196
|
end
|
183
197
|
end
|
184
198
|
|
199
|
+
def filter_usages_with_0(transactions)
|
200
|
+
# There are plenty of existing tests using both a string and a symbol
|
201
|
+
# when accessing the usage.
|
202
|
+
transactions.delete_if do |_idx, tx|
|
203
|
+
(usage = tx['usage'.freeze] || tx[:usage]) or next
|
204
|
+
filter_metrics_without_inc(usage).empty?
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
def filter_metrics_without_inc(usage)
|
209
|
+
usage.delete_if { |_metric, delta| delta.to_s == '0'.freeze }
|
210
|
+
end
|
211
|
+
|
185
212
|
def storage
|
186
213
|
Storage.instance
|
187
214
|
end
|
data/licenses.xml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apisonator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Ciganek
|
@@ -16,7 +16,7 @@ authors:
|
|
16
16
|
autorequire:
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
|
-
date: 2021-01-
|
19
|
+
date: 2021-01-22 00:00:00.000000000 Z
|
20
20
|
dependencies: []
|
21
21
|
description: This gem provides a daemon that handles authorization and reporting of
|
22
22
|
web services managed by 3scale.
|