featurehub-sdk 2.0.0 → 2.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/CHANGELOG.md +5 -0
- data/Gemfile.lock +2 -2
- data/lib/feature_hub/sdk/feature_hub_config.rb +1 -1
- data/lib/feature_hub/sdk/feature_repository.rb +6 -6
- data/lib/feature_hub/sdk/local_yaml_interceptor.rb +3 -3
- data/lib/feature_hub/sdk/poll_edge_service.rb +6 -6
- data/lib/feature_hub/sdk/redis_session_store.rb +2 -2
- data/lib/feature_hub/sdk/streaming_edge_service.rb +2 -2
- data/lib/feature_hub/sdk/version.rb +1 -10
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bc48d48647d7b4aee1a53a733506382f3e6cb021de19ae9c7192a38ff3af38a9
|
|
4
|
+
data.tar.gz: 499b54873a2cbb87e72dcb815509a8260f12ec0ffa6a4b529ac779acad7c4729
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1f3620cf2da86a7a897efae7c766b00eaf98549c9c9b90dee97f14c67c9d32718cdf4046accfdd887622b80bb44943704fda18acfa179ed90b801c9938bd2130
|
|
7
|
+
data.tar.gz: f31beae7e13e8261b541ffc211a3a8dad8c49563918d12e178f9390b4d079bcd303d8273f5741986bc1907d12d7e646bf0f62c553527ed87ee83ca77834c1f42
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## [2.0.1] - 2026-03-27
|
|
2
|
+
|
|
3
|
+
- Remove `FeatureHub::Sdk.default_logger`; logger now defaults to `nil` instead of a stdout DEBUG logger
|
|
4
|
+
- Replace all `logger.` calls with `logger&.` so a nil logger is silently ignored
|
|
5
|
+
|
|
1
6
|
## [2.0.0] - 2026-03-22
|
|
2
7
|
|
|
3
8
|
- Refactor FeatureState to FeatureStateHolder to be consistent with other SDKs
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
featurehub-sdk (2.0.
|
|
4
|
+
featurehub-sdk (2.0.1)
|
|
5
5
|
concurrent-ruby (~> 1.3)
|
|
6
6
|
faraday (~> 2)
|
|
7
7
|
ld-eventsource (~> 2.5.1)
|
|
@@ -134,7 +134,7 @@ CHECKSUMS
|
|
|
134
134
|
domain_name (0.6.20240107) sha256=5f693b2215708476517479bf2b3802e49068ad82167bcd2286f899536a17d933
|
|
135
135
|
faraday (2.14.0) sha256=8699cfe5d97e55268f2596f9a9d5a43736808a943714e3d9a53e6110593941cd
|
|
136
136
|
faraday-net_http (3.4.2) sha256=f147758260d3526939bf57ecf911682f94926a3666502e24c69992765875906c
|
|
137
|
-
featurehub-sdk (2.0.
|
|
137
|
+
featurehub-sdk (2.0.1)
|
|
138
138
|
ffi (1.17.3-arm64-darwin) sha256=0c690555d4cee17a7f07c04d59df39b2fba74ec440b19da1f685c6579bb0717f
|
|
139
139
|
ffi (1.17.3-x86_64-darwin) sha256=1f211811eb5cfaa25998322cdd92ab104bfbd26d1c4c08471599c511f2c00bb5
|
|
140
140
|
ffi (1.17.3-x86_64-linux-gnu) sha256=3746b01f677aae7b16dc1acb7cb3cc17b3e35bdae7676a3f568153fb0e2c887f
|
|
@@ -28,7 +28,7 @@ module FeatureHub
|
|
|
28
28
|
attr_reader :edge_url, :api_keys, :client_evaluated, :logger
|
|
29
29
|
|
|
30
30
|
def initialize(edge_url = nil, api_keys = nil, repository = nil, edge_provider = nil, logger = nil) # rubocop:disable Metrics/ParameterLists
|
|
31
|
-
@logger = logger
|
|
31
|
+
@logger = logger
|
|
32
32
|
@repository = repository || FeatureHub::Sdk::FeatureHubRepository.new(nil, @logger)
|
|
33
33
|
|
|
34
34
|
resolved_url = resolve_edge_url(edge_url)
|
|
@@ -15,7 +15,7 @@ module FeatureHub
|
|
|
15
15
|
@raw_listeners = []
|
|
16
16
|
@features = {}
|
|
17
17
|
@ready = false
|
|
18
|
-
@logger = logger
|
|
18
|
+
@logger = logger
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def apply(strategies, key, feature_id, context)
|
|
@@ -35,24 +35,24 @@ module FeatureHub
|
|
|
35
35
|
case status.to_sym
|
|
36
36
|
when :features
|
|
37
37
|
update_features(data)
|
|
38
|
-
@logger
|
|
38
|
+
@logger&.debug("[featurehubsdk] became ready through updates from #{source}") unless @ready
|
|
39
39
|
@ready = true
|
|
40
40
|
notify_raw_listeners_async { |l| l.process_updates(data, source) }
|
|
41
|
-
@logger
|
|
41
|
+
@logger&.debug("[featurehubsdk] full updates from #{source} are #{data}")
|
|
42
42
|
when :feature
|
|
43
43
|
return if data.nil? || data["key"].nil?
|
|
44
44
|
|
|
45
45
|
update_feature(data)
|
|
46
|
-
@logger
|
|
46
|
+
@logger&.debug("[featurehubsdk] became ready through updates from #{source}") unless @ready
|
|
47
47
|
@ready = true
|
|
48
48
|
notify_raw_listeners_async { |l| l.process_update(data, source) }
|
|
49
|
-
@logger
|
|
49
|
+
@logger&.debug("[featurehubsdk] single feature update from #{source} are #{data}")
|
|
50
50
|
when :delete_feature
|
|
51
51
|
return unless data && data["key"]
|
|
52
52
|
|
|
53
53
|
delete_feature(data)
|
|
54
54
|
notify_raw_listeners_async { |l| l.delete_feature(data, source) }
|
|
55
|
-
@logger
|
|
55
|
+
@logger&.debug("[featurehubsdk] delete from #{source} are #{data}")
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -18,10 +18,10 @@ module FeatureHub
|
|
|
18
18
|
super()
|
|
19
19
|
opts ||= {}
|
|
20
20
|
@yaml_file = opts[:filename] || ENV.fetch("FEATUREHUB_LOCAL_YAML", "featurehub-features.yaml")
|
|
21
|
-
@logger = opts[:logger]
|
|
21
|
+
@logger = opts[:logger]
|
|
22
22
|
@mutex = Mutex.new
|
|
23
23
|
@flag_values = load_flag_values(@yaml_file)
|
|
24
|
-
@logger
|
|
24
|
+
@logger&.debug("[featurehubsdk] loaded #{@flag_values.size} feature override(s) from #{@yaml_file}")
|
|
25
25
|
@watcher = nil
|
|
26
26
|
|
|
27
27
|
return unless opts[:watch]
|
|
@@ -63,7 +63,7 @@ module FeatureHub
|
|
|
63
63
|
|
|
64
64
|
@last_mtime = current_mtime
|
|
65
65
|
new_values = load_flag_values(@yaml_file)
|
|
66
|
-
@logger
|
|
66
|
+
@logger&.debug("[featurehubsdk] reloaded #{new_values.size} feature override(s) from #{@yaml_file}")
|
|
67
67
|
@mutex.synchronize { @flag_values = new_values }
|
|
68
68
|
end
|
|
69
69
|
|
|
@@ -13,7 +13,7 @@ module FeatureHub
|
|
|
13
13
|
attr_reader :api_keys, :edge_url, :interval, :stopped, :etag, :cancel, :sha_context
|
|
14
14
|
|
|
15
15
|
def initialize(repository, api_keys, edge_url, interval, logger = nil)
|
|
16
|
-
super(repository, api_keys, edge_url, logger
|
|
16
|
+
super(repository, api_keys, edge_url, logger)
|
|
17
17
|
|
|
18
18
|
@interval = interval
|
|
19
19
|
|
|
@@ -68,7 +68,7 @@ module FeatureHub
|
|
|
68
68
|
def poll_with_interval
|
|
69
69
|
return if @cancel || !@task.nil? || @stopped
|
|
70
70
|
|
|
71
|
-
@logger
|
|
71
|
+
@logger&.debug("starting polling for #{determine_request_url}")
|
|
72
72
|
@task = Concurrent::TimerTask.new(execution_interval: @interval, run_now: false) do
|
|
73
73
|
get_updates
|
|
74
74
|
end
|
|
@@ -107,7 +107,7 @@ module FeatureHub
|
|
|
107
107
|
headers["x-featurehub"] = @context unless @context.nil?
|
|
108
108
|
headers["if-none-match"] = @etag unless @etag.nil?
|
|
109
109
|
|
|
110
|
-
@logger
|
|
110
|
+
@logger&.debug("polling for #{url}")
|
|
111
111
|
resp = @conn.get url, {}, headers
|
|
112
112
|
case resp.status
|
|
113
113
|
when 200
|
|
@@ -118,11 +118,11 @@ module FeatureHub
|
|
|
118
118
|
when 404, 400 # no such key
|
|
119
119
|
@repository.notify("failed", nil, "polling")
|
|
120
120
|
cancel_task
|
|
121
|
-
@logger
|
|
121
|
+
@logger&.error("featurehub: key does not exist, stopping polling")
|
|
122
122
|
when 503 # dacha busy
|
|
123
|
-
@logger
|
|
123
|
+
@logger&.debug("featurehub: dacha is busy, trying again")
|
|
124
124
|
else
|
|
125
|
-
@logger
|
|
125
|
+
@logger&.debug("featurehub: unknown error #{resp.status}") if resp.status != 304
|
|
126
126
|
end
|
|
127
127
|
end
|
|
128
128
|
|
|
@@ -34,7 +34,7 @@ module FeatureHub
|
|
|
34
34
|
@timeout = opts[:timeout] || 30
|
|
35
35
|
@namespace = opts[:namespace] || 0
|
|
36
36
|
@password = opts[:password]
|
|
37
|
-
@logger = opts[:logger]
|
|
37
|
+
@logger = opts[:logger]
|
|
38
38
|
@task = nil
|
|
39
39
|
|
|
40
40
|
return unless redis_available?
|
|
@@ -94,7 +94,7 @@ module FeatureHub
|
|
|
94
94
|
|
|
95
95
|
return if features.empty?
|
|
96
96
|
|
|
97
|
-
@logger
|
|
97
|
+
@logger&.debug("[featurehubsdk] loading #{features.size} feature(s) from redis")
|
|
98
98
|
@repository.notify("features", features, SOURCE)
|
|
99
99
|
end
|
|
100
100
|
|
|
@@ -10,7 +10,7 @@ module FeatureHub
|
|
|
10
10
|
attr_reader :sse_client, :url, :stopped
|
|
11
11
|
|
|
12
12
|
def initialize(repository, api_keys, edge_url, logger = nil)
|
|
13
|
-
super(repository, api_keys, edge_url, logger
|
|
13
|
+
super(repository, api_keys, edge_url, logger)
|
|
14
14
|
|
|
15
15
|
@url = "#{edge_url}features/#{api_keys[0]}"
|
|
16
16
|
@sse_client = nil
|
|
@@ -56,7 +56,7 @@ module FeatureHub
|
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
def start_streaming
|
|
59
|
-
@logger
|
|
59
|
+
@logger&.debug("streaming from #{@url}")
|
|
60
60
|
# we can get an error before returning the new() function and get a race condition on the close
|
|
61
61
|
must_close = false
|
|
62
62
|
@sse_client = SSE::Client.new(@url) do |client|
|
|
@@ -3,15 +3,6 @@
|
|
|
3
3
|
module FeatureHub
|
|
4
4
|
# already documented elsewhere
|
|
5
5
|
module Sdk
|
|
6
|
-
VERSION = "2.0.
|
|
7
|
-
|
|
8
|
-
def default_logger
|
|
9
|
-
log = ::Logger.new($stdout)
|
|
10
|
-
log.level = ::Logger::DEBUG
|
|
11
|
-
log.progname = "featurehub-sdk"
|
|
12
|
-
log
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
module_function :default_logger
|
|
6
|
+
VERSION = "2.0.1"
|
|
16
7
|
end
|
|
17
8
|
end
|