Skip to content

Commit 703b5cd

Browse files
authored
Merge pull request #462 from splitio/development
Release 9.5.1
2 parents 523d239 + 980033a commit 703b5cd

File tree

5 files changed

+26
-3
lines changed

5 files changed

+26
-3
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
9.5.1 (Sep 5, 2023)
2+
- Exclude tests from when building the package
3+
- Fixed exception when fetching telemetry stats if no SSE Feature flags update events are stored
4+
15
9.5.0 (Jul 18, 2023)
26
- Improved streaming architecture implementation to apply feature flag updates from the notification received which is now enhanced, improving efficiency and reliability of the whole update system.
37

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@
5353
'Programming Language :: Python :: 3',
5454
'Topic :: Software Development :: Libraries'
5555
],
56-
packages=find_packages()
56+
packages=find_packages(exclude=('tests', 'tests.*'))
5757
)

splitio/models/telemetry.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,8 @@ def pop_update_from_sse(self, event):
627627
:rtype: int
628628
"""
629629
with self._lock:
630+
if self._update_from_sse.get(event.value) is None:
631+
return 0
630632
update_from_sse = self._update_from_sse[event.value]
631633
self._update_from_sse[event.value] = 0
632634
return update_from_sse

splitio/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '9.5.0'
1+
__version__ = '9.5.1'

tests/models/test_telemetry_model.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def test_storage_type_and_operation_mode(self, mocker):
4545
def test_method_latencies(self, mocker):
4646
method_latencies = MethodLatencies()
4747

48+
method_latencies.pop_all() # should not raise exception
4849
for method in ModelTelemetry.MethodExceptionsAndLatencies:
4950
method_latencies.add_latency(method, 50)
5051
if method.value == 'treatment':
@@ -87,8 +88,8 @@ def test_method_latencies(self, mocker):
8788
def test_http_latencies(self, mocker):
8889
http_latencies = HTTPLatencies()
8990

91+
http_latencies.pop_all() # should not raise exception
9092
for resource in ModelTelemetry.HTTPExceptionsAndLatencies:
91-
# pytest.set_trace()
9293
if self._get_http_latency(resource, http_latencies) == None:
9394
continue
9495
http_latencies.add_latency(resource, 50)
@@ -141,6 +142,7 @@ def _get_http_latency(self, resource, storage):
141142
def test_method_exceptions(self, mocker):
142143
method_exception = MethodExceptions()
143144

145+
exceptions = method_exception.pop_all() # should not raise exception
144146
[method_exception.add_exception(ModelTelemetry.MethodExceptionsAndLatencies.TREATMENT) for i in range(2)]
145147
method_exception.add_exception(ModelTelemetry.MethodExceptionsAndLatencies.TREATMENTS)
146148
method_exception.add_exception(ModelTelemetry.MethodExceptionsAndLatencies.TREATMENT_WITH_CONFIG)
@@ -157,6 +159,7 @@ def test_method_exceptions(self, mocker):
157159

158160
def test_http_errors(self, mocker):
159161
http_error = HTTPErrors()
162+
errors = http_error.pop_all() # should not raise exception
160163
[http_error.add_error(ModelTelemetry.HTTPExceptionsAndLatencies.SEGMENT, str(i)) for i in [500, 501, 502]]
161164
[http_error.add_error(ModelTelemetry.HTTPExceptionsAndLatencies.SPLIT, str(i)) for i in [400, 401, 402]]
162165
http_error.add_error(ModelTelemetry.HTTPExceptionsAndLatencies.IMPRESSION, '502')
@@ -177,6 +180,7 @@ def test_http_errors(self, mocker):
177180

178181
def test_last_synchronization(self, mocker):
179182
last_synchronization = LastSynchronization()
183+
last_synchronization.get_all() # should not raise exception
180184
last_synchronization.add_latency(ModelTelemetry.HTTPExceptionsAndLatencies.SPLIT, 10)
181185
last_synchronization.add_latency(ModelTelemetry.HTTPExceptionsAndLatencies.IMPRESSION, 20)
182186
last_synchronization.add_latency(ModelTelemetry.HTTPExceptionsAndLatencies.SEGMENT, 40)
@@ -197,19 +201,27 @@ def test_telemetry_counters(self):
197201
assert(telemetry_counter._token_refreshes == 0)
198202
assert(telemetry_counter._update_from_sse == {})
199203

204+
assert(telemetry_counter.get_session_length() == 0)
200205
telemetry_counter.record_session_length(20)
201206
assert(telemetry_counter.get_session_length() == 20)
202207

208+
assert(telemetry_counter.pop_auth_rejections() == 0)
203209
[telemetry_counter.record_auth_rejections() for i in range(5)]
204210
auth_rejections = telemetry_counter.pop_auth_rejections()
205211
assert(telemetry_counter._auth_rejections == 0)
206212
assert(auth_rejections == 5)
207213

214+
assert(telemetry_counter.pop_token_refreshes() == 0)
208215
[telemetry_counter.record_token_refreshes() for i in range(3)]
209216
token_refreshes = telemetry_counter.pop_token_refreshes()
210217
assert(telemetry_counter._token_refreshes == 0)
211218
assert(token_refreshes == 3)
212219

220+
assert(telemetry_counter.get_counter_stats(ModelTelemetry.CounterConstants.IMPRESSIONS_QUEUED) == 0)
221+
assert(telemetry_counter.get_counter_stats(ModelTelemetry.CounterConstants.IMPRESSIONS_DEDUPED) == 0)
222+
assert(telemetry_counter.get_counter_stats(ModelTelemetry.CounterConstants.IMPRESSIONS_DROPPED) == 0)
223+
assert(telemetry_counter.get_counter_stats(ModelTelemetry.CounterConstants.EVENTS_QUEUED) == 0)
224+
assert(telemetry_counter.get_counter_stats(ModelTelemetry.CounterConstants.EVENTS_DROPPED) == 0)
213225
telemetry_counter.record_impressions_value(ModelTelemetry.CounterConstants.IMPRESSIONS_QUEUED, 10)
214226
assert(telemetry_counter._impressions_queued == 10)
215227
telemetry_counter.record_impressions_value(ModelTelemetry.CounterConstants.IMPRESSIONS_DEDUPED, 14)
@@ -220,6 +232,7 @@ def test_telemetry_counters(self):
220232
assert(telemetry_counter._events_queued == 30)
221233
telemetry_counter.record_events_value(ModelTelemetry.CounterConstants.EVENTS_DROPPED, 1)
222234
assert(telemetry_counter._events_dropped == 1)
235+
assert(telemetry_counter.pop_update_from_sse(UpdateFromSSE.SPLIT_UPDATE) == 0)
223236
telemetry_counter.record_update_from_sse(UpdateFromSSE.SPLIT_UPDATE)
224237
assert(telemetry_counter._update_from_sse[UpdateFromSSE.SPLIT_UPDATE.value] == 1)
225238
updates = telemetry_counter.pop_update_from_sse(UpdateFromSSE.SPLIT_UPDATE)
@@ -234,6 +247,7 @@ def test_streaming_event(self, mocker):
234247

235248
def test_streaming_events(self, mocker):
236249
streaming_events = StreamingEvents()
250+
events = streaming_events.pop_streaming_events() # should not raise exception
237251
streaming_events.record_streaming_event((ModelTelemetry.StreamingEventTypes.CONNECTION_ESTABLISHED, 'split', 1234))
238252
streaming_events.record_streaming_event((ModelTelemetry.StreamingEventTypes.STREAMING_STATUS, 'split', 1234))
239253
events = streaming_events.pop_streaming_events()
@@ -243,6 +257,7 @@ def test_streaming_events(self, mocker):
243257

244258
def test_telemetry_config(self):
245259
telemetry_config = TelemetryConfig()
260+
stats = telemetry_config.get_stats() # should not raise exception
246261
config = {'operationMode': 'standalone',
247262
'streamingEnabled': True,
248263
'impressionsQueueSize': 100,
@@ -277,9 +292,11 @@ def test_telemetry_config(self):
277292
telemetry_config.record_ready_time(10)
278293
assert(telemetry_config._time_until_ready == 10)
279294

295+
assert(telemetry_config.get_bur_time_outs() == 0)
280296
[telemetry_config.record_bur_time_out() for i in range(2)]
281297
assert(telemetry_config.get_bur_time_outs() == 2)
282298

299+
assert(telemetry_config.get_non_ready_usage() == 0)
283300
[telemetry_config.record_not_ready_usage() for i in range(5)]
284301
assert(telemetry_config.get_non_ready_usage() == 5)
285302

0 commit comments

Comments
 (0)