Enhance monitoring configuration by adding status update interval and alert delays for CPU, RAM, and disk metrics. Update Makefile to include dependency checks for testing, and modify requirements to include requests library. Refactor message sender and metrics collector for improved logging and alert handling.
This commit is contained in:
26
Makefile
26
Makefile
@@ -1,4 +1,4 @@
|
||||
.PHONY: help build up down logs clean restart status deploy backup restore update clean-monitoring monitoring
|
||||
.PHONY: help build up down logs clean restart status deploy backup restore update clean-monitoring monitoring check-deps check-bot-deps
|
||||
|
||||
help: ## Показать справку
|
||||
@echo "🏗️ Production Infrastructure - Доступные команды:"
|
||||
@@ -126,12 +126,12 @@ start: build up ## Собрать и запустить все сервисы
|
||||
stop: down ## Остановить все сервисы
|
||||
@echo "🛑 Все сервисы остановлены"
|
||||
|
||||
test: ## Запустить все тесты в проекте
|
||||
test: check-deps check-bot-deps ## Запустить все тесты в проекте
|
||||
@echo "🧪 Запускаю все тесты в проекте..."
|
||||
@echo "📊 Тесты инфраструктуры..."
|
||||
@python3 -m pytest tests/infra/ -q --tb=no
|
||||
@echo "🤖 Тесты Telegram бота..."
|
||||
@cd bots/telegram-helper-bot && python3 -m pytest tests/ -q --tb=no
|
||||
@cd bots/telegram-helper-bot && source .venv/bin/activate && python3 -m pytest tests/ -q --tb=no
|
||||
@echo "✅ Все тесты завершены!"
|
||||
@echo "📈 Общая статистика:"
|
||||
@echo " - Инфраструктура: $(shell python3 count_tests.py | head -1) тестов"
|
||||
@@ -144,20 +144,20 @@ test-all: ## Запустить все тесты в одном процессе
|
||||
@echo "📊 Рекомендуется использовать 'make test' для обычного запуска"
|
||||
@PYTHONPATH=$(PWD)/bots/telegram-helper-bot:$(PWD) python3 -m pytest tests/infra/ bots/telegram-helper-bot/tests/ -v
|
||||
|
||||
test-infra: ## Запустить тесты инфраструктуры
|
||||
test-infra: check-deps ## Запустить тесты инфраструктуры
|
||||
@echo "🏗️ Запускаю тесты инфраструктуры..."
|
||||
@python3 -m pytest tests/infra/ -v
|
||||
|
||||
test-bot: ## Запустить тесты Telegram бота
|
||||
test-bot: check-bot-deps ## Запустить тесты Telegram бота
|
||||
@echo "🤖 Запускаю тесты Telegram бота..."
|
||||
@cd bots/telegram-helper-bot && python3 -m pytest tests/ -v
|
||||
@cd bots/telegram-helper-bot && source .venv/bin/activate && python3 -m pytest tests/ -v
|
||||
|
||||
test-coverage: ## Запустить все тесты с отчетом о покрытии
|
||||
test-coverage: check-deps check-bot-deps ## Запустить все тесты с отчетом о покрытии
|
||||
@echo "📊 Запускаю все тесты с отчетом о покрытии..."
|
||||
@echo "📈 Покрытие для инфраструктуры..."
|
||||
@python3 -m pytest tests/infra/ --cov=infra --cov-report=term-missing --cov-report=html:htmlcov/infra
|
||||
@echo "🤖 Покрытие для Telegram бота..."
|
||||
@cd bots/telegram-helper-bot && python3 -m pytest tests/ --cov=helper_bot --cov-report=term-missing --cov-report=html:htmlcov/bot
|
||||
@cd bots/telegram-helper-bot && source .venv/bin/activate && python3 -m pytest tests/ --cov=helper_bot --cov-report=term-missing --cov-report=html:htmlcov/bot
|
||||
@echo "📊 Отчеты о покрытии сохранены в htmlcov/"
|
||||
@echo "📈 Общая статистика:"
|
||||
@echo " - Инфраструктура: $(shell python3 count_tests.py | head -1) тестов"
|
||||
@@ -192,6 +192,16 @@ check-grafana: ## Проверить состояние Grafana
|
||||
@echo "📊 Checking Grafana status..."
|
||||
@cd infra/monitoring && python3 check_grafana.py
|
||||
|
||||
check-deps: ## Проверить зависимости инфраструктуры
|
||||
@echo "🔍 Проверяю зависимости инфраструктуры..."
|
||||
@python3 -c "import pytest, prometheus_client, psutil, aiohttp" 2>/dev/null || (echo "❌ Отсутствуют зависимости инфраструктуры. Установите: pip install pytest prometheus-client psutil aiohttp" && exit 1)
|
||||
@echo "✅ Зависимости инфраструктуры установлены"
|
||||
|
||||
check-bot-deps: ## Проверить зависимости Telegram бота
|
||||
@echo "🔍 Проверяю зависимости Telegram бота..."
|
||||
@cd bots/telegram-helper-bot && source .venv/bin/activate && python3 -c "import aiogram, aiosqlite, pytest" 2>/dev/null || (echo "❌ Отсутствуют зависимости бота. Установите: cd bots/telegram-helper-bot && source .venv/bin/activate && pip install -r requirements.txt" && exit 1)
|
||||
@echo "✅ Зависимости Telegram бота установлены"
|
||||
|
||||
logs-tail: ## Показать последние логи всех сервисов
|
||||
@echo "📝 Recent logs from all services:"
|
||||
@docker-compose logs --tail=50
|
||||
|
||||
Reference in New Issue
Block a user