unleash 6.2.0 → 6.2.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/CHANGELOG.md +4 -0
- data/lib/unleash/bootstrap/handler.rb +2 -1
- data/lib/unleash/context.rb +2 -2
- data/lib/unleash/metrics_reporter.rb +29 -10
- data/lib/unleash/version.rb +1 -1
- data/unleash-client.gemspec +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32ddaecfae8bb5a049359c13075e734a22047d2f125e14803ee37d8e2934f915
|
4
|
+
data.tar.gz: 9de21ac17035d20000e559fb14faec6c9bfa00af33d5b8d4d4b8300f45a110a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '014049ad81c82301dc19cd6b5ad5654447844bf5a1421b0b45d3fe663ca0d7d6b5747db1a97478ebdcf0a617eeb381d08686d5c136986ee4f6d9e513c3f527e3'
|
7
|
+
data.tar.gz: 700d96af0897156beff38e9d7fc844061efce25aee11fa317a8834350909b499df7aaa8f2a775f49e8d7e69778e5241cd4f4b6d07e7ad3de7e5a73fdac2e5218
|
data/CHANGELOG.md
CHANGED
@@ -15,7 +15,8 @@ module Unleash
|
|
15
15
|
return configuration.data unless self.configuration.data.nil?
|
16
16
|
return configuration.block.call if self.configuration.block.is_a?(Proc)
|
17
17
|
return Provider::FromFile.read(configuration.file_path) unless self.configuration.file_path.nil?
|
18
|
-
|
18
|
+
|
19
|
+
Provider::FromUrl.read(configuration.url, configuration.url_headers) unless self.configuration.url.nil?
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
data/lib/unleash/context.rb
CHANGED
@@ -7,8 +7,8 @@ module Unleash
|
|
7
7
|
def initialize(params = {})
|
8
8
|
raise ArgumentError, "Unleash::Context must be initialized with a hash." unless params.is_a?(Hash)
|
9
9
|
|
10
|
-
self.app_name = value_for("appName", params, Unleash
|
11
|
-
self.environment = value_for("environment", params, Unleash
|
10
|
+
self.app_name = value_for("appName", params, Unleash.configuration&.app_name)
|
11
|
+
self.environment = value_for("environment", params, Unleash.configuration&.environment || "default")
|
12
12
|
self.user_id = value_for("userId", params)&.to_s
|
13
13
|
self.session_id = value_for("sessionId", params)
|
14
14
|
self.remote_address = value_for("remoteAddress", params)
|
@@ -14,8 +14,24 @@ module Unleash
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def generate_report
|
17
|
-
metrics = Unleash
|
17
|
+
metrics = Unleash.engine&.get_metrics
|
18
|
+
return nil if metrics.nil?
|
18
19
|
|
20
|
+
generate_report_from_bucket metrics
|
21
|
+
end
|
22
|
+
|
23
|
+
def post
|
24
|
+
Unleash.logger.debug "post() Report"
|
25
|
+
|
26
|
+
report = build_report
|
27
|
+
return unless report
|
28
|
+
|
29
|
+
send_report(report)
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def generate_report_from_bucket(bucket)
|
19
35
|
{
|
20
36
|
'platformName': RUBY_ENGINE,
|
21
37
|
'platformVersion': RUBY_VERSION,
|
@@ -24,20 +40,23 @@ module Unleash
|
|
24
40
|
'appName': Unleash.configuration.app_name,
|
25
41
|
'instanceId': Unleash.configuration.instance_id,
|
26
42
|
'connectionId': Unleash.configuration.connection_id,
|
27
|
-
'bucket':
|
43
|
+
'bucket': bucket
|
28
44
|
}
|
29
45
|
end
|
30
46
|
|
31
|
-
def
|
32
|
-
|
33
|
-
|
34
|
-
report = self.generate_report
|
47
|
+
def build_report
|
48
|
+
report = generate_report
|
49
|
+
return nil if report.nil? && Time.now - self.last_time < LONGEST_WITHOUT_A_REPORT
|
35
50
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
51
|
+
report || generate_report_from_bucket({
|
52
|
+
'start': self.last_time.utc.iso8601,
|
53
|
+
'stop': Time.now.utc.iso8601,
|
54
|
+
'toggles': {}
|
55
|
+
})
|
56
|
+
end
|
40
57
|
|
58
|
+
def send_report(report)
|
59
|
+
self.last_time = Time.now
|
41
60
|
headers = (Unleash.configuration.http_headers || {}).dup
|
42
61
|
headers.merge!({ 'UNLEASH-INTERVAL' => Unleash.configuration.metrics_interval.to_s })
|
43
62
|
response = Unleash::Util::Http.post(Unleash.configuration.client_metrics_uri, report.to_json, headers)
|
data/lib/unleash/version.rb
CHANGED
data/unleash-client.gemspec
CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
|
37
37
|
# rubocop:disable Gemspec/RubyVersionGlobalsUsage, Style/IfUnlessModifier
|
38
38
|
if Gem::Version.new(RUBY_VERSION) > Gem::Version.new('3.0')
|
39
|
-
spec.add_development_dependency "rubocop", "~> 1.
|
39
|
+
spec.add_development_dependency "rubocop", "~> 1.75"
|
40
40
|
end
|
41
41
|
# rubocop:enable Gemspec/RubyVersionGlobalsUsage, Style/IfUnlessModifier
|
42
42
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unleash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.2.
|
4
|
+
version: 6.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Renato Arruda
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yggdrasil-engine
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.
|
131
|
+
version: '1.75'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 1.
|
138
|
+
version: '1.75'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: simplecov
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -216,7 +216,7 @@ homepage: https://github.com/unleash/unleash-client-ruby
|
|
216
216
|
licenses:
|
217
217
|
- Apache-2.0
|
218
218
|
metadata: {}
|
219
|
-
post_install_message:
|
219
|
+
post_install_message:
|
220
220
|
rdoc_options: []
|
221
221
|
require_paths:
|
222
222
|
- lib
|
@@ -231,8 +231,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
231
|
- !ruby/object:Gem::Version
|
232
232
|
version: '0'
|
233
233
|
requirements: []
|
234
|
-
rubygems_version: 3.5.
|
235
|
-
signing_key:
|
234
|
+
rubygems_version: 3.5.6
|
235
|
+
signing_key:
|
236
236
|
specification_version: 4
|
237
237
|
summary: Unleash feature toggle client.
|
238
238
|
test_files: []
|