prefab-cloud-ruby 1.8.8.pre.1 → 1.8.9
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/pull_request_template.md +8 -0
- data/.github/workflows/ruby.yml +1 -1
- data/.tool-versions +1 -1
- data/CHANGELOG.md +94 -81
- data/VERSION +1 -1
- data/compile_protos.sh +4 -2
- data/lib/prefab/caching_http_connection.rb +95 -0
- data/lib/prefab/config_client.rb +7 -8
- data/lib/prefab/context.rb +1 -8
- data/lib/prefab/criteria_evaluator.rb +182 -9
- data/lib/prefab/fixed_size_hash.rb +14 -0
- data/lib/prefab/http_connection.rb +10 -6
- data/lib/prefab/semver.rb +132 -0
- data/lib/prefab-cloud-ruby.rb +3 -0
- data/lib/prefab_pb.rb +4 -23
- data/prefab-cloud-ruby.gemspec +27 -39
- data/test/support/common_helpers.rb +17 -13
- data/test/test_caching_http_connection.rb +218 -0
- data/test/test_context.rb +0 -15
- data/test/test_context_shape.rb +1 -1
- data/test/test_criteria_evaluator.rb +333 -0
- data/test/test_evaluation_summary_aggregator.rb +69 -69
- data/test/test_fixed_size_hash.rb +119 -0
- data/test/test_semver.rb +108 -0
- metadata +12 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d367fac3af817df60008ab3c698329f6eafb48903524b834ad23caf91c35ee57
|
4
|
+
data.tar.gz: ff9a6a62b7dfc16765582d2e9198eee72e80b83da1968de8c5138ce865180ecc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6f678df72fc31514aa9f259da3fbffacc910974dab7abb1c2ccaa09929add8dba10746a421130ab3a2cc01ffc8c75695eb102d7e8cace0aa32d42266d449c37
|
7
|
+
data.tar.gz: 98f92995deb4c40c7f6abf820654576d48d39a825e7d0b9e3bbd9d7a5bde23e692559ed603054f3e72cec7c9b3c75b8d9ecb47976fe0e0e51165cf298b288ffc
|
@@ -0,0 +1,8 @@
|
|
1
|
+
## Description
|
2
|
+
*(Brief overview of what this PR changes and/or why the changes are needed)*
|
3
|
+
|
4
|
+
## Testing & Validation
|
5
|
+
*(Outline the steps needed to be taken to verify the changes.)*
|
6
|
+
|
7
|
+
## Rollout
|
8
|
+
*(Optional section: Provide rollout and rollback procedures, when outside the bounds or requiring additional work beyond standard deployment)*
|
data/.github/workflows/ruby.yml
CHANGED
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 3.
|
1
|
+
ruby 3.2.7
|
data/CHANGELOG.md
CHANGED
@@ -1,78 +1,91 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.8.9 - 2025-04-15
|
4
|
+
|
5
|
+
- Fix support for virtual context `prefab.current-time` [#229]
|
6
|
+
|
7
|
+
## 1.8.8 - 2025-02-28
|
8
|
+
|
9
|
+
- Add conditional fetch support for configurations [#226]
|
10
|
+
- Operator support for string starts with, contains [#212]
|
11
|
+
- Operator support for regex, semver (protobuf update) [#215]
|
12
|
+
- Operator support for date comparison (before/after) [#221]
|
13
|
+
- Operator support for numeric comparisons [#220]
|
14
|
+
|
15
|
+
|
3
16
|
## 1.8.7 - 2024-10-25
|
4
17
|
|
5
|
-
- Add option symbolize_json_names
|
18
|
+
- Add option symbolize_json_names [#211]
|
6
19
|
|
7
20
|
|
8
21
|
## 1.8.6 - 2024-10-07
|
9
22
|
|
10
|
-
- Fix deprecation warning caused by x_datafile being set by default
|
23
|
+
- Fix deprecation warning caused by x_datafile being set by default [#208]
|
11
24
|
|
12
25
|
## 1.8.5 - 2024-09-27
|
13
26
|
|
14
|
-
- Fix JS bootstrapping and improve performance
|
15
|
-
- Promote `datafile` from `x_datafile`
|
27
|
+
- Fix JS bootstrapping and improve performance [#206]
|
28
|
+
- Promote `datafile` from `x_datafile` [#205]
|
16
29
|
|
17
30
|
## 1.8.4 - 2024-09-19
|
18
31
|
|
19
|
-
- Use `stream` subdomain for SSE
|
32
|
+
- Use `stream` subdomain for SSE [#203]
|
20
33
|
|
21
34
|
## 1.8.3 - 2024-09-16
|
22
35
|
|
23
|
-
- Add JavaScript stub & bootstrapping
|
36
|
+
- Add JavaScript stub & bootstrapping [#200]
|
24
37
|
|
25
38
|
## 1.8.2 - 2024-09-03
|
26
39
|
|
27
|
-
- Forbid bad semantic_logger version
|
40
|
+
- Forbid bad semantic_logger version [#198]
|
28
41
|
|
29
42
|
## 1.8.1 - 2024-09-03
|
30
43
|
|
31
|
-
- Fix SSE reconnection bug
|
44
|
+
- Fix SSE reconnection bug [#197]
|
32
45
|
|
33
46
|
## 1.8.0 - 2024-08-22
|
34
47
|
|
35
|
-
- Load config from belt and failover to suspenders
|
48
|
+
- Load config from belt and failover to suspenders [#195]
|
36
49
|
|
37
50
|
## 1.7.2 - 2024-06-24
|
38
51
|
|
39
|
-
- Support JSON config values
|
52
|
+
- Support JSON config values [#194]
|
40
53
|
|
41
54
|
## 1.7.1 - 2024-04-11
|
42
55
|
|
43
|
-
- Ergonomics
|
56
|
+
- Ergonomics [#191]
|
44
57
|
|
45
58
|
## 1.7.0 - 2024-04-10
|
46
59
|
|
47
|
-
- Add duration support
|
60
|
+
- Add duration support [#187]
|
48
61
|
|
49
62
|
## 1.6.2 - 2024-03-29
|
50
63
|
|
51
|
-
- Fix context telemetry when JIT and Block contexts are combined
|
52
|
-
- Remove logger prefix
|
64
|
+
- Fix context telemetry when JIT and Block contexts are combined [#185]
|
65
|
+
- Remove logger prefix [#186]
|
53
66
|
|
54
67
|
## 1.6.1 - 2024-03-28
|
55
68
|
|
56
|
-
- Performance optimizations
|
57
|
-
- Global context
|
69
|
+
- Performance optimizations [#178]
|
70
|
+
- Global context [#182]
|
58
71
|
|
59
72
|
## 1.6.0 - 2024-03-27
|
60
73
|
|
61
|
-
- Use semantic_logger for internal logging
|
62
|
-
- Remove Prefab::LoggerClient as a logger for end users
|
63
|
-
- Provide log_filter for end users
|
74
|
+
- Use semantic_logger for internal logging [#173]
|
75
|
+
- Remove Prefab::LoggerClient as a logger for end users [#173]
|
76
|
+
- Provide log_filter for end users [#173]
|
64
77
|
|
65
78
|
## 1.5.1 - 2024-02-22
|
66
79
|
|
67
|
-
- Fix: Send context shapes by default
|
80
|
+
- Fix: Send context shapes by default [#174]
|
68
81
|
|
69
82
|
## 1.5.0 - 2024-02-12
|
70
83
|
|
71
|
-
- Fix potential inconsistent Context behavior
|
84
|
+
- Fix potential inconsistent Context behavior [#172]
|
72
85
|
|
73
86
|
## 1.4.5 - 2024-01-31
|
74
87
|
|
75
|
-
- Refactor out a `should_log?` method
|
88
|
+
- Refactor out a `should_log?` method [#170]
|
76
89
|
|
77
90
|
## 1.4.4 - 2024-01-26
|
78
91
|
|
@@ -84,152 +97,152 @@
|
|
84
97
|
|
85
98
|
## 1.4.2 - 2023-12-14
|
86
99
|
|
87
|
-
- Use reportable value even for invalid data
|
100
|
+
- Use reportable value even for invalid data [#166]
|
88
101
|
|
89
102
|
## 1.4.1 - 2023-12-08
|
90
103
|
|
91
|
-
- Include version in `get` request
|
104
|
+
- Include version in `get` request [#165]
|
92
105
|
|
93
106
|
## 1.4.0 - 2023-11-28
|
94
107
|
|
95
|
-
- ActiveJob tagged logger issue
|
96
|
-
- Compact Log Format
|
97
|
-
- Tagged Logging
|
98
|
-
- ContextKey logging thread safety
|
108
|
+
- ActiveJob tagged logger issue [#164]
|
109
|
+
- Compact Log Format [#163]
|
110
|
+
- Tagged Logging [#161]
|
111
|
+
- ContextKey logging thread safety [#162]
|
99
112
|
|
100
113
|
## 1.3.2 - 2023-11-15
|
101
114
|
|
102
|
-
- Send back cloud.prefab logging telemetry
|
115
|
+
- Send back cloud.prefab logging telemetry [#160]
|
103
116
|
|
104
117
|
## 1.3.1 - 2023-11-14
|
105
118
|
|
106
|
-
- Improve path of rails.controller logging & fix strong param include
|
119
|
+
- Improve path of rails.controller logging & fix strong param include [#159]
|
107
120
|
|
108
121
|
## 1.3.0 - 2023-11-13
|
109
122
|
|
110
|
-
- Less logging when wifi is off and we load from cache
|
111
|
-
- Alpha: Add Provided & Secret Support
|
112
|
-
- Alpha: x_datafile
|
113
|
-
- Add single line action-controller output under rails.controller
|
123
|
+
- Less logging when wifi is off and we load from cache [#157]
|
124
|
+
- Alpha: Add Provided & Secret Support [#152]
|
125
|
+
- Alpha: x_datafile [#156]
|
126
|
+
- Add single line action-controller output under rails.controller [#158]
|
114
127
|
|
115
128
|
## 1.2.1 - 2023-11-01
|
116
129
|
|
117
|
-
- Update protobuf definitions
|
130
|
+
- Update protobuf definitions [#154]
|
118
131
|
|
119
132
|
## 1.2.0 - 2023-10-30
|
120
133
|
|
121
|
-
- Add `Prefab.get('key')` style usage after a `Prefab.init()` call
|
122
|
-
- Add `add_context_keys` and `with_context_keys` method for LoggerClient
|
134
|
+
- Add `Prefab.get('key')` style usage after a `Prefab.init()` call [#151]
|
135
|
+
- Add `add_context_keys` and `with_context_keys` method for LoggerClient [#145]
|
123
136
|
|
124
137
|
## 1.1.2 - 2023-10-13
|
125
138
|
|
126
|
-
- Add `cloud.prefab.client.criteria_evaluator` `debug` logging of evaluations
|
127
|
-
- Add `x_use_local_cache` for local caching
|
128
|
-
- Tests run in RubyMine
|
139
|
+
- Add `cloud.prefab.client.criteria_evaluator` `debug` logging of evaluations [#150]
|
140
|
+
- Add `x_use_local_cache` for local caching [#148]
|
141
|
+
- Tests run in RubyMine [#147]
|
129
142
|
|
130
143
|
## 1.1.1 - 2023-10-11
|
131
144
|
|
132
|
-
- Migrate happy-path client-initialization logging to `DEBUG` level rather than `INFO`
|
133
|
-
- Add `ConfigClientPresenter` for logging out stats upon successful client initialization
|
134
|
-
- Add support for default context
|
145
|
+
- Migrate happy-path client-initialization logging to `DEBUG` level rather than `INFO` [#144]
|
146
|
+
- Add `ConfigClientPresenter` for logging out stats upon successful client initialization [#144]
|
147
|
+
- Add support for default context [#146]
|
135
148
|
|
136
149
|
## 1.1.0 - 2023-09-18
|
137
150
|
|
138
|
-
- Add support for structured logging
|
151
|
+
- Add support for structured logging [#143]
|
139
152
|
- Ability to pass a hash of key/value context pairs to any of the user-facing log methods
|
140
153
|
|
141
154
|
## 1.0.1 - 2023-08-17
|
142
155
|
|
143
|
-
- Bug fix for StringList w/ ExampleContextsAggregator
|
156
|
+
- Bug fix for StringList w/ ExampleContextsAggregator [#141]
|
144
157
|
|
145
158
|
## 1.0.0 - 2023-08-10
|
146
159
|
|
147
|
-
- Removed EvaluatedKeysAggregator
|
148
|
-
- Change `collect_evaluation_summaries` default to true
|
149
|
-
- Removed some backwards compatibility shims
|
150
|
-
- Standardizing options
|
160
|
+
- Removed EvaluatedKeysAggregator [#137]
|
161
|
+
- Change `collect_evaluation_summaries` default to true [#136]
|
162
|
+
- Removed some backwards compatibility shims [#133]
|
163
|
+
- Standardizing options [#132]
|
151
164
|
- Note that the default value for `context_upload_mode` is `:periodic_example` which means example contexts will be collected.
|
152
165
|
This enables easy variant override assignment in our UI. More at https://prefab.cloud/blog/feature-flag-variant-assignment/
|
153
166
|
|
154
167
|
## 0.24.6 - 2023-07-31
|
155
168
|
|
156
|
-
- Logger Client compatibility
|
157
|
-
- Replace EvaluatedConfigs with ExampleContexts
|
158
|
-
- Add ConfigEvaluationSummaries (opt-in for now)
|
169
|
+
- Logger Client compatibility [#129]
|
170
|
+
- Replace EvaluatedConfigs with ExampleContexts [#128]
|
171
|
+
- Add ConfigEvaluationSummaries (opt-in for now) [#123]
|
159
172
|
|
160
173
|
## 0.24.5 - 2023-07-10
|
161
174
|
|
162
|
-
- Report Client Version
|
175
|
+
- Report Client Version [#121]
|
163
176
|
|
164
177
|
## [0.24.4] - 2023-07-06
|
165
178
|
|
166
|
-
- Support Timed Loggers
|
167
|
-
- Added EvaluatedConfigsAggregator (disabled by default)
|
168
|
-
- Added EvaluatedKeysAggregator (disabled by default)
|
169
|
-
- Dropped Ruby 2.6 support
|
170
|
-
- Capture/report context shapes
|
171
|
-
- Added bin/console
|
179
|
+
- Support Timed Loggers [#119]
|
180
|
+
- Added EvaluatedConfigsAggregator (disabled by default) [#118]
|
181
|
+
- Added EvaluatedKeysAggregator (disabled by default) [#117]
|
182
|
+
- Dropped Ruby 2.6 support [#116]
|
183
|
+
- Capture/report context shapes [#115]
|
184
|
+
- Added bin/console [#114]
|
172
185
|
|
173
186
|
## [0.24.3] - 2023-05-15
|
174
187
|
|
175
|
-
- Add JSON log formatter
|
188
|
+
- Add JSON log formatter [#106]
|
176
189
|
|
177
190
|
# [0.24.2] - 2023-05-12
|
178
191
|
|
179
|
-
- Fix bug in FF rollout eval consistency
|
180
|
-
- Simplify forking
|
192
|
+
- Fix bug in FF rollout eval consistency [#108]
|
193
|
+
- Simplify forking [#107]
|
181
194
|
|
182
195
|
# [0.24.1] - 2023-04-26
|
183
196
|
|
184
|
-
- Fix misleading deprecation warning
|
197
|
+
- Fix misleading deprecation warning [#105]
|
185
198
|
|
186
199
|
# [0.24.0] - 2023-04-26
|
187
200
|
|
188
|
-
- Backwards compatibility for JIT context
|
189
|
-
- Remove upsert
|
190
|
-
- Add resolver presenter and `on_update` callback
|
191
|
-
- Deprecate `lookup_key` and introduce Context
|
201
|
+
- Backwards compatibility for JIT context [#104]
|
202
|
+
- Remove upsert [#103]
|
203
|
+
- Add resolver presenter and `on_update` callback [#102]
|
204
|
+
- Deprecate `lookup_key` and introduce Context [#99]
|
192
205
|
|
193
206
|
# [0.23.8] - 2023-04-21
|
194
207
|
|
195
|
-
- Update protobuf
|
208
|
+
- Update protobuf [#101]
|
196
209
|
|
197
210
|
# [0.23.7] - 2023-04-21
|
198
211
|
|
199
|
-
- Guard against ActiveJob not being loaded
|
212
|
+
- Guard against ActiveJob not being loaded [#100]
|
200
213
|
|
201
214
|
# [0.23.6] - 2023-04-17
|
202
215
|
|
203
|
-
- Fix bug in FF rollout eval consistency
|
204
|
-
- Add tests for block-form of logging
|
216
|
+
- Fix bug in FF rollout eval consistency [#98]
|
217
|
+
- Add tests for block-form of logging [#96]
|
205
218
|
|
206
219
|
# [0.23.5] - 2023-04-13
|
207
220
|
|
208
|
-
- Cast the value to string when checking presence in string list
|
221
|
+
- Cast the value to string when checking presence in string list [#95]
|
209
222
|
|
210
223
|
# [0.23.4] - 2023-04-12
|
211
224
|
|
212
|
-
- Remove GRPC
|
225
|
+
- Remove GRPC [#93]
|
213
226
|
|
214
227
|
# [0.23.3] - 2023-04-07
|
215
228
|
|
216
|
-
- Use exponential backoff for log level uploading
|
229
|
+
- Use exponential backoff for log level uploading [#92]
|
217
230
|
|
218
231
|
# [0.23.2] - 2023-04-04
|
219
232
|
|
220
|
-
- Move log collection logs from INFO to DEBUG
|
221
|
-
- Fix: Handle trailing slash in PREFAB_API_URL
|
233
|
+
- Move log collection logs from INFO to DEBUG [#91]
|
234
|
+
- Fix: Handle trailing slash in PREFAB_API_URL [#90]
|
222
235
|
|
223
236
|
# [0.23.1] - 2023-03-30
|
224
237
|
|
225
|
-
- ActiveStorage not defined in Rails < 5.2
|
238
|
+
- ActiveStorage not defined in Rails < 5.2 [#87]
|
226
239
|
|
227
240
|
# [0.23.0] - 2023-03-28
|
228
241
|
|
229
|
-
- Convenience for setting Rails.logger
|
230
|
-
- Log evaluation according to rules
|
242
|
+
- Convenience for setting Rails.logger [#85]
|
243
|
+
- Log evaluation according to rules [#81]
|
231
244
|
|
232
245
|
# [0.22.0] - 2023-03-15
|
233
246
|
|
234
|
-
- Report log paths and usages
|
235
|
-
- Accept hash or keyword args in `initialize`
|
247
|
+
- Report log paths and usages [#79]
|
248
|
+
- Accept hash or keyword args in `initialize` [#78]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.8.
|
1
|
+
1.8.9
|
data/compile_protos.sh
CHANGED
@@ -2,14 +2,16 @@
|
|
2
2
|
|
3
3
|
set -e
|
4
4
|
|
5
|
+
PROTO_ROOT="${PROTO_ROOT:-..}"
|
6
|
+
|
5
7
|
gem install grpc-tools
|
6
8
|
|
7
9
|
(
|
8
|
-
cd
|
10
|
+
cd "$PROTO_ROOT/prefab-cloud"
|
9
11
|
git pull --rebase
|
10
12
|
)
|
11
13
|
|
12
|
-
grpc_tools_ruby_protoc -I
|
14
|
+
grpc_tools_ruby_protoc -I "$PROTO_ROOT/prefab-cloud/" --ruby_out=lib --grpc_out=lib prefab.proto
|
13
15
|
|
14
16
|
gsed -i 's/^module Prefab$/module PrefabProto/g' lib/prefab_pb.rb
|
15
17
|
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Prefab
|
4
|
+
class CachingHttpConnection
|
5
|
+
CACHE_SIZE = 2.freeze
|
6
|
+
CacheEntry = Struct.new(:data, :etag, :expires_at)
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def cache
|
10
|
+
@cache ||= FixedSizeHash.new(CACHE_SIZE)
|
11
|
+
end
|
12
|
+
|
13
|
+
def reset_cache!
|
14
|
+
@cache = FixedSizeHash.new(CACHE_SIZE)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(uri, api_key)
|
19
|
+
@connection = HttpConnection.new(uri, api_key)
|
20
|
+
end
|
21
|
+
|
22
|
+
def get(path)
|
23
|
+
now = Time.now.to_i
|
24
|
+
cache_key = "#{@connection.uri}#{path}"
|
25
|
+
cached = self.class.cache[cache_key]
|
26
|
+
|
27
|
+
# Check if we have a valid cached response
|
28
|
+
if cached&.data && cached.expires_at && now < cached.expires_at
|
29
|
+
return Faraday::Response.new(
|
30
|
+
status: 200,
|
31
|
+
body: cached.data,
|
32
|
+
response_headers: {
|
33
|
+
'ETag' => cached.etag,
|
34
|
+
'X-Cache' => 'HIT',
|
35
|
+
'X-Cache-Expires-At' => cached.expires_at.to_s
|
36
|
+
}
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Make request with conditional GET if we have an ETag
|
41
|
+
response = if cached&.etag
|
42
|
+
@connection.get(path, { 'If-None-Match' => cached.etag })
|
43
|
+
else
|
44
|
+
@connection.get(path)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Handle 304 Not Modified
|
48
|
+
if response.status == 304 && cached&.data
|
49
|
+
return Faraday::Response.new(
|
50
|
+
status: 200,
|
51
|
+
body: cached.data,
|
52
|
+
response_headers: {
|
53
|
+
'ETag' => cached.etag,
|
54
|
+
'X-Cache' => 'HIT',
|
55
|
+
'X-Cache-Expires-At' => cached.expires_at.to_s
|
56
|
+
}
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Parse caching headers
|
61
|
+
cache_control = response.headers['Cache-Control'].to_s
|
62
|
+
etag = response.headers['ETag']
|
63
|
+
|
64
|
+
# Always add X-Cache header
|
65
|
+
response.headers['X-Cache'] = 'MISS'
|
66
|
+
|
67
|
+
# Don't cache if no-store is present
|
68
|
+
return response if cache_control.include?('no-store')
|
69
|
+
|
70
|
+
# Calculate expiration
|
71
|
+
max_age = cache_control.match(/max-age=(\d+)/)&.captures&.first&.to_i
|
72
|
+
expires_at = max_age ? now + max_age : nil
|
73
|
+
|
74
|
+
# Cache the response if we have caching headers
|
75
|
+
if etag || expires_at
|
76
|
+
self.class.cache[cache_key] = CacheEntry.new(
|
77
|
+
response.body,
|
78
|
+
etag,
|
79
|
+
expires_at
|
80
|
+
)
|
81
|
+
end
|
82
|
+
|
83
|
+
response
|
84
|
+
end
|
85
|
+
|
86
|
+
# Delegate other methods to the underlying connection
|
87
|
+
def post(path, body)
|
88
|
+
@connection.post(path, body)
|
89
|
+
end
|
90
|
+
|
91
|
+
def uri
|
92
|
+
@connection.uri
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
data/lib/prefab/config_client.rb
CHANGED
@@ -118,7 +118,7 @@ module Prefab
|
|
118
118
|
end
|
119
119
|
|
120
120
|
def load_checkpoint
|
121
|
-
success = load_source_checkpoint
|
121
|
+
success = load_source_checkpoint(:start_at_id => @config_loader.highwater_mark)
|
122
122
|
return if success
|
123
123
|
|
124
124
|
success = load_cache
|
@@ -127,11 +127,10 @@ module Prefab
|
|
127
127
|
LOG.warn 'No success loading checkpoints'
|
128
128
|
end
|
129
129
|
|
130
|
-
def load_source_checkpoint
|
130
|
+
def load_source_checkpoint(start_at_id: 0)
|
131
131
|
@options.config_sources.each do |source|
|
132
|
-
conn = Prefab::
|
132
|
+
conn = Prefab::CachingHttpConnection.new("#{source}/api/v1/configs/#{start_at_id}", @base_client.api_key)
|
133
133
|
result = load_url(conn, :remote_api)
|
134
|
-
|
135
134
|
return true if result
|
136
135
|
end
|
137
136
|
|
@@ -146,18 +145,18 @@ module Prefab
|
|
146
145
|
cache_configs(configs)
|
147
146
|
true
|
148
147
|
else
|
149
|
-
LOG.info "Checkpoint #{source} failed to load. Response #{resp.status}"
|
148
|
+
LOG.info "Checkpoint #{source} [#{conn.uri}] failed to load. Response #{resp.status}"
|
150
149
|
false
|
151
150
|
end
|
152
151
|
rescue Faraday::ConnectionFailed => e
|
153
152
|
if !initialized?
|
154
|
-
LOG.warn "Connection Fail loading #{source} checkpoint."
|
153
|
+
LOG.warn "Connection Fail loading #{source} [#{conn.uri}] checkpoint."
|
155
154
|
else
|
156
|
-
LOG.debug "Connection Fail loading #{source} checkpoint."
|
155
|
+
LOG.debug "Connection Fail loading #{source} [#{conn.uri}] checkpoint."
|
157
156
|
end
|
158
157
|
false
|
159
158
|
rescue StandardError => e
|
160
|
-
LOG.warn "Unexpected #{source} problem loading checkpoint #{e} #{conn}"
|
159
|
+
LOG.warn "Unexpected #{source} [#{conn.uri}] problem loading checkpoint #{e} #{conn}"
|
161
160
|
LOG.debug e.backtrace
|
162
161
|
false
|
163
162
|
end
|
data/lib/prefab/context.rb
CHANGED
@@ -200,12 +200,6 @@ module Prefab
|
|
200
200
|
end
|
201
201
|
|
202
202
|
def to_proto(namespace)
|
203
|
-
prefab_context = {
|
204
|
-
'current-time' => ConfigValueWrapper.wrap(Prefab::TimeHelpers.now_in_ms)
|
205
|
-
}
|
206
|
-
|
207
|
-
prefab_context['namespace'] = ConfigValueWrapper.wrap(namespace) if namespace&.length&.positive?
|
208
|
-
|
209
203
|
reportable_contexts = {}
|
210
204
|
|
211
205
|
reportable_tree.each do |ctx|
|
@@ -217,8 +211,7 @@ module Prefab
|
|
217
211
|
PrefabProto::ContextSet.new(
|
218
212
|
contexts: reportable_contexts.map do |name, context|
|
219
213
|
context.to_proto
|
220
|
-
end
|
221
|
-
values: prefab_context)])
|
214
|
+
end
|
222
215
|
)
|
223
216
|
end
|
224
217
|
|