fix(logs): reduce production log spam — agent llm-config polling, scheduler plumbing
- middleware: suppress structured REASON/REFLECT framing for high-frequency
pollers (/api/agent/llm-config, /api/tasks/{id}, health/summary,
session/activity, settings/consolidated); fixes tasks/{id} never matching
- agent: _fetch_llm_config treats 401/403 as terminal (no retry, log once),
bounded backoff 5s/15s/60s on connect/timeout/5xx; langgraph_setup logs
auth failure once per process
- scheduler: auto-end plumbing lines (executed/scan triggered) -> DEBUG
- thumbnail: Superset 4xx rejections logged at DEBUG instead of EXPLORE
This commit is contained in:
@@ -445,6 +445,30 @@ async def network_error_handler(request: Request, exc: NetworkError):
|
||||
|
||||
|
||||
# #endregion App.AppModule.NetworkErrorHandler
|
||||
|
||||
# High-frequency polling endpoints whose per-request REASON/REFLECT framing would
|
||||
# spam the structured log (they remain visible in the uvicorn access log):
|
||||
# - /api/tasks* task progress polling (every 1.5s during operations)
|
||||
# - /api/health/summary health monitoring polling
|
||||
# - /api/agent/llm-config agent container LLM config polling
|
||||
# - /api/auth/session/activity session activity heartbeats
|
||||
# - /api/settings/consolidated settings polling
|
||||
_POLLING_EXACT_PATHS = frozenset({
|
||||
"/api/health/summary",
|
||||
"/api/agent/llm-config",
|
||||
"/api/auth/session/activity",
|
||||
"/api/settings/consolidated",
|
||||
})
|
||||
|
||||
|
||||
def _is_suppressed_request(request: Request) -> bool:
|
||||
"""Return True for high-frequency polling requests (framing suppressed)."""
|
||||
path = request.url.path
|
||||
return path in _POLLING_EXACT_PATHS or (
|
||||
request.method == "GET" and path.startswith("/api/tasks")
|
||||
)
|
||||
|
||||
|
||||
# #region App.AppModule.LogRequests [C:3] [TYPE Function]
|
||||
# @ingroup Module
|
||||
# @BRIEF Middleware to log incoming HTTP requests and their response status.
|
||||
@@ -463,10 +487,7 @@ async def log_requests(request: Request, call_next):
|
||||
# Dynamic src derived from the request route — more informative than hardcoded "api.request_handler"
|
||||
_route_path = request.url.path.strip("/").replace("/", ".")
|
||||
_src = f"route.{request.method}.{_route_path}" if _route_path else f"route.{request.method}.root"
|
||||
is_polling = (
|
||||
(request.url.path.endswith("/api/tasks") and request.method == "GET")
|
||||
or request.url.path.endswith("/api/health/summary")
|
||||
)
|
||||
is_polling = _is_suppressed_request(request)
|
||||
if not is_polling:
|
||||
logger.reason(
|
||||
"Handle API request",
|
||||
|
||||
Reference in New Issue
Block a user