refac: import fastapi instrumentor directly (#23530)

This commit is contained in:
Wang Weixuan
2026-04-11 15:36:22 -06:00
committed by GitHub
parent c0ac10d5db
commit 008cd8e6b9
@@ -7,8 +7,8 @@ from aiohttp import (
TraceRequestEndParams,
TraceRequestExceptionParams,
)
from chromadb.telemetry.opentelemetry.fastapi import instrument_fastapi
from fastapi import FastAPI
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
from opentelemetry.instrumentation.httpx import (
HTTPXClientInstrumentor,
RequestInfo,
@@ -176,7 +176,7 @@ class Instrumentor(BaseInstrumentor):
return []
def _instrument(self, **kwargs):
instrument_fastapi(app=self.app)
FastAPIInstrumentor.instrument_app(app=self.app)
SQLAlchemyInstrumentor().instrument(engine=self.db_engine)
RedisInstrumentor().instrument(request_hook=redis_request_hook)
RequestsInstrumentor().instrument(request_hook=requests_hook, response_hook=response_hook)