splitclient-rb 8.1.0 → 8.1.1.pre.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- 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 +6 -22
- 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 +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb58331fe788f44a387c77cd0afce468c915879e55c5920d4bf20b11273b41bd
|
4
|
+
data.tar.gz: a5b310fe842ad026159aa6c8a16688cac72e73bb69188599da619e17d1a0a183
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41b224700eea9145c2510771edb30d8db6c75c1591b5095ee6c7636d4342b9600d63bd4435aab90c350ed899eda2f3865ac9965dd738c8dbca8fb70731a45e14
|
7
|
+
data.tar.gz: 984ee7cc0b3d3994ae6b050c837717d40d6c1d2fc7587f22ee28b9f6ef09947427ab6b1e4e588dfe14a62c4eea2c940d74ae7a7d4f2191bba1ada5c3718e4bfa
|
data/LICENSE
CHANGED
@@ -14,12 +14,13 @@ module SplitIoClient
|
|
14
14
|
def record_uniques_key(uniques)
|
15
15
|
return if uniques.nil? || uniques == {}
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
@adapter.expire(unique_keys_key, EXPIRE_SECONDS) if formatted.size == size
|
17
|
+
size = @adapter.redis.pipelined do |pipeline|
|
18
|
+
uniques.each do |key, value|
|
19
|
+
pipeline.rpush(unique_keys_key, { f: key, ks: value.to_a }.to_json)
|
20
|
+
end
|
22
21
|
end
|
22
|
+
|
23
|
+
@adapter.expire(unique_keys_key, EXPIRE_SECONDS) if uniques.length == size.last
|
23
24
|
rescue StandardError => e
|
24
25
|
@config.log_found_exception(__method__.to_s, e)
|
25
26
|
end
|
@@ -54,23 +55,6 @@ module SplitIoClient
|
|
54
55
|
def unique_keys_key
|
55
56
|
"#{@config.redis_namespace}.uniquekeys"
|
56
57
|
end
|
57
|
-
|
58
|
-
def uniques_formatter(uniques)
|
59
|
-
return if uniques.nil? || uniques.empty?
|
60
|
-
|
61
|
-
to_return = []
|
62
|
-
uniques.each do |key, value|
|
63
|
-
to_return << {
|
64
|
-
f: key,
|
65
|
-
k: value.to_a
|
66
|
-
}
|
67
|
-
end
|
68
|
-
|
69
|
-
to_return
|
70
|
-
rescue StandardError => e
|
71
|
-
@config.log_found_exception(__method__.to_s, e)
|
72
|
-
nil
|
73
|
-
end
|
74
58
|
end
|
75
59
|
end
|
76
60
|
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.pre.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Split Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: allocation_stats
|
@@ -343,7 +343,7 @@ dependencies:
|
|
343
343
|
version: 4.0.0
|
344
344
|
- - "<"
|
345
345
|
- !ruby/object:Gem::Version
|
346
|
-
version: '
|
346
|
+
version: '6.0'
|
347
347
|
type: :runtime
|
348
348
|
prerelease: false
|
349
349
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -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
|
name: socketry
|
359
359
|
requirement: !ruby/object:Gem::Requirement
|
@@ -561,9 +561,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
561
561
|
version: 2.5.0
|
562
562
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
563
563
|
requirements:
|
564
|
-
- - "
|
564
|
+
- - ">"
|
565
565
|
- !ruby/object:Gem::Version
|
566
|
-
version:
|
566
|
+
version: 1.3.1
|
567
567
|
requirements: []
|
568
568
|
rubygems_version: 3.2.3
|
569
569
|
signing_key:
|