Skip to content

Commit

Permalink
Trace sqla get_session
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinShiCA authored and Weves committed Feb 29, 2024
1 parent c7d228e commit d07345c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backend/danswer/db/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from collections.abc import Generator
from datetime import datetime

from ddtrace import tracer
from sqlalchemy import text
from sqlalchemy.engine import create_engine
from sqlalchemy.engine import Engine
Expand Down Expand Up @@ -68,6 +69,7 @@ def get_sqlalchemy_async_engine() -> AsyncEngine:
return _ASYNC_ENGINE


@tracer.wrap("db.get_session")
def get_session() -> Generator[Session, None, None]:
with Session(get_sqlalchemy_engine(), expire_on_commit=False) as session:
yield session
Expand Down

0 comments on commit d07345c

Please sign in to comment.