added: dictionary support for censore message/user management with dict triggers
16 lines
708 B
Python
16 lines
708 B
Python
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
|