split otel metrics from general otel configuration

This commit is contained in:
expruc
2025-08-02 11:30:34 +03:00
parent d2a3aacaba
commit a679fb3f45
3 changed files with 65 additions and 19 deletions
+3 -6
View File
@@ -26,11 +26,8 @@ from open_webui.env import (
def setup(app: FastAPI, db_engine: Engine):
# set up trace
trace.set_tracer_provider(
TracerProvider(
resource=Resource.create(attributes={SERVICE_NAME: OTEL_SERVICE_NAME})
)
)
resource = Resource.create(attributes={SERVICE_NAME: OTEL_SERVICE_NAME})
trace.set_tracer_provider(TracerProvider(resource=resource))
# Add basic auth header only if both username and password are not empty
headers = []
@@ -56,4 +53,4 @@ def setup(app: FastAPI, db_engine: Engine):
# set up metrics only if enabled
if ENABLE_OTEL_METRICS:
setup_metrics(app)
setup_metrics(app, resource)