From 93e3f05348bc63fe44b1380db26a5efca015993d Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Thu, 10 Jul 2025 15:06:35 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7(backend)=20make=20PostHog=20event?= =?UTF-8?q?=20names=20configurable=20for=20transcript=20tracking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add setting to customize PostHog event names when tracking transcript results for flexible analytics configuration. --- src/summary/summary/core/celery_worker.py | 4 ++-- src/summary/summary/core/config.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/summary/summary/core/celery_worker.py b/src/summary/summary/core/celery_worker.py index 4a4f8b63..2c18e721 100644 --- a/src/summary/summary/core/celery_worker.py +++ b/src/summary/summary/core/celery_worker.py @@ -148,7 +148,7 @@ def task_retry_handler(request=None, reason=None, einfo=None, **kwargs): @signals.task_failure.connect def task_failure_handler(task_id, exception=None, **kwargs): """Signal handler called when task execution fails permanently.""" - tasks_tracker.capture(task_id, "task_failed") + tasks_tracker.capture(task_id, settings.posthog_event_failure) @celery.task(max_retries=settings.celery_max_retries) @@ -329,6 +329,6 @@ def process_audio_transcribe_summarize_v2( logger.info("Webhook submitted successfully. Status: %s", response.status_code) logger.debug("Response body: %s", response.text) - tasks_tracker.capture(task_id, "task_succeeded") + tasks_tracker.capture(task_id, settings.posthog_event_success) # TODO - integrate summarize the transcript and create a new document. diff --git a/src/summary/summary/core/config.py b/src/summary/summary/core/config.py index f4cd8a0a..4a70f404 100644 --- a/src/summary/summary/core/config.py +++ b/src/summary/summary/core/config.py @@ -53,6 +53,8 @@ class Settings(BaseSettings): posthog_enabled: bool = False posthog_api_key: Optional[str] = None posthog_api_host: Optional[str] = "https://eu.i.posthog.com" + posthog_event_failure: str = "transcript-failure" + posthog_event_success: str = "transcript-success" # TaskTracker task_tracker_redis_url: str = "redis://redis/0"