Skip to content

Commit 9cf6108

Browse files
authored
feat: add otel system metrics instrumentation (open-webui#22265)
1 parent 1c1c1c3 commit 9cf6108

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

backend/open_webui/utils/telemetry/instrumentors.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from opentelemetry.instrumentation.requests import RequestsInstrumentor
2121
from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor
2222
from opentelemetry.instrumentation.aiohttp_client import AioHttpClientInstrumentor
23+
from opentelemetry.instrumentation.system_metrics import SystemMetricsInstrumentor
2324
from opentelemetry.trace import Span, StatusCode
2425
from redis import Redis
2526
from redis.cluster import RedisCluster
@@ -204,6 +205,7 @@ def _instrument(self, **kwargs):
204205
request_hook=aiohttp_request_hook,
205206
response_hook=aiohttp_response_hook,
206207
)
208+
SystemMetricsInstrumentor().instrument()
207209

208210
def _uninstrument(self, **kwargs):
209211
if getattr(self, "instrumentors", None) is None:

backend/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,4 @@ opentelemetry-instrumentation-requests==0.60b1
155155
opentelemetry-instrumentation-logging==0.60b1
156156
opentelemetry-instrumentation-httpx==0.60b1
157157
opentelemetry-instrumentation-aiohttp-client==0.60b1
158+
opentelemetry-instrumentation-system-metrics==0.60b1

0 commit comments

Comments
 (0)