You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Health Check API provides a centralized mechanism to monitor the availability and functionality of all critical services utilized by the chatbot application. This includes both internal systems and external APIs. The health check ensures that issues can be promptly detected and resolved.
Purpose
The /health API is used to:
Verify if all dependencies (databases, APIs, etc.) are operational.
Detect issues early and log failures with detailed diagnostics.
Provide actionable data for system administrators to resolve issues quickly.
Monitored Services
Internal Services
Postgres (Database)
Status: Connectivity check.
Impact: Telemetry and other database-dependent features will fail if unavailable.
Redis (Cache System)
Status: Set/Get operation validation.
Impact: Query response times may increase if unavailable.
External APIs
Bhashini
Services Checked:
Text Translation
Speech-to-Text
Text-to-Speech
Language Detection
Impact: Translation, speech services, and language identification will fail.
Wadhwani LLM
Services Checked:
LLM-based responses to non payment questions.
Impact: Chatbot will fail to answer user queries.
PM Kisan
Services Checked:
OTP Sending and Verification
User Details Retrieval
Impact: PM Kisan-related features such as OTP authentication will fail.
API Endpoints
1. GET /health
Description
Aggregates health statuses for all monitored services.
Success Response
{
"status": "ok",
"info": {
"Postgres": {
"status": { "isAvailable": true },
"name": "Postgres",
"type": "internal",
"impactMessage": "Telemetry will not work",
"sla": {
"timeForResolutionInMinutes": 60,
"priority": 0
}
},
"Redis": {
"status": { "isAvailable": true },
"name": "Redis",
"type": "internal",
"impactMessage": "Query time of API's will be slower",
"sla": {
"timeForResolutionInMinutes": 60,
"priority": 0
}
},
"bhashini": {
"status": { "isAvailable": true },
"name": "bhashini",
"type": "external",
"impactMessage": "Bhashini services (translate, transliterate, t2s, s2t, language detection) will not work",
"sla": {
"timeForResolutionInMinutes": -1,
"priority": 0
}
},
"Wadhwani": {
"status": { "isAvailable": true },
"name": "Wadhwani LLM",
"type": "external",
"impactMessage": "Chatbot will not be able to answer general questions",
"sla": {
"timeForResolutionInMinutes": 120,
"priority": 1
}
},
"PM Kisan": {
"status": { "isAvailable": true },
"name": "PM Kisan",
"type": "external",
"impactMessage": "PM Kisan OTP verification and user details retrieval will not work",
"sla": {
"timeForResolutionInMinutes": 120,
"priority": 1
}
}
},
"error": {},
"details": {}
}
Error Response
When one or more services fail, the /health API returns an error response with details of the failed services.
Example Error Response
{
"status": "error",
"info": {},
"error": {
"Redis": {
"status": { "isAvailable": false },
"name": "Redis",
"type": "internal",
"impactMessage": "Query time of API's will be slower",
"error": "Redis connection failed",
"sla": {
"timeForResolutionInMinutes": 60,
"priority": 0
}
},
"bhashini": {
"status": { "isAvailable": false },
"name": "bhashini",
"type": "external",
"impactMessage": "Bhashini services (translate, transliterate, t2s, s2t, language detection) will not work",
"error": "Translation API timed out",
"sla": {
"timeForResolutionInMinutes": 120,
"priority": 1
}
}
},
"details": {}
}
2. GET /health/ping
Description
Simple health check to confirm the service is running.
Health Check API Documentation
Overview
The Health Check API provides a centralized mechanism to monitor the availability and functionality of all critical services utilized by the chatbot application. This includes both internal systems and external APIs. The health check ensures that issues can be promptly detected and resolved.
Purpose
The
/health
API is used to:Monitored Services
Internal Services
Postgres (Database)
Redis (Cache System)
External APIs
Bhashini
Wadhwani LLM
PM Kisan
API Endpoints
1.
GET /health
Description
Aggregates health statuses for all monitored services.
Success Response
Error Response
When one or more services fail, the
/health
API returns an error response with details of the failed services.Example Error Response
2. GET /health/ping
Description
Simple health check to confirm the service is running.
Success Response
Implementation Details
Controller (health.controller.ts)
Service (health.service.ts)
Monitoring Services
Internal Services:
External APIs:
Validate APIs for:
Error Handling
The text was updated successfully, but these errors were encountered: