Módulo Horario exposes health check endpoints on every service and emits structured JSON logs suitable for ingestion by ELK Stack or CloudWatch. This page covers how to verify service health, configure centralized logging, add Prometheus monitoring, and troubleshoot the most common operational issues.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Luisanchez0/modulo_Horario/llms.txt
Use this file to discover all available pages before exploring further.
Health check endpoints
Every service exposesGET /health with no authentication required. Use these endpoints for load balancer health checks, uptime monitors, and post-deployment verification.
200 with a JSON body:
Dockerfile:
Structured JSON logging
Configure each microservice to emit logs as JSON objects. This format is required for ELK Stack ingestion and makes log queries in Kibana or CloudWatch Logs Insights straightforward. Add the following setup to each service’s application entry point:Log rotation
For file-based logging (useful when not shipping logs to a collector), useRotatingFileHandler to cap disk usage:
json-file driver. Add the following to any service in docker-compose.yml:
ELK Stack integration
To centralize logs from all four services, add Elasticsearch and Kibana to your Docker Compose setup.http://localhost:5601. Create an index pattern matching logstash-* or configure Filebeat to ship the Docker JSON logs to Elasticsearch.
Prometheus monitoring
Add a Prometheus container to scrape metrics from each service. Createprometheus.yml alongside docker-compose.yml:
docker-compose.yml:
Prometheus metrics scraping requires instrumenting each service with the
prometheus-fastapi-instrumentator or similar library. The endpoints are not exposed by default. This is a roadmap item for Phase 3.What to monitor
System metrics
CPU usage, memory consumption, and disk I/O per container. Alert when CPU exceeds 80% or memory exceeds 90% of the container limit.
Request latency
P50, P95, and P99 response times for each service. The
/horarios endpoint performs upstream calls to three services — latency spikes there often indicate a dependency issue.Failed login attempts
Count and rate of
401 responses from POST /auth/login. A spike indicates a credential-stuffing or brute-force attempt. Rate limiting should engage at 5 req/min per IP.Rate limit hits
Count of
429 responses from Nginx. A sustained high rate indicates traffic above expected levels and may require scaling or IP-level blocking.Troubleshooting
Service not responding / connection refused
Service not responding / connection refused
Check whether all containers are running and healthy.If a service shows as unhealthy or exited, inspect its logs:Restart the affected service without restarting others:
Database connection error
Database connection error
Verify the database container is healthy and accepting connections.Check that migrations are current inside the service container:Confirm
DATABASE_URL points to the container hostname (e.g., postgres or mysql) rather than localhost when running inside Docker.JWT invalid or 401 on all requests
JWT invalid or 401 on all requests
This usually means Then restart all services to pick up the new value:Confirm the new secret is injected:
JWT_SECRET is inconsistent between services or has been rotated without restarting all services.Regenerate a new secret and update it in your secrets store:Rate limiting blocking legitimate traffic
Rate limiting blocking legitimate traffic
If
429 responses appear for non-abusive traffic, check the Nginx rate limit configuration. The login zone is set to 5 req/min and the API zone to 100 req/min. If your use case requires higher limits, increase the rate= value in nginx.conf and reload: