Enhance metrics handling and logging in bot
- Integrated metrics scheduler start and stop functionality in `run_helper.py` for better resource management. - Improved logging for metrics server operations in `server_prometheus.py`, ensuring clearer error reporting and status updates. - Updated metrics middleware to collect comprehensive metrics for all event types, enhancing monitoring capabilities. - Added active user metrics tracking in `admin_handlers.py` to provide insights on user engagement. - Refactored command and callback handling in `metrics_middleware.py` to improve clarity and error handling.
This commit is contained in:
@@ -64,6 +64,14 @@ async def main():
|
||||
logger.info("Останавливаем планировщик автоматического разбана...")
|
||||
auto_unban_scheduler.stop_scheduler()
|
||||
|
||||
# Останавливаем планировщик метрик
|
||||
try:
|
||||
from helper_bot.utils.metrics_scheduler import stop_metrics_scheduler
|
||||
stop_metrics_scheduler()
|
||||
logger.info("Планировщик метрик остановлен")
|
||||
except Exception as e:
|
||||
logger.error(f"Ошибка при остановке планировщика метрик: {e}")
|
||||
|
||||
# Метрики останавливаются в main.py
|
||||
|
||||
logger.info("Останавливаем задачи...")
|
||||
|
||||
Reference in New Issue
Block a user