Monitoring & Health Checks
Relevant source files
The following files were used as context for generating this wiki page:The DevSkyy platform incorporates a comprehensive monitoring and health check system designed to ensure production readiness, high availability, and performance. This system provides visibility into the application's status through dedicated API endpoints, integration with industry-standard tools like Prometheus and Sentry, and a detailed error tracking mechanism. The implementation of this infrastructure is a key part of the roadmap to elevate the platform to an "A+" enterprise grade.
The monitoring strategy is multi-faceted, covering basic health status, detailed system checks, performance metrics, and persistent error logging. This allows for proactive issue detection, rapid troubleshooting, and maintaining strict Service Level Objectives (SLOs) such as a P95 response time of less than 200ms.
Sources: A_PLUS_UPGRADE_PLAN.md, PRODUCTION_DEPLOYMENT.md, IMPLEMENTATION_ROADMAP.md
Core Components
The monitoring system is composed of several key components that work together to provide a complete picture of the platform's health.
This diagram illustrates the main components of the DevSkyy monitoring architecture.
Health Check API Endpoints
The platform exposes several endpoints for monitoring its status. These are designed to be used by automated health checkers, load balancers, and system administrators.
| Endpoint | Method | Authentication | Description |
|---|---|---|---|
/health | GET | None | Provides a basic, fast health check of the application. |
/health/detailed | GET | None | Returns a comprehensive status report including database and service dependencies. |
/api/v1/monitoring/health | GET | None | An alternative path for the main system health check. |
/metrics | GET | Token (optional) | Exposes performance and application metrics in Prometheus format. |
/api/v1/monitoring/metrics | GET | Bearer Token | (Protected) Provides key application metrics. |
/api/v1/monitoring/performance | GET | Bearer Token | (Protected) Returns detailed performance statistics. |
/api/v1/orchestration/health | GET | None | Provides health status of the AI orchestration system and its partnerships. |
Sources: health_check.sh, PRODUCTION_DEPLOYMENT.md, DOCKER_README.md, ai_orchestration/API_REQUIREMENTS.md
Health Check Script (health_check.sh)
A dedicated shell script, health_check.sh, is provided to perform external validation of the application's health. It verifies that critical endpoints are responsive and returning the correct HTTP status codes.
The script performs the following checks:
- Basic Health: Verifies the
/healthand/docsendpoints. - API v1 Endpoints: Checks that protected endpoints correctly return a
401 Unauthorizedstatus. - Authentication Endpoints: Ensures that
/auth/loginand/auth/registerreturn422 Unprocessable Entitywhen called without a body, preventing500errors. - CORS Headers: Checks for the presence of
access-control-allow-originheaders. - Performance: Measures the response time of the
/healthendpoint to ensure it is below 1000ms. - Error Handling: Confirms that requests to non-existent paths correctly return a
404 Not Foundstatus.
This diagram shows the execution flow of the health_check.sh script.
Sources: health_check.sh
Prometheus Integration
The platform is instrumented for Prometheus, a leading open-source monitoring and alerting toolkit. This is a core part of the "A+ Upgrade Plan" to achieve enterprise-grade observability.
Sources: A_PLUS_UPGRADE_PLAN.md, PRODUCTION_CHECKLIST.md
Metrics Collection
A FastAPI middleware intercepts every HTTP request to collect and record key metrics.
The following sequence diagram illustrates how the Prometheus middleware captures metrics for an API request.
Sources: A_PLUS_UPGRADE_PLAN.md
Key Metrics
The following metrics are defined for collection:
| Metric Name | Type | Labels | Description |
|---|---|---|---|
http_requests_total | Counter | method, endpoint, status | Total number of HTTP requests. |
http_request_duration_seconds | Histogram | method, endpoint | Duration of HTTP requests in seconds. |
active_agents_total | Gauge | The current number of active AI agents. | |
system_memory_percent | Gauge | System memory usage as a percentage. |
Sources: A_PLUS_UPGRADE_PLAN.md
Alerting with AlertManager
The monitoring architecture includes plans for AlertManager to handle alerts based on Prometheus metrics. This enables proactive notification for critical issues.
Example Alerting Rules
| Alert Name | Severity | Expression | Description |
|---|---|---|---|
HighErrorRate | critical | rate(http_requests_total{status=~"5.."}[5m]) > 0.05 | Fires when the rate of 5xx errors is above 5% for 5 minutes. |
SlowResponseTime | warning | histogram_quantile(0.95, http_request_duration_seconds) > 1 | Fires when the 95th percentile response time exceeds 1 second. |
LowMemory | warning | system_memory_percent > 85 | Fires when system memory usage is above 85% for 5 minutes. |
Sources: A_PLUS_UPGRADE_PLAN.md
Error Tracking & Observability
Beyond metrics, the platform includes robust systems for tracking and logging errors to ensure no issue goes unnoticed, in compliance with the "Truth Protocol".
Sources: PRODUCTION_CHECKLIST.md
Error Ledger System
A custom Error Ledger System provides persistent tracking of all operational errors. This system is crucial for auditing and debugging.
- Persistence: Errors are logged to a JSON file (
/artifacts/error-ledger-<run_id>.json). - Categorization: Errors are classified into types such as
Authentication,Database,Network,Agent,ML, andSecurity. - Severity Levels: Each error is assigned a severity:
Critical,High,Medium,Low, orInfo. - Context: The ledger captures the stack trace for each error, providing full context for debugging.
Sources: PRODUCTION_CHECKLIST.md
Sentry Integration
For real-time error tracking and aggregation, the platform is designed to integrate with Sentry. The Sentry DSN can be configured via an environment variable. This integration is part of the production readiness plan.
Sources: IMPLEMENTATION_ROADMAP.md, PRODUCTION_CHECKLIST.md
Structured Logging
In a production environment, the system uses structured logging (JSON format). This facilitates easier parsing, searching, and analysis by log management systems. Log rotation is also configured to manage log file sizes.
Sources: PRODUCTION_CHECKLIST.md
Conclusion
The monitoring and health check system in DevSkyy is a production-grade solution designed for reliability and performance. By combining internal instrumentation, external checks, and integration with best-in-class tools like Prometheus and Sentry, the platform provides deep visibility into its operational status. This comprehensive approach is fundamental to meeting enterprise requirements for uptime, performance, and proactive maintenance.