fix: приглушить httpcore/httpx DEBUG в логах; INFO при успешном сохранении алерта
All checks were successful
CI / test (push) Successful in 39s

- httpcore, httpx, asyncio, uvicorn.access → WARNING (убирает TCP-шум из /ui/logs)
- После успешного INSERT irm_alerts: INFO с alert_id, title, sev, team
- Теперь в /ui/logs видно: пришёл вебхук → сохранено (id=...) или ERROR

Made-with: Cursor
This commit is contained in:
Alexandr
2026-04-03 16:05:40 +03:00
parent c9b97814a5
commit d6c37435f0
2 changed files with 16 additions and 3 deletions

View File

@ -198,6 +198,13 @@ async def _grafana_webhook_impl(
fp_row, fp_row,
team_id, team_id,
) )
logger.info(
"grafana webhook saved: alert_id=%s title=%r sev=%s team=%s",
raw_id,
(title_row or "")[:80],
sev_row,
str(team_id) if team_id else "",
)
bus = getattr(request.app.state, "event_bus", None) bus = getattr(request.app.state, "event_bus", None)
if bus and raw_id is not None: if bus and raw_id is not None:
title = str(body.get("title") or body.get("ruleName") or "")[:500] title = str(body.get("title") or body.get("ruleName") or "")[:500]

View File

@ -18,9 +18,15 @@ from onguard24.status_snapshot import build as build_status
from onguard24.ui_logs import router as logs_router from onguard24.ui_logs import router as logs_router
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)
logging.getLogger("httpx").setLevel(logging.WARNING) # Приглушаем шумные низкоуровневые библиотеки
logging.getLogger("asyncio").setLevel(logging.WARNING) for _noisy in (
logging.getLogger("uvicorn.access").setLevel(logging.WARNING) "httpx",
"httpcore",
"asyncio",
"uvicorn.access",
"uvicorn.error",
):
logging.getLogger(_noisy).setLevel(logging.WARNING)
log = logging.getLogger("onguard24") log = logging.getLogger("onguard24")