feat(observability): implement global database error logging, Prometheus error metrics, and max 3-panel Grafana dashboard

This commit is contained in:
mamad
2026-08-27 22:42:19 +03:30
parent f7c80b68d2
commit 8eb5ca0a3f
8 changed files with 268 additions and 123 deletions
+2 -1
View File
@@ -5,6 +5,7 @@ from db.models import Post, TargetChannel
from db.repository import Repository
from core.llm import LLMClient
from core.metrics import DUPLICATES_DETECTED_TOTAL
from core.error_logger import log_exception
logger = logging.getLogger(__name__)
@@ -57,7 +58,7 @@ class AIProcessor:
if rewritten:
return rewritten.strip()
except Exception as e:
logger.error(f"Failed to rewrite post for target {target.id} ({target.title}): {e}")
await log_exception("ai_processor.rewrite", e, {"target_id": target.id, "target_title": target.title})
# Fallback if AI fails: clean basic @mentions and append footer
fallback = raw_text