feat(trace): opentelemetry instrument

This commit is contained in:
orenzhang
2025-03-10 22:27:31 +08:00
parent c2046b9247
commit c761e4fd08
12 changed files with 337 additions and 81 deletions

View File

@@ -330,6 +330,7 @@ from open_webui.env import (
BYPASS_MODEL_ACCESS_CONTROL,
RESET_CONFIG_ON_START,
OFFLINE_MODE,
OT_ENABLED,
)
@@ -356,7 +357,7 @@ from open_webui.utils.oauth import OAuthManager
from open_webui.utils.security_headers import SecurityHeadersMiddleware
from open_webui.tasks import stop_task, list_tasks # Import from tasks.py
from open_webui.utils.trace.setup import setup
if SAFE_MODE:
print("SAFE MODE ENABLED")
@@ -426,6 +427,17 @@ app.state.config = AppConfig(redis_url=REDIS_URL)
app.state.WEBUI_NAME = WEBUI_NAME
app.state.LICENSE_METADATA = None
########################################
#
# OPENTELEMETRY
#
########################################
if OT_ENABLED:
setup(app)
########################################
#
# OLLAMA