statsig 2.9.5 → 2.9.6
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/lib/network.rb +2 -2
- data/lib/spec_store.rb +25 -7
- data/lib/statsig.rb +1 -1
- data/lib/statsig_options.rb +10 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '0652683b8a04c0258b6d37d076ac8ae2d44523fdb52d042d992dcc948693e1e7'
|
|
4
|
+
data.tar.gz: c7fd0cf211bcfdb60164f988109ee155f18dd534f6b8e97c767b9a1d68cfd3f9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 295de37f1befbfe8e627a2d70e34597dae27791b4850433ab61295120fb15aefd4cfee1f311872ee183254364cbcf8c10746eddd878db24459470ed9654f4be6
|
|
7
|
+
data.tar.gz: d84fa2839e8a55e1b029d932b30c381172dd75190380d37b6750d7716593bb5dc9ea849ebbb94b3c58c237daffe4718f7987bbfdb2a2e9054d6f64d62eb2743c
|
data/lib/network.rb
CHANGED
|
@@ -53,8 +53,8 @@ module Statsig
|
|
|
53
53
|
get(dcs_url, CONFIG_SYNC_RETRY_LIMIT, CONFIG_SYNC_RETRY_BACKOFF_SECONDS, CONFIG_SYNC_RETRY_BACKOFF_MULTIPLIER)
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
def download_config_specs_fallback(since_time, context)
|
|
57
|
-
dcs_url = "#{
|
|
56
|
+
def download_config_specs_fallback(base_url, since_time, context)
|
|
57
|
+
dcs_url = "#{base_url}#{@server_secret}.json"
|
|
58
58
|
if since_time.positive?
|
|
59
59
|
dcs_url += "?sinceTime=#{since_time}"
|
|
60
60
|
end
|
data/lib/spec_store.rb
CHANGED
|
@@ -87,8 +87,8 @@ module Statsig
|
|
|
87
87
|
|
|
88
88
|
if @init_reason == EvaluationReason::UNINITIALIZED
|
|
89
89
|
failure_details = download_config_specs('initialize')
|
|
90
|
-
if !failure_details.nil?
|
|
91
|
-
failure_details =
|
|
90
|
+
if !failure_details.nil?
|
|
91
|
+
failure_details = download_config_specs_fallbacks('initialize', failure_details)
|
|
92
92
|
end
|
|
93
93
|
end
|
|
94
94
|
|
|
@@ -220,8 +220,8 @@ module Statsig
|
|
|
220
220
|
@sync_failure_count = 0
|
|
221
221
|
else
|
|
222
222
|
@sync_failure_count += 1
|
|
223
|
-
if @
|
|
224
|
-
|
|
223
|
+
if @sync_failure_count % STATSIG_NETWORK_FALLBACK_THRESHOLD == 0
|
|
224
|
+
download_config_specs_fallbacks('config_sync', failure_details)
|
|
225
225
|
end
|
|
226
226
|
end
|
|
227
227
|
|
|
@@ -243,9 +243,27 @@ module Statsig
|
|
|
243
243
|
!@options.download_config_specs_url.start_with?(STATSIG_CDN_DCS_BASE)
|
|
244
244
|
end
|
|
245
245
|
|
|
246
|
-
def
|
|
247
|
-
|
|
248
|
-
|
|
246
|
+
def fallback_urls
|
|
247
|
+
configured = @options.download_config_specs_fallback_urls
|
|
248
|
+
if configured.nil?
|
|
249
|
+
return [] unless @options.fallback_to_statsig_api && using_proxy_for_dcs?
|
|
250
|
+
configured = ["#{STATSIG_CDN_DCS_BASE}/download_config_specs/"]
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
primary = @options.download_config_specs_url
|
|
254
|
+
primary = "#{primary}/" unless primary.end_with?('/')
|
|
255
|
+
configured.map { |url| url.end_with?('/') ? url : "#{url}/" }
|
|
256
|
+
.reject { |url| url == primary }
|
|
257
|
+
.uniq
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
def download_config_specs_fallbacks(context, failure_details)
|
|
261
|
+
fallback_urls.each do |base_url|
|
|
262
|
+
response, e = @network.download_config_specs_fallback(base_url, @last_config_sync_time, context)
|
|
263
|
+
failure_details = handle_config_specs_response(context, 'download_config_specs_fallback', 'CONFIG_SPECS_FALLBACK', response, e)
|
|
264
|
+
break if failure_details.nil?
|
|
265
|
+
end
|
|
266
|
+
failure_details
|
|
249
267
|
end
|
|
250
268
|
|
|
251
269
|
def handle_config_specs_response(context, diagnostic_key, error_prefix, response, e)
|
data/lib/statsig.rb
CHANGED
data/lib/statsig_options.rb
CHANGED
|
@@ -13,6 +13,11 @@ class StatsigOptions
|
|
|
13
13
|
# The url used specifically to call download_config_specs.
|
|
14
14
|
attr_accessor :download_config_specs_url
|
|
15
15
|
|
|
16
|
+
# Ordered full download_config_specs endpoint bases to try after the primary fails.
|
|
17
|
+
# nil preserves fallback_to_statsig_api behavior; [] disables fallback. An explicit
|
|
18
|
+
# list takes precedence over fallback_to_statsig_api, including when it is false.
|
|
19
|
+
attr_accessor :download_config_specs_fallback_urls
|
|
20
|
+
|
|
16
21
|
# The url used specifically to call log_event.
|
|
17
22
|
attr_accessor :log_event_url
|
|
18
23
|
|
|
@@ -127,7 +132,8 @@ class StatsigOptions
|
|
|
127
132
|
user_persistent_storage: nil,
|
|
128
133
|
disable_evaluation_memoization: false,
|
|
129
134
|
initialize_retry_limit: 0,
|
|
130
|
-
fallback_to_statsig_api: false
|
|
135
|
+
fallback_to_statsig_api: false,
|
|
136
|
+
download_config_specs_fallback_urls: nil
|
|
131
137
|
)
|
|
132
138
|
@environment = environment.is_a?(Hash) ? environment : nil
|
|
133
139
|
|
|
@@ -136,6 +142,9 @@ class StatsigOptions
|
|
|
136
142
|
dcs_url += '/'
|
|
137
143
|
end
|
|
138
144
|
@download_config_specs_url = dcs_url
|
|
145
|
+
@download_config_specs_fallback_urls = download_config_specs_fallback_urls&.map do |url|
|
|
146
|
+
url.end_with?('/') ? url : "#{url}/"
|
|
147
|
+
end
|
|
139
148
|
|
|
140
149
|
@log_event_url = log_event_url || 'https://statsigapi.net/v1/log_event'
|
|
141
150
|
@get_id_lists_url = get_id_lists_url || 'https://statsigapi.net/v1/get_id_lists'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: statsig
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.9.
|
|
4
|
+
version: 2.9.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Statsig, Inc
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|