Add observability and integration coverage (#2)
ci / test (push) Successful in 9s

Co-authored-by: luna <clawy@reversed.dev>
Co-committed-by: luna <clawy@reversed.dev>
This commit was merged in pull request #2.
This commit is contained in:
2026-07-21 20:05:25 +02:00
committed by Luna
parent 91c0ed7332
commit 7e4a46a5d3
8 changed files with 353 additions and 8 deletions
+8
View File
@@ -25,6 +25,8 @@ Tiny API that clones a Git repo and counts its non-empty lines of code.
- Returns both snapshots and their total/per-language LOC delta.
- `GET /health`
- Health plus queue/cache stats.
- `GET /metrics`
- Prometheus-compatible request, cache, scan, file, and line counters. Protected by the API key when one is configured.
## Auth
@@ -70,6 +72,12 @@ curl "http://localhost:3000/ssh/public-key?ssh_key=loc_via_git_ed25519"
- The service also sweeps stale temp directories in case a process dies mid-scan.
- Cache entries live in memory only and expire after `CACHE_TTL_MINUTES`.
## Operations
- Requests emit structured JSON logs with an opaque request ID, route, status, and duration. Query strings and API keys are never logged.
- The service handles `SIGINT` and `SIGTERM`: it stops accepting new connections, clears its cleanup timer, and exits after active connections drain (or 10 seconds).
- `/metrics` is compatible with Prometheus scraping. `/health` remains unauthenticated for container health checks.
## Counting rules
- Only text files are counted.