From 28f8a9a277d89b2a72588c26e29adc944dfbfcd6 Mon Sep 17 00:00:00 2001 From: IDoneShaveIt Date: Fri, 16 Jun 2023 10:52:51 +0300 Subject: [PATCH] ELE-1117 tracking improvements --- elementary/tracking/tracking_interface.py | 4 ++-- elementary/utils/hash.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 elementary/utils/hash.py diff --git a/elementary/tracking/tracking_interface.py b/elementary/tracking/tracking_interface.py index 06fdbfd0e..9ff973f31 100644 --- a/elementary/tracking/tracking_interface.py +++ b/elementary/tracking/tracking_interface.py @@ -1,9 +1,9 @@ -import hashlib from typing import Any, Dict, Optional import posthog from elementary.config.config import Config +from elementary.utils.hash import hash class Tracking: @@ -36,7 +36,7 @@ def _send_event( @staticmethod def _hash(content: str): - return hashlib.sha256(content.encode("utf-8")).hexdigest() + return hash(content) def record_internal_exception(self, exc: Exception): pass diff --git a/elementary/utils/hash.py b/elementary/utils/hash.py new file mode 100644 index 000000000..4374b1dd9 --- /dev/null +++ b/elementary/utils/hash.py @@ -0,0 +1,5 @@ +import hashlib + + +def hash(content: str): + return hashlib.sha256(content.encode("utf-8")).hexdigest()