unleash 6.2.0.pre.alpha.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/.github/workflows/pull_request.yml +0 -9
- data/CHANGELOG.md +12 -0
- data/lib/unleash/bootstrap/handler.rb +2 -1
- data/lib/unleash/client.rb +1 -0
- data/lib/unleash/configuration.rb +7 -5
- data/lib/unleash/context.rb +2 -2
- data/lib/unleash/metrics_reporter.rb +33 -11
- data/lib/unleash/toggle_fetcher.rb +3 -1
- data/lib/unleash/util/http.rb +2 -2
- data/lib/unleash/version.rb +1 -1
- data/unleash-client.gemspec +1 -1
- metadata +4 -4
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
|
@@ -70,15 +70,6 @@ jobs:
|
|
70
70
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
71
71
|
flag-name: run-${{ matrix.test_number }}
|
72
72
|
parallel: true
|
73
|
-
- name: Notify Slack of pipeline completion
|
74
|
-
uses: 8398a7/action-slack@v3
|
75
|
-
if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
|
76
|
-
with:
|
77
|
-
status: ${{ job.status }}
|
78
|
-
text: Built on ${{ matrix.os }} - Ruby ${{ matrix.ruby-version }}
|
79
|
-
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
|
80
|
-
env:
|
81
|
-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
82
73
|
|
83
74
|
finish:
|
84
75
|
needs: test
|
data/CHANGELOG.md
CHANGED
@@ -13,6 +13,18 @@ Note: These changes are not considered notable:
|
|
13
13
|
|
14
14
|
## [Unreleased]
|
15
15
|
|
16
|
+
## [6.2.1] - 2025-04-14
|
17
|
+
### Fixed
|
18
|
+
- metrics sending no longer fails after 10 minutes
|
19
|
+
|
20
|
+
## [6.2.0] - 2024-02-28
|
21
|
+
### Added
|
22
|
+
- unleash-interval header (#236)
|
23
|
+
- connectionId in metrics and registration payload (#236)
|
24
|
+
- default interval changed from 10s to 15s (#236)
|
25
|
+
- update Yggdrasil engine (#228)
|
26
|
+
- delta API configuration option (#228)
|
27
|
+
|
16
28
|
## [6.1.2] - 2024-01-30
|
17
29
|
### Fixed
|
18
30
|
- drop x- header prefix (#229)
|
@@ -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/client.rb
CHANGED
@@ -116,6 +116,7 @@ module Unleash
|
|
116
116
|
{
|
117
117
|
'appName': Unleash.configuration.app_name,
|
118
118
|
'instanceId': Unleash.configuration.instance_id,
|
119
|
+
'connectionId': Unleash.configuration.connection_id,
|
119
120
|
'sdkVersion': "unleash-client-ruby:" + Unleash::VERSION,
|
120
121
|
'strategies': Unleash.strategies.known_strategies,
|
121
122
|
'started': Time.now.iso8601(Unleash::TIME_RESOLUTION),
|
@@ -23,6 +23,7 @@ module Unleash
|
|
23
23
|
:bootstrap_config,
|
24
24
|
:strategies,
|
25
25
|
:use_delta_api
|
26
|
+
attr_reader :connection_id
|
26
27
|
|
27
28
|
def initialize(opts = {})
|
28
29
|
validate_custom_http_headers!(opts[:custom_http_headers]) if opts.has_key?(:custom_http_headers)
|
@@ -51,14 +52,15 @@ module Unleash
|
|
51
52
|
end
|
52
53
|
|
53
54
|
def http_headers
|
54
|
-
{
|
55
|
+
headers = {
|
55
56
|
'User-Agent' => "UnleashClientRuby/#{Unleash::VERSION} #{RUBY_ENGINE}/#{RUBY_VERSION} [#{RUBY_PLATFORM}]",
|
56
57
|
'UNLEASH-INSTANCEID' => self.instance_id,
|
57
58
|
'UNLEASH-APPNAME' => self.app_name,
|
58
|
-
'
|
59
|
-
'UNLEASH-SDK' => "unleash-client-ruby:#{Unleash::VERSION}"
|
60
|
-
'Unleash-Client-Spec' => CLIENT_SPECIFICATION_VERSION
|
59
|
+
'Unleash-Client-Spec' => CLIENT_SPECIFICATION_VERSION,
|
60
|
+
'UNLEASH-SDK' => "unleash-client-ruby:#{Unleash::VERSION}"
|
61
61
|
}.merge!(generate_custom_http_headers)
|
62
|
+
headers['UNLEASH-CONNECTION-ID'] = @connection_id
|
63
|
+
headers
|
62
64
|
end
|
63
65
|
|
64
66
|
def fetch_toggles_uri
|
@@ -101,7 +103,7 @@ module Unleash
|
|
101
103
|
self.project_name = nil
|
102
104
|
self.disable_client = false
|
103
105
|
self.disable_metrics = false
|
104
|
-
self.refresh_interval =
|
106
|
+
self.refresh_interval = 15
|
105
107
|
self.metrics_interval = 60
|
106
108
|
self.timeout = 30
|
107
109
|
self.retry_limit = Float::INFINITY
|
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,
|
@@ -23,21 +39,27 @@ module Unleash
|
|
23
39
|
'specVersion': Unleash::CLIENT_SPECIFICATION_VERSION,
|
24
40
|
'appName': Unleash.configuration.app_name,
|
25
41
|
'instanceId': Unleash.configuration.instance_id,
|
26
|
-
'
|
42
|
+
'connectionId': Unleash.configuration.connection_id,
|
43
|
+
'bucket': bucket
|
27
44
|
}
|
28
45
|
end
|
29
46
|
|
30
|
-
def
|
31
|
-
|
32
|
-
|
33
|
-
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
|
34
50
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
51
|
+
report || generate_report_from_bucket({
|
52
|
+
'start': self.last_time.utc.iso8601,
|
53
|
+
'stop': Time.now.utc.iso8601,
|
54
|
+
'toggles': {}
|
55
|
+
})
|
56
|
+
end
|
39
57
|
|
40
|
-
|
58
|
+
def send_report(report)
|
59
|
+
self.last_time = Time.now
|
60
|
+
headers = (Unleash.configuration.http_headers || {}).dup
|
61
|
+
headers.merge!({ 'UNLEASH-INTERVAL' => Unleash.configuration.metrics_interval.to_s })
|
62
|
+
response = Unleash::Util::Http.post(Unleash.configuration.client_metrics_uri, report.to_json, headers)
|
41
63
|
|
42
64
|
if ['200', '202'].include? response.code
|
43
65
|
Unleash.logger.debug "Report sent to unleash server successfully. Server responded with http code #{response.code}"
|
@@ -37,7 +37,9 @@ module Unleash
|
|
37
37
|
Unleash.logger.debug "fetch()"
|
38
38
|
return if Unleash.configuration.disable_client
|
39
39
|
|
40
|
-
|
40
|
+
headers = (Unleash.configuration.http_headers || {}).dup
|
41
|
+
headers.merge!({ 'UNLEASH-INTERVAL' => Unleash.configuration.refresh_interval.to_s })
|
42
|
+
response = Unleash::Util::Http.get(Unleash.configuration.fetch_toggles_uri, etag, headers)
|
41
43
|
|
42
44
|
if response.code == '304'
|
43
45
|
Unleash.logger.debug "No changes according to the unleash server, nothing to do."
|
data/lib/unleash/util/http.rb
CHANGED
@@ -12,10 +12,10 @@ module Unleash
|
|
12
12
|
http.request(request)
|
13
13
|
end
|
14
14
|
|
15
|
-
def self.post(uri, body)
|
15
|
+
def self.post(uri, body, headers_override = nil)
|
16
16
|
http = http_connection(uri)
|
17
17
|
|
18
|
-
request = Net::HTTP::Post.new(uri.request_uri, http_headers)
|
18
|
+
request = Net::HTTP::Post.new(uri.request_uri, http_headers(nil, headers_override))
|
19
19
|
request.body = body
|
20
20
|
|
21
21
|
http.request(request)
|
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
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
|