splitclient-rb 8.1.0-java → 8.1.1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.txt +5 -0
- data/LICENSE +1 -1
- data/lib/splitclient-rb/cache/adapters/redis_adapter.rb +1 -1
- data/lib/splitclient-rb/cache/senders/impressions_adapter/redis_sender.rb +13 -21
- data/lib/splitclient-rb/engine/auth_api_client.rb +9 -6
- data/lib/splitclient-rb/engine/back_off.rb +1 -1
- data/lib/splitclient-rb/engine/push_manager.rb +2 -3
- data/lib/splitclient-rb/engine/synchronizer.rb +7 -6
- data/lib/splitclient-rb/split_config.rb +1 -1
- data/lib/splitclient-rb/telemetry/domain/structs.rb +4 -3
- data/lib/splitclient-rb/telemetry/memory/memory_synchronizer.rb +2 -1
- data/lib/splitclient-rb/version.rb +1 -1
- data/splitclient-rb.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01cdc1656620b10e95e29e7a8c78030a288ab1ab
|
4
|
+
data.tar.gz: a7191857f7cecf0c80d6c4b30cbcafb55ea5cdc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 907c2a55092aa4dcd44ae8e07637a56150d28d779731c0da2860c6c903d577c805345c9fb6980233f11e664a22412176e1307ffbdff17aa4f74eb847c8f9673a
|
7
|
+
data.tar.gz: df92c8ee881b1d5edf5e74ba5ae2d0eff4052dbd80ecc6d93b63d5c1fa0925c31ec9b5eb7277b95d0f93c5823478897935a55e8d6d070a930149e90faabd41a6
|
data/CHANGES.txt
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
CHANGES
|
2
2
|
|
3
|
+
8.1.1 (Mar 17, 2023)
|
4
|
+
- Added retries with backoff when the sdk tries to connect to the Streaming service and it is not available.
|
5
|
+
- Updated the way that the sdk write mtks in redis.
|
6
|
+
- Fixed calculation of timeUntilReady in telemetry.
|
7
|
+
|
3
8
|
8.1.0 (Oct 5, 2022)
|
4
9
|
- Added a new impressions mode for the SDK called NONE , to be used in factory when there is no desire to capture impressions on an SDK factory to feed Split's analytics engine. Running NONE mode, the SDK will only capture unique keys evaluated for a particular feature flag instead of full blown impressions.
|
5
10
|
|
data/LICENSE
CHANGED
@@ -12,14 +12,11 @@ module SplitIoClient
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def record_uniques_key(uniques)
|
15
|
-
return if uniques.nil? || uniques
|
15
|
+
return if uniques.nil? || uniques.empty?
|
16
16
|
|
17
|
-
|
17
|
+
size = @adapter.add_to_queue(unique_keys_key, uniques_formatter(uniques))
|
18
18
|
|
19
|
-
|
20
|
-
size = @adapter.add_to_queue(unique_keys_key, formatted)
|
21
|
-
@adapter.expire(unique_keys_key, EXPIRE_SECONDS) if formatted.size == size
|
22
|
-
end
|
19
|
+
@adapter.expire(unique_keys_key, EXPIRE_SECONDS) if uniques.length == size
|
23
20
|
rescue StandardError => e
|
24
21
|
@config.log_found_exception(__method__.to_s, e)
|
25
22
|
end
|
@@ -47,29 +44,24 @@ module SplitIoClient
|
|
47
44
|
@adapter.expire(impressions_count_key, EXPIRE_SECONDS) if impressions_count.size == hlen && (pipeline_result.sum - hlen) == total_count
|
48
45
|
end
|
49
46
|
|
50
|
-
def impressions_count_key
|
51
|
-
"#{@config.redis_namespace}.impressions.count"
|
52
|
-
end
|
53
|
-
|
54
|
-
def unique_keys_key
|
55
|
-
"#{@config.redis_namespace}.uniquekeys"
|
56
|
-
end
|
57
|
-
|
58
47
|
def uniques_formatter(uniques)
|
59
|
-
return if uniques.nil? || uniques.empty?
|
60
|
-
|
61
48
|
to_return = []
|
62
49
|
uniques.each do |key, value|
|
63
50
|
to_return << {
|
64
51
|
f: key,
|
65
|
-
|
66
|
-
}
|
52
|
+
ks: value.to_a
|
53
|
+
}.to_json
|
67
54
|
end
|
68
55
|
|
69
56
|
to_return
|
70
|
-
|
71
|
-
|
72
|
-
|
57
|
+
end
|
58
|
+
|
59
|
+
def impressions_count_key
|
60
|
+
"#{@config.redis_namespace}.impressions.count"
|
61
|
+
end
|
62
|
+
|
63
|
+
def unique_keys_key
|
64
|
+
"#{@config.redis_namespace}.uniquekeys"
|
73
65
|
end
|
74
66
|
end
|
75
67
|
end
|
@@ -59,11 +59,7 @@ module SplitIoClient
|
|
59
59
|
|
60
60
|
def process_success(response, start)
|
61
61
|
@config.logger.debug("Success connection to: #{@config.auth_service_url}") if @config.debug_enabled
|
62
|
-
|
63
|
-
bucket = BinarySearchLatencyTracker.get_bucket((Time.now - start) * 1000.0)
|
64
|
-
@telemetry_runtime_producer.record_sync_latency(Telemetry::Domain::Constants::TOKEN_SYNC, bucket)
|
65
|
-
timestamp = (Time.now.to_f * 1000.0).to_i
|
66
|
-
@telemetry_runtime_producer.record_successful_sync(Telemetry::Domain::Constants::TOKEN_SYNC, timestamp)
|
62
|
+
record_telemetry(start)
|
67
63
|
|
68
64
|
body_json = JSON.parse(response.body, symbolize_names: true)
|
69
65
|
push_enabled = body_json[:pushEnabled]
|
@@ -77,7 +73,7 @@ module SplitIoClient
|
|
77
73
|
@telemetry_runtime_producer.record_token_refreshes
|
78
74
|
end
|
79
75
|
|
80
|
-
{ push_enabled: push_enabled, token: token, channels: channels, exp: exp, retry:
|
76
|
+
{ push_enabled: push_enabled, token: token, channels: channels, exp: exp, retry: true }
|
81
77
|
end
|
82
78
|
|
83
79
|
def control_channels(channels_string)
|
@@ -88,6 +84,13 @@ module SplitIoClient
|
|
88
84
|
|
89
85
|
channels_string.gsub(control_sec, "#{prefix}#{control_sec}")
|
90
86
|
end
|
87
|
+
|
88
|
+
def record_telemetry(start)
|
89
|
+
bucket = BinarySearchLatencyTracker.get_bucket((Time.now - start) * 1000.0)
|
90
|
+
@telemetry_runtime_producer.record_sync_latency(Telemetry::Domain::Constants::TOKEN_SYNC, bucket)
|
91
|
+
timestamp = (Time.now.to_f * 1000.0).to_i
|
92
|
+
@telemetry_runtime_producer.record_successful_sync(Telemetry::Domain::Constants::TOKEN_SYNC, timestamp)
|
93
|
+
end
|
91
94
|
end
|
92
95
|
end
|
93
96
|
end
|
@@ -14,7 +14,6 @@ module SplitIoClient
|
|
14
14
|
|
15
15
|
def start_sse
|
16
16
|
response = @auth_api_client.authenticate(@api_key)
|
17
|
-
|
18
17
|
@config.logger.debug("Auth service response push_enabled: #{response[:push_enabled]}") if @config.debug_enabled
|
19
18
|
|
20
19
|
if response[:push_enabled] && @sse_handler.start(response[:token], response[:channels])
|
@@ -26,7 +25,6 @@ module SplitIoClient
|
|
26
25
|
end
|
27
26
|
|
28
27
|
stop_sse
|
29
|
-
|
30
28
|
schedule_next_token_refresh(@back_off.interval) if response[:retry]
|
31
29
|
false
|
32
30
|
rescue StandardError => e
|
@@ -35,7 +33,8 @@ module SplitIoClient
|
|
35
33
|
|
36
34
|
def stop_sse
|
37
35
|
@sse_handler.stop
|
38
|
-
|
36
|
+
rescue StandardError => e
|
37
|
+
@config.logger.error(e.inspect)
|
39
38
|
end
|
40
39
|
|
41
40
|
private
|
@@ -6,8 +6,6 @@ module SplitIoClient
|
|
6
6
|
include SplitIoClient::Cache::Fetchers
|
7
7
|
include SplitIoClient::Cache::Senders
|
8
8
|
|
9
|
-
ON_DEMAND_FETCH_BACKOFF_BASE_SECONDS = 10
|
10
|
-
ON_DEMAND_FETCH_BACKOFF_MAX_WAIT_SECONDS = 60
|
11
9
|
ON_DEMAND_FETCH_BACKOFF_MAX_RETRIES = 10
|
12
10
|
|
13
11
|
def initialize(
|
@@ -27,6 +25,9 @@ module SplitIoClient
|
|
27
25
|
@telemetry_synchronizer = params[:telemetry_synchronizer]
|
28
26
|
@impressions_sender_adapter = params[:impressions_sender_adapter]
|
29
27
|
@unique_keys_tracker = params[:unique_keys_tracker]
|
28
|
+
|
29
|
+
@splits_sync_backoff = Engine::BackOff.new(10, 0, 60)
|
30
|
+
@segments_sync_backoff = Engine::BackOff.new(10, 0, 60)
|
30
31
|
end
|
31
32
|
|
32
33
|
def sync_all(asynchronous = true)
|
@@ -140,7 +141,7 @@ module SplitIoClient
|
|
140
141
|
|
141
142
|
def attempt_segment_sync(name, target_cn, fetch_options, max_retries, retry_delay_seconds, with_backoff)
|
142
143
|
remaining_attempts = max_retries
|
143
|
-
|
144
|
+
@segments_sync_backoff.reset
|
144
145
|
|
145
146
|
loop do
|
146
147
|
remaining_attempts -= 1
|
@@ -150,14 +151,14 @@ module SplitIoClient
|
|
150
151
|
return sync_result(true, remaining_attempts) if target_cn <= @segments_repository.get_change_number(name).to_i
|
151
152
|
return sync_result(false, remaining_attempts) if remaining_attempts <= 0
|
152
153
|
|
153
|
-
delay = with_backoff ?
|
154
|
+
delay = with_backoff ? @segments_sync_backoff.interval : retry_delay_seconds
|
154
155
|
sleep(delay)
|
155
156
|
end
|
156
157
|
end
|
157
158
|
|
158
159
|
def attempt_splits_sync(target_cn, fetch_options, max_retries, retry_delay_seconds, with_backoff)
|
159
160
|
remaining_attempts = max_retries
|
160
|
-
|
161
|
+
@splits_sync_backoff.reset
|
161
162
|
|
162
163
|
loop do
|
163
164
|
remaining_attempts -= 1
|
@@ -167,7 +168,7 @@ module SplitIoClient
|
|
167
168
|
return sync_result(true, remaining_attempts, result[:segment_names]) if target_cn <= @splits_repository.get_change_number
|
168
169
|
return sync_result(false, remaining_attempts, result[:segment_names]) if remaining_attempts <= 0
|
169
170
|
|
170
|
-
delay = with_backoff ?
|
171
|
+
delay = with_backoff ? @splits_sync_backoff.interval : retry_delay_seconds
|
171
172
|
sleep(delay)
|
172
173
|
end
|
173
174
|
end
|
@@ -117,7 +117,7 @@ module SplitIoClient
|
|
117
117
|
|
118
118
|
@counter_refresh_rate = SplitConfig.default_counter_refresh_rate(@cache_adapter)
|
119
119
|
|
120
|
-
@sdk_start_time = Time.now
|
120
|
+
@sdk_start_time = Time.now.to_f
|
121
121
|
|
122
122
|
@on_demand_fetch_retry_delay_seconds = SplitConfig.default_on_demand_fetch_retry_delay_seconds
|
123
123
|
@on_demand_fetch_max_retries = SplitConfig.default_on_demand_fetch_max_retries
|
@@ -13,9 +13,10 @@ module SplitIoClient
|
|
13
13
|
# s: sdkUrl, e: eventsUrl, a: authUrl, st: streamUrl, t: telemetryUrl
|
14
14
|
UrlOverrides = Struct.new(:s, :e, :a, :st, :t)
|
15
15
|
|
16
|
-
# om: operationMode,
|
17
|
-
#
|
18
|
-
#
|
16
|
+
# om: operationMode, st: storage, af: activeFactories, rf: redundantActiveFactories, t: tags, se: streamingEnabled,
|
17
|
+
# rr: refreshRate, uo: urlOverrides, iq: impressionsQueueSize, eq: eventsQueueSize, im: impressionsMode,
|
18
|
+
# il: impressionListenerEnabled, hp: httpProxyDetected, tr: timeUntilSdkReady, bt: burTimeouts,
|
19
|
+
# nr: sdkNotReadyUsage, i: integrations
|
19
20
|
ConfigInit = Struct.new(:om, :st, :af, :rf, :t, :se, :rr, :uo, :iq, :eq, :im, :il, :hp, :tr, :bt, :nr, :i)
|
20
21
|
|
21
22
|
# ls: lastSynchronization, ml: clientMethodLatencies, me: clientMethodExceptions, he: httpErros, hl: httpLatencies,
|
@@ -56,6 +56,7 @@ module SplitIoClient
|
|
56
56
|
|
57
57
|
active_factories ||= SplitIoClient.split_factory_registry.active_factories
|
58
58
|
redundant_active_factories ||= SplitIoClient.split_factory_registry.redundant_active_factories
|
59
|
+
time_until_ready ||= ((Time.now.to_f - @config.sdk_start_time) * 1000.0).to_i
|
59
60
|
|
60
61
|
init_config = ConfigInit.new(mode,
|
61
62
|
'memory',
|
@@ -70,7 +71,7 @@ module SplitIoClient
|
|
70
71
|
impressions_mode,
|
71
72
|
!@config.impression_listener.nil?,
|
72
73
|
http_proxy_detected?,
|
73
|
-
time_until_ready
|
74
|
+
time_until_ready,
|
74
75
|
@telemetry_init_consumer.bur_timeouts,
|
75
76
|
@telemetry_init_consumer.non_ready_usages)
|
76
77
|
|
data/splitclient-rb.gemspec
CHANGED
@@ -57,7 +57,7 @@ Gem::Specification.new do |spec|
|
|
57
57
|
spec.add_runtime_dependency 'jwt', '>= 1.0.0', '< 3.0'
|
58
58
|
spec.add_runtime_dependency 'lru_redux', '~> 1.1'
|
59
59
|
spec.add_runtime_dependency 'net-http-persistent', '>= 2.9', '< 5.0'
|
60
|
-
spec.add_runtime_dependency 'redis', '>= 4.0.0', '<
|
60
|
+
spec.add_runtime_dependency 'redis', '>= 4.0.0', '< 6.0'
|
61
61
|
spec.add_runtime_dependency 'socketry', '>= 0.4', '< 1.0'
|
62
62
|
spec.add_runtime_dependency 'thread_safe', '~> 0.3'
|
63
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: splitclient-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.1.
|
4
|
+
version: 8.1.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Split Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -342,7 +342,7 @@ dependencies:
|
|
342
342
|
version: 4.0.0
|
343
343
|
- - "<"
|
344
344
|
- !ruby/object:Gem::Version
|
345
|
-
version: '
|
345
|
+
version: '6.0'
|
346
346
|
name: redis
|
347
347
|
prerelease: false
|
348
348
|
type: :runtime
|
@@ -353,7 +353,7 @@ dependencies:
|
|
353
353
|
version: 4.0.0
|
354
354
|
- - "<"
|
355
355
|
- !ruby/object:Gem::Version
|
356
|
-
version: '
|
356
|
+
version: '6.0'
|
357
357
|
- !ruby/object:Gem::Dependency
|
358
358
|
requirement: !ruby/object:Gem::Requirement
|
359
359
|
requirements:
|