aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/model
diff options
context:
space:
mode:
authorpmikus <peter.mikus@protonmail.ch>2023-02-20 10:26:38 +0000
committerpmikus <peter.mikus@protonmail.ch>2023-02-20 10:40:40 +0000
commit28dc464d05d62c22ec6b3dee01fafffcd0ab754d (patch)
tree9867ff6db2b1f008fd5b3b8c83193e29919723a0 /resources/libraries/python/model
parent377201a59d9ebe7fae4a78da09ba25f19967b32e (diff)
feat(telemetry): Data compress
Signed-off-by: pmikus <peter.mikus@protonmail.ch> Change-Id: I652844e722e24cb49f09a3f30aabe3103e271079
Diffstat (limited to 'resources/libraries/python/model')
-rw-r--r--resources/libraries/python/model/ExportJson.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/resources/libraries/python/model/ExportJson.py b/resources/libraries/python/model/ExportJson.py
index bd457c00f6..478b3abb60 100644
--- a/resources/libraries/python/model/ExportJson.py
+++ b/resources/libraries/python/model/ExportJson.py
@@ -23,9 +23,11 @@ as serialization might have introduced subtle errors.
import datetime
import os.path
+from binascii import b2a_base64
from dateutil.parser import parse
from robot.api import logger
from robot.libraries.BuiltIn import BuiltIn
+from zlib import compress
from resources.libraries.python.Constants import Constants
from resources.libraries.python.jumpavg.AvgStdevStats import AvgStdevStats
@@ -357,6 +359,11 @@ class ExportJson():
Results are used to avoid future post processing, making it more
efficient to consume.
"""
+ if self.data["telemetry"]:
+ telemetry_encode = "\n".join(self.data["telemetry"]).encode()
+ telemetry_compress = compress(telemetry_encode, level=9)
+ telemetry_base64 = b2a_base64(telemetry_compress, newline=False)
+ self.data["telemetry"] = [telemetry_base64.decode()]
if u"result" not in self.data:
return
result_node = self.data[u"result"]