Bot become a Community Guard & Post send manager
added: dictionary support for censore message/user management with dict triggers
This commit is contained in:
15
app/infra/metrics.py
Normal file
15
app/infra/metrics.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import os
|
||||
from prometheus_client import Counter, Histogram, start_http_server
|
||||
|
||||
# Счётчики/гистограммы для модерации и команд
|
||||
MSG_PROCESSED = Counter("mod_messages_processed_total", "Incoming messages processed")
|
||||
MSG_BLOCKED = Counter("mod_messages_blocked_total", "Incoming messages blocked")
|
||||
MOD_LAT = Histogram("moderation_latency_seconds", "Latency of moderation checks",
|
||||
buckets=(0.02, 0.05, 0.1, 0.2, 0.5, 1, 2))
|
||||
|
||||
def start_metrics_server(port: int):
|
||||
try:
|
||||
start_http_server(port)
|
||||
except Exception:
|
||||
# не валим бота, если порт занят/метрики не взлетели
|
||||
pass
|
||||
Reference in New Issue
Block a user