🔨 Add OTel/Jeager to start HTTP/SQL requests monitoring
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor
|
||||
from sqlalchemy import text
|
||||
from sqlalchemy.ext.asyncio import (
|
||||
async_sessionmaker,
|
||||
@@ -26,6 +27,8 @@ class Database:
|
||||
# TODO: Preserve UserLastStopSearchResults table from drop.
|
||||
self._engine = create_async_engine(db_path)
|
||||
if self._engine is not None:
|
||||
SQLAlchemyInstrumentor().instrument(engine=self._engine.sync_engine)
|
||||
|
||||
self._session_maker = async_sessionmaker(
|
||||
self._engine, expire_on_commit=False, class_=AsyncSession
|
||||
)
|
||||
|
Reference in New Issue
Block a user