Project: Instrumented Mini Service
Project: Instrumented Mini Service
Overview
Ship a tiny HTTP service with slog JSON, request IDs, RED-ish expvar/Prometheus counters, livez/readyz, and a shutdown drain.
Checklist
GET /api/echo?msg=returns JSON
- Middleware: request ID + access log
- Counters: requests_total, requests_failed, latency histogram (or expvar)
/livezalways 200 if process up
/readyzfails when-unreadyfile exists or after SIGTERM
- Graceful Shutdown
- README: how to curl probes + sample log line
Stretch
- OpenTelemetry trace stub
- Prometheus
/metricsviapromhttp
- SLO doc: 99% success, p99 < 200ms on echo
Acceptance
go test ./...
go run . &
curl -s localhost:8080/livez
curl -s localhost:8080/api/echo?msg=hi
kill -TERM $pid # readyz → 503, then exit