Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion splitio/models/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ def _reset_all(self):
self._http_proxy = None
self._active_factory_count = 0
self._redundant_factory_count = 0
self._flag_sets = 0

def record_config(self, config, extra_config):
"""
Expand Down Expand Up @@ -787,6 +788,15 @@ def record_active_and_redundant_factories(self, active_factory_count, redundant_
self._active_factory_count = active_factory_count
self._redundant_factory_count = redundant_factory_count

def record_flag_sets(self, flag_sets):
"""
Record flag sets

:param flag_sets: flag sets count
:type flag_sets: int
"""
with self._lock:
self._flag_sets = flag_sets

def record_ready_time(self, ready_time):
"""
Expand Down Expand Up @@ -814,6 +824,14 @@ def record_not_ready_usage(self):
with self._lock:
self._not_ready += 1

def get_flag_sets(self):
"""
Get flag sets

"""
with self._lock:
return self._flag_sets

def get_bur_time_outs(self):
"""
Get block until ready timeout.
Expand Down Expand Up @@ -865,7 +883,8 @@ def get_stats(self):
'iL': self._impression_listener,
'hp': self._http_proxy,
'aF': self._active_factory_count,
'rF': self._redundant_factory_count
'rF': self._redundant_factory_count,
'fS': self._flag_sets
}

def _get_operation_mode(self, op_mode):
Expand Down
8 changes: 5 additions & 3 deletions tests/models/test_telemetry_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from splitio.models.telemetry import StorageType, OperationMode, MethodLatencies, MethodExceptions, \
HTTPLatencies, HTTPErrors, LastSynchronization, TelemetryCounters, TelemetryConfig, \
StreamingEvent, StreamingEvents, UpdateFromSSE

import splitio.models.telemetry as ModelTelemetry

class TelemetryModelTests(object):
Expand Down Expand Up @@ -88,7 +87,6 @@ def test_http_latencies(self, mocker):
http_latencies = HTTPLatencies()

for resource in ModelTelemetry.HTTPExceptionsAndLatencies:
# pytest.set_trace()
if self._get_http_latency(resource, http_latencies) == None:
continue
http_latencies.add_latency(resource, 50)
Expand Down Expand Up @@ -271,12 +269,16 @@ def test_telemetry_config(self):
'nR': 0,
'bT': 0,
'aF': 0,
'rF': 0}
'rF': 0,
'fS': 0}
)

telemetry_config.record_ready_time(10)
assert(telemetry_config._time_until_ready == 10)

telemetry_config.record_flag_sets(5)
assert(telemetry_config._flag_sets == 5)

[telemetry_config.record_bur_time_out() for i in range(2)]
assert(telemetry_config.get_bur_time_outs() == 2)

Expand Down