Description
Extract health check configuration and thresholds into a dedicated module for easier customization and testing.
Current State
Health check logic in src/utils/health.js has hardcoded thresholds and configuration.
Proposed Solution
Create src/config/health.config.js:
export const healthConfig = {
// Memory thresholds
memory: {
warningThreshold: 0.8, // 80%
criticalThreshold: 0.9, // 90%
},
// CPU thresholds
cpu: {
warningThreshold: 0.7, // 70%
criticalThreshold: 0.9, // 90%
},
// Timeout for external checks
externalCheckTimeout: 5000, // 5 seconds
// Services to check
dependentServices: [
{ name: 'user-service', url: process.env.USER_SERVICE_URL },
{ name: 'audit-service', url: process.env.AUDIT_SERVICE_URL },
],
};
Benefits
- Configurable health check thresholds
- Easier to test different scenarios
- Environment-specific configurations
- Clearer separation of concerns
Priority
Low - Nice to have for operational flexibility
Related Files
Description
Extract health check configuration and thresholds into a dedicated module for easier customization and testing.
Current State
Health check logic in
src/utils/health.jshas hardcoded thresholds and configuration.Proposed Solution
Create
src/config/health.config.js:Benefits
Priority
Low - Nice to have for operational flexibility
Related Files
src/utils/health.js