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"