From d6c37435f09ce87d035123e6ed2fd653a8ddfc51 Mon Sep 17 00:00:00 2001 From: Alexandr Date: Fri, 3 Apr 2026 16:05:40 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=BF=D1=80=D0=B8=D0=B3=D0=BB=D1=83?= =?UTF-8?q?=D1=88=D0=B8=D1=82=D1=8C=20httpcore/httpx=20DEBUG=20=D0=B2=20?= =?UTF-8?q?=D0=BB=D0=BE=D0=B3=D0=B0=D1=85;=20INFO=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=D1=83=D1=81=D0=BF=D0=B5=D1=88=D0=BD=D0=BE=D0=BC=20=D1=81=D0=BE?= =?UTF-8?q?=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B8=20=D0=B0=D0=BB?= =?UTF-8?q?=D0=B5=D1=80=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- onguard24/ingress/grafana.py | 7 +++++++ onguard24/main.py | 12 +++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/onguard24/ingress/grafana.py b/onguard24/ingress/grafana.py index e60ccf3..ee1836b 100644 --- a/onguard24/ingress/grafana.py +++ b/onguard24/ingress/grafana.py @@ -198,6 +198,13 @@ async def _grafana_webhook_impl( fp_row, 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) if bus and raw_id is not None: title = str(body.get("title") or body.get("ruleName") or "")[:500] diff --git a/onguard24/main.py b/onguard24/main.py index a004f52..f6db25e 100644 --- a/onguard24/main.py +++ b/onguard24/main.py @@ -18,9 +18,15 @@ from onguard24.status_snapshot import build as build_status from onguard24.ui_logs import router as logs_router logging.basicConfig(level=logging.DEBUG) -logging.getLogger("httpx").setLevel(logging.WARNING) -logging.getLogger("asyncio").setLevel(logging.WARNING) -logging.getLogger("uvicorn.access").setLevel(logging.WARNING) +# Приглушаем шумные низкоуровневые библиотеки +for _noisy in ( + "httpx", + "httpcore", + "asyncio", + "uvicorn.access", + "uvicorn.error", +): + logging.getLogger(_noisy).setLevel(logging.WARNING) log = logging.getLogger("onguard24")