Repository team-five for hardcoded
A collection of lightweight Python microservices built with Flask, featuring Prometheus metrics and production-ready deployment configurations.
Common Features:
- ✅ Metrics Endpoint: Prometheus-compatible
/metricsendpoint with request counter - ✅ Health Checks:
/healthzendpoint returning{"ok": true} - ✅ Small Container: Python 3.11-slim based images (~40-50 MB) for minimal resource footprint
- ✅ Production Ready: Gunicorn WSGI server with 2 workers and 2 threads, resource limits, and health probes
Technology Stack:
- Python 3.11 (slim-based)
- Flask 3.0.0 web framework
- Prometheus client 0.19.0 for metrics
- Gunicorn 21.2.0 for production serving
Counts unique words from input text.
- Endpoint:
POST /opwith{"text": "string"} - Response:
{"key": "unique_words", "value": number, "cache_hit": false}
Counts distinct characters in text.
- Endpoint:
POST /opwith{"text": "string"} - Response:
{"key": "unique_chars", "value": number, "cache_hit": false}
NFKC normalize, lowercase, collapse whitespace, strip diacritics.
- Endpoint:
POST /opwith{"text": "string"} - Response:
{"key": "normalized", "value": "string|null", "cache_hit": false}
Calculates Shannon entropy over code points (3 decimal places).
- Endpoint:
POST /opwith{"text": "string"} - Response:
{"key": "entropy", "value": number, "cache_hit": false}
Checks if alphanumeric text equals its reverse.
- Endpoint:
POST /opwith{"text": "string"} - Response:
{"key": "palindrome", "value": boolean, "cache_hit": false}
Deployment: Each service includes a Kubernetes deployment manifest with:
- 2 replicas for high availability
- Health probes (liveness and readiness)
- Resource limits (64-128 Mi memory, 50-100m CPU)
- Prometheus annotations for metrics scraping