feature/129-prometheus-metrics
- Add src/metrics.js: zero-dep Prometheus text exposition for api_requests_total (counter), api_response_duration_seconds (histogram), api_data_freshness_seconds (gauge) - Instrument src/server.js with onResponse hook recording every request; add GET /metrics endpoint (no proxy-secret required) - Update src/nhtsa.js to call recordNhtsaCall() after every successful upstream NHTSA vPIC fetch (drives freshness gauge) - Add src/tests/metrics.test.js: unit tests asserting /metrics returns text with Content-Type text/plain, all three metric names present, HELP/TYPE lines correct, counters increment, freshness is near-zero - Add flux/vin-decoder/servicemonitor.yaml: ServiceMonitor for Prometheus auto-discovery of the /metrics endpoint - Update flux/vin-decoder/kustomization.yaml to include servicemonitor.yaml Closes leeworks-agents/api-company#129
vin-decoder
VIN Decoder API - decode any 17-character VIN using NHTSA vPIC
Live at: https://vin.leeworks.dev (once deployed) OpenAPI spec: openapi.yaml
Endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /v1/decode?vin={vin} | Required | Decode a single VIN |
| POST | /v1/batch | Required | Decode up to 50 VINs |
| GET | /v1/health | None | Service health and cache stats |
Auth = X-RapidAPI-Proxy-Secret header.
Local development
npm install node scripts/seed.js # optional: seed known VINs npm run dev # starts on localhost:3000
Tests
npm test
Environment variables
PORT (default 3000), DB_PATH (default ./data/vin_cache.db), RAPIDAPI_PROXY_SECRET (required in prod)
Deployment
Flux manifests: flux/vin-decoder/. Requires gitea-registry imagePullSecret and rapidapi-proxy-secret in vin-decoder namespace.
Description
Languages
JavaScript
96.8%
Dockerfile
3.2%