diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index 21a1aee043..0844723cef 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -518,6 +518,13 @@ from open_webui.tasks import ( from open_webui.utils.redis import get_sentinels_from_env +ROLLBAR_ACCESS_TOKEN = os.environ.get("ROLLBAR_ACCESS_TOKEN", "") + +if ROLLBAR_ACCESS_TOKEN: + import rollbar + + # Initialize Rollbar SDK with your server-side access token + rollbar.init(ROLLBAR_ACCESS_TOKEN) from open_webui.constants import ERROR_MESSAGES @@ -633,6 +640,10 @@ app = FastAPI( redoc_url=None, lifespan=lifespan, ) +if ROLLBAR_ACCESS_TOKEN: + from rollbar.contrib.fastapi import add_to as rollbar_add_to + + rollbar_add_to(app) # For Open WebUI OIDC/OAuth2 oauth_manager = OAuthManager(app) diff --git a/backend/requirements.txt b/backend/requirements.txt index a1a8034959..e2ae61c11a 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -150,3 +150,5 @@ opentelemetry-instrumentation-requests==0.59b0 opentelemetry-instrumentation-logging==0.59b0 opentelemetry-instrumentation-httpx==0.59b0 opentelemetry-instrumentation-aiohttp-client==0.59b0 + +rollbar==1.3.0