Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

✨(summary) enable sentry monitoring

lebaudantoinee6377ce18295
diff --git a/src/helm/env.d/staging/values.meet.yaml.gotmpl b/src/helm/env.d/staging/values.meet.yaml.gotmpl
index e1dbb338..1380f076 100644
--- a/src/helm/env.d/staging/values.meet.yaml.gotmpl
+++ b/src/helm/env.d/staging/values.meet.yaml.gotmpl
@@ -271,6 +271,8 @@ celery:
secretKeyRef:
name: redis-summary.redis.libre.sh
key: url
+ SENTRY_IS_ENABLED: True
+ SENTRY_DSN: https://[email protected]/202
image:
repository: lasuite/meet-summary
diff --git a/src/summary/pyproject.toml b/src/summary/pyproject.toml
index 5cd37e08..9db958bd 100644
--- a/src/summary/pyproject.toml
+++ b/src/summary/pyproject.toml
@@ -12,6 +12,7 @@ dependencies = [
"minio==7.2.9",
"openai==1.51.2",
"requests==2.32.3",
+ "sentry-sdk[fastapi, celery]==2.19.0",
]
[project.optional-dependencies]
diff --git a/src/summary/summary/core/celery_worker.py b/src/summary/summary/core/celery_worker.py
index f43709cc..b45bdd41 100644
--- a/src/summary/summary/core/celery_worker.py
+++ b/src/summary/summary/core/celery_worker.py
@@ -5,7 +5,8 @@ import tempfile
from pathlib import Path
import openai
-from celery import Celery
+import sentry_sdk
+from celery import Celery, signals
from celery.utils.log import get_task_logger
from minio import Minio
from requests import Session
@@ -26,6 +27,12 @@ celery = Celery(
broker_connection_retry_on_startup=True,
)
+if settings.sentry_dsn and settings.sentry_is_enabled:
+ @signals.celeryd_init.connect
+ def init_sentry(**_kwargs):
+ """Initialize sentry."""
+ sentry_sdk.init(dsn=settings.sentry_dsn, enable_tracing=True)
+
def save_audio_stream(audio_stream, chunk_size=32 * 1024):
"""Save an audio stream to a temporary OGG file."""
diff --git a/src/summary/summary/core/config.py b/src/summary/summary/core/config.py
index c9a50790..7ffacd70 100644
--- a/src/summary/summary/core/config.py
+++ b/src/summary/summary/core/config.py
@@ -1,7 +1,7 @@
"""Application configuration and settings."""
from functools import lru_cache
-from typing import Annotated
+from typing import Annotated, Optional
from fastapi import Depends
from pydantic_settings import BaseSettings, SettingsConfigDict
@@ -41,6 +41,10 @@ class Settings(BaseSettings):
webhook_api_token: str
webhook_url: str
+ # Sentry
+ sentry_is_enabled: bool = False
+ sentry_dsn: Optional[str] = None
+
@lru_cache
def get_settings():
diff --git a/src/summary/summary/main.py b/src/summary/summary/main.py
index e30b31f3..2608ccba 100644
--- a/src/summary/summary/main.py
+++ b/src/summary/summary/main.py
@@ -1,5 +1,6 @@
"""Application."""
+import sentry_sdk
from fastapi import FastAPI
from summary.api import health
@@ -8,6 +9,10 @@ from summary.core.config import get_settings
settings = get_settings()
+
+if settings.sentry_dsn and settings.sentry_is_enabled:
+ sentry_sdk.init(dsn=settings.sentry_dsn, enable_tracing=True)
+
app = FastAPI(
title=settings.app_name,
)