Spaces:
Paused
Paused
| """ | |
| 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 | |
| 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 | |