feat(metrics): render the operator health snapshot as a report (#19)
Quality gates / quality (pull_request) Canceled after 0s
Quality gates / quality (pull_request) Canceled after 0s
The counters had an endpoint and no way to read them without jq. Adds a pure formatter plus a CLI that prints the app, queue, and model boundaries. The formatter is a function of the snapshot and the three frozen vocabularies, so a caller-supplied failure label cannot reach the terminal: unknown classes are simply not printed. Refusal paths are explicit — 404 means the route is off because no token is configured, 403 means the token was rejected — and the token is never echoed in the report or an error line. RED: tests/model-metrics-report-format.test.js failed with ERR_MODULE_NOT_FOUND before src/model-metrics-report.js existed; the refusal-path test failed with a generic 'answered 404' before the 404 branch was written. Tests: npm test 298/298, npm run test:metrics-report 8/8, syntax and diff gates clean, real-Chromium ui acceptance green with the privacy disclosure visible.
This commit is contained in:
1 parent
3e2253a052
commit
e08b537866
6 files changed
+311
-3
No files matched your search
@@ -80,6 +80,18 @@ by feeding hostile strings into every label position, and
|
||||
curl -sS -H "Authorization: Bearer $TIMMY_METRICS_TOKEN" http://127.0.0.1:4173/api/metrics | jq .
|
||||
```
|
||||
|
||||
For a quick look that does not need `jq`, the report renders the same snapshot as three labelled blocks:
|
||||
|
||||
```bash
|
||||
TIMMY_METRICS_TOKEN=... node scripts/model_metrics_report.mjs --url http://127.0.0.1:4173
|
||||
```
|
||||
|
||||
Exit codes are the point of the command as much as the numbers: `0` means a snapshot was rendered,
|
||||
`1` means the server answered non-200 (404 says the route is disabled because no token is configured,
|
||||
403 says the supplied token was rejected), `2` means the command itself was called wrongly or the
|
||||
server could not be reached. The token is read from the environment or `--token` and is never echoed
|
||||
in the report or in an error line.
|
||||
|
||||
What the numbers mean to an operator:
|
||||
|
||||
| Signal | Reading |
|
||||
|
||||
Reference in new issue
Block a user