logging-fix
This commit is contained in:
parent
34c16c8cdf
commit
385c8ce04b
|
@ -17,7 +17,13 @@ from settings import DB_URL
|
|||
|
||||
|
||||
# Подключение к базе данных SQLAlchemy
|
||||
engine = create_engine(DB_URL, echo=False, pool_size=10, max_overflow=20)
|
||||
engine = create_engine(DB_URL,
|
||||
echo=False,
|
||||
pool_size=10,
|
||||
max_overflow=20,
|
||||
pool_timeout=30, # Время ожидания свободного соединения
|
||||
pool_recycle=1800, # Время жизни соединения
|
||||
)
|
||||
inspector = inspect(engine)
|
||||
configure_mappers()
|
||||
T = TypeVar("T")
|
||||
|
@ -88,7 +94,7 @@ warnings.simplefilter("always", exc.SAWarning)
|
|||
@event.listens_for(Engine, "before_cursor_execute")
|
||||
def before_cursor_execute(conn, cursor, statement, parameters, context, executemany):
|
||||
conn.query_start_time = time.time()
|
||||
conn.last_statement = ""
|
||||
conn.last_statement = None
|
||||
|
||||
|
||||
@event.listens_for(Engine, "after_cursor_execute")
|
||||
|
|
|
@ -1,16 +1,9 @@
|
|||
import sentry_sdk
|
||||
import logging
|
||||
from sentry_sdk.integrations.ariadne import AriadneIntegration
|
||||
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
|
||||
from sentry_sdk.integrations.starlette import StarletteIntegration
|
||||
from sentry_sdk.integrations.logging import LoggingIntegration
|
||||
from settings import GLITCHTIP_DSN
|
||||
|
||||
sentry_logging = LoggingIntegration(
|
||||
level=logging.DEBUG, # Capture info and above as breadcrumbs
|
||||
event_level=logging.ERROR # Send errors as events
|
||||
)
|
||||
|
||||
|
||||
def start_sentry():
|
||||
# sentry monitoring
|
||||
|
@ -28,8 +21,7 @@ def start_sentry():
|
|||
integrations=[
|
||||
StarletteIntegration(),
|
||||
AriadneIntegration(),
|
||||
SqlalchemyIntegration(),
|
||||
sentry_logging
|
||||
SqlalchemyIntegration()
|
||||
],
|
||||
)
|
||||
except Exception as e:
|
||||
|
|
Loading…
Reference in New Issue
Block a user