Spaces:
Paused
Paused
File size: 1,255 Bytes
4ae946d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | """
Production Monitoring Configuration
"""
import os
class MonitoringConfig:
# API Configuration
MONITORING_API_KEY = os.getenv('MONITORING_API_KEY', 'prod-zenith-2024-key')
# Environment
ENVIRONMENT = os.getenv('ENVIRONMENT', 'production')
LOG_LEVEL = os.getenv('LOG_LEVEL', 'INFO')
# Data Retention
METRICS_RETENTION_DAYS = int(os.getenv('RETENTION_DAYS', '30'))
# Monitoring Endpoints
ENABLE_PERFORMANCE_MONITORING = True
ENABLE_SECURITY_MONITORING = True
ENABLE_BUSINESS_METRICS = True
# Alerting
ALERT_THRESHOLDS = {
'response_time_ms': 1000,
'error_rate_percent': 5.0,
'memory_usage_percent': 85.0,
'cpu_usage_percent': 80.0,
'failed_login_attempts': 10
}
# Health Checks
HEALTH_CHECK_INTERVAL = 30 # seconds
# Database Monitoring
DB_SLOW_QUERY_THRESHOLD = 500 # milliseconds
@classmethod
def validate(cls):
"""Validate configuration"""
if not cls.MONITORING_API_KEY:
raise ValueError("MONITORING_API_KEY is required")
if cls.ENVIRONMENT not in ['production', 'staging', 'development']:
raise ValueError(f"Invalid environment: {cls.ENVIRONMENT}")
return True
|