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
@@ -9,6 +9,7 @@ from db.repository import Repository
from core.queue import RedisQueue
from core.metrics import TARGET_ACTIVITY_TOTAL, QUEUE_POSTS_GAUGE, REDIS_QUEUE_SIZE_GAUGE
from core.proxy import get_telegram_proxy
from core.error_logger import log_exception
logger = logging.getLogger(__name__)
@@ -129,7 +130,7 @@ class PublisherService:
TARGET_ACTIVITY_TOTAL.labels(channel_id=str(target.channel_id), title=target.title or '').inc()
logger.info(f"Published post ID {post_id} to Target {target.title} ({target.channel_id})")
except Exception as e:
logger.error(f"Failed to publish queued post {post_id} to target {target.channel_id}: {e}", exc_info=True)
await log_exception("publisher.publish", e, {"post_id": post_id, "target_id": target.id, "channel_id": target.channel_id})
REDIS_QUEUE_SIZE_GAUGE.set(total_queued)