From d4e6e2082003533e6d39fc196908659c3c8acc8f Mon Sep 17 00:00:00 2001 From: Rowan Seymour Date: Wed, 11 Dec 2024 21:17:50 +0000 Subject: [PATCH] Remove gauges from analytics abstraction --- temba/channels/android/views.py | 2 -- temba/utils/analytics/base.py | 21 --------------------- temba/utils/analytics/tests.py | 3 --- 3 files changed, 26 deletions(-) diff --git a/temba/channels/android/views.py b/temba/channels/android/views.py index e7aa2e2c1d6..5c66f52e163 100644 --- a/temba/channels/android/views.py +++ b/temba/channels/android/views.py @@ -50,8 +50,6 @@ def register(request): @csrf_exempt @transaction.non_atomic_requests def sync(request, channel_id): - start = time.time() - if request.method != "POST": return HttpResponse(status=500, content="POST Required") diff --git a/temba/utils/analytics/base.py b/temba/utils/analytics/base.py index 6872f5da565..714cdfdbbf7 100644 --- a/temba/utils/analytics/base.py +++ b/temba/utils/analytics/base.py @@ -12,11 +12,6 @@ class AnalyticsBackend(metaclass=abc.ABCMeta): slug: str = None hook_templates = {} - def gauges(self, values: dict): - """ - Records gauge values - """ - def track(self, user, event: str, properties: dict): """ Tracks a user event @@ -52,11 +47,6 @@ class ConsoleBackend(AnalyticsBackend): slug = "console" - def gauges(self, values: dict): - if not settings.TESTING: # pragma: no cover - for name, value in values.items(): - print(f"[analytics] gauge={name} value={value}") - def track(self, user, event: str, properties: dict): if not settings.TESTING: # pragma: no cover print(f"[analytics] event={event} user={user.email}") @@ -68,17 +58,6 @@ def get_backends() -> list: return list(backends.values()) -def gauges(values: dict): - """ - Reports a gauge value - """ - for backend in get_backends(): - try: - backend.gauges(values) - except Exception: - logger.exception(f"error reporting gauges on {backend.slug}") - - def identify(user, brand, org): """ Creates and identifies a new user to our analytics backends diff --git a/temba/utils/analytics/tests.py b/temba/utils/analytics/tests.py index 472c1d9340e..9e00377ef30 100644 --- a/temba/utils/analytics/tests.py +++ b/temba/utils/analytics/tests.py @@ -92,9 +92,6 @@ class BadBackend(AnalyticsBackend): slug = "bad" hook_templates = {"frame-top": "bad/frame_top.html"} - def gauges(self, values: dict): - raise ValueError("boom") - def track(self, user, event: str, properties: dict): raise ValueError("boom")