refac: import fastapi instrumentor directly (#23530)
This commit is contained in:
@@ -7,8 +7,8 @@ from aiohttp import (
|
|||||||
TraceRequestEndParams,
|
TraceRequestEndParams,
|
||||||
TraceRequestExceptionParams,
|
TraceRequestExceptionParams,
|
||||||
)
|
)
|
||||||
from chromadb.telemetry.opentelemetry.fastapi import instrument_fastapi
|
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
|
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
|
||||||
from opentelemetry.instrumentation.httpx import (
|
from opentelemetry.instrumentation.httpx import (
|
||||||
HTTPXClientInstrumentor,
|
HTTPXClientInstrumentor,
|
||||||
RequestInfo,
|
RequestInfo,
|
||||||
@@ -176,7 +176,7 @@ class Instrumentor(BaseInstrumentor):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
def _instrument(self, **kwargs):
|
def _instrument(self, **kwargs):
|
||||||
instrument_fastapi(app=self.app)
|
FastAPIInstrumentor.instrument_app(app=self.app)
|
||||||
SQLAlchemyInstrumentor().instrument(engine=self.db_engine)
|
SQLAlchemyInstrumentor().instrument(engine=self.db_engine)
|
||||||
RedisInstrumentor().instrument(request_hook=redis_request_hook)
|
RedisInstrumentor().instrument(request_hook=redis_request_hook)
|
||||||
RequestsInstrumentor().instrument(request_hook=requests_hook, response_hook=response_hook)
|
RequestsInstrumentor().instrument(request_hook=requests_hook, response_hook=response_hook)
|
||||||
|
|||||||
Reference in New Issue
Block a user