Skip to content

Commit 7537217

Browse files
committed
refactor Telemetry classes to model
1 parent 27e4ae5 commit 7537217

File tree

7 files changed

+1534
-250
lines changed

7 files changed

+1534
-250
lines changed

splitio/engine/telemetry.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ def pop_latencies(self):
186186

187187
def pop_formatted_stats(self):
188188
"""Get formatted and reset stats."""
189-
exceptions = self.pop_exceptions()
190-
latencies = self.pop_latencies()
189+
exceptions = self.pop_exceptions()['methodExceptions']
190+
latencies = self.pop_latencies()['methodLatencies']
191191
return {
192192
**{'mE': {'t': exceptions['treatment'],
193193
'ts': exceptions['treatments'],
@@ -220,7 +220,7 @@ def get_events_stats(self, type):
220220

221221
def get_last_synchronization(self):
222222
"""Get last sync"""
223-
return self._telemetry_storage.get_last_synchronization()
223+
return self._telemetry_storage.get_last_synchronization()['lastSynchronizations']
224224

225225
def pop_tags(self):
226226
"""Get and reset http errors."""
@@ -253,8 +253,8 @@ def get_session_length(self):
253253
def pop_formatted_stats(self):
254254
"""Get formatted and reset stats."""
255255
last_synchronization = self.get_last_synchronization()
256-
http_errors = self.pop_http_errors()
257-
http_latencies = self.pop_http_latencies()
256+
http_errors = self.pop_http_errors()['httpErrors']
257+
http_latencies = self.pop_http_latencies()['httpLatencies']
258258
return {
259259
**{'iQ': self.get_impressions_stats('impressionsQueued')},
260260
**{'iDe': self.get_impressions_stats('impressionsDeduped')},
@@ -291,7 +291,7 @@ def pop_formatted_stats(self):
291291
**{'sE': [{'e': event['type'],
292292
'd': event['data'],
293293
't': event['time']
294-
} for event in self.pop_streaming_events()]
294+
} for event in self.pop_streaming_events()['streamingEvents']]
295295
},
296296
**{'sL': self.get_session_length()}
297297
}

0 commit comments

Comments
 (0)