openvibers/openvibe.codes Commits

Codes README: request telemetry (telemetry_samples, one-minute aggregates, 14 days) (#83)

OP OpenVibers committed 29 days ago · 89f294555d · 1 file, +4 −0

Changes

ddiff --git a/README.md b/README.md
iindex c8666b5..25574b4 100644
---- a/README.md
++++ b/README.md
@@@ -125,6 +125,10 @@ See [.env.example](.env.example). Required in production: `OV_OAUTH_CLIENT_SECRE
`/api/v1` limits who calls it, once the caller is known and before any work: `server/http/actor-limits.js`, openvibe-sdk/limits, roadmap WS-R task 4. A signed-in person counts as `user:usr_…`, anyone else by address. Past a limit: `429` problem+json `rate_limited` with `Retry-After`, one `[Limits]` log line and `codes_rate_limited_total{limit,window}`. Reads: `CODES_LIMITS_MINUTE` / `CODES_LIMITS_HOUR` (120 / 3000); the router: 30 a minute, 600 an hour. Never limited per actor: `/api/health`, `/api/ready`, `/release.json`, `/metrics`, sign-in and the public pages (the per-address limit bounds them).
++### Telemetry
++
++Each HTTP request is aggregated by route template, method and status class, never by raw URL. Once a minute one `http.request` sample per key, plus the active-requests, p95 latency and event-loop-lag gauges, is written to this service's own `telemetry_samples` table (openvibe-sdk 0.46 telemetry, the `platform.telemetry-sample@1` shape, migration 0006); rows older than 14 days are deleted daily. `/shared` files, static assets, health, readiness and `/metrics` are not counted. It is wired in [server/app.js](server/app.js), which mounts openvibe-sdk's `telemetryMiddleware` (a no-op until init), and [server/index.js](server/index.js), which calls `telemetry.init()` at production start and runs the 14-day retention and the flush on stop.
++
## Deploy (for the lead)
Production deploys with `sudo ovhost deploy codes` on the host (strategy `git-checkout`: fetch, fast-forward `/opt/openvibe.codes`, install on a lockfile change, restart, wait for `/api/ready`). The unit is `openvibe-codes.service` on `127.0.0.1:4900`, the env file `/etc/openvibe/codes.env`, the database `ov_codes` on the host's data role. nginx serves `openvibe.codes` from [deploy/nginx/openvibe.codes.conf](deploy/nginx/openvibe.codes.conf). Rollback: ovhost puts the previous sha back by itself when `/api/ready` does not answer 2xx after the restart; afterwards `sudo ovhost rollback codes --to <sha>`. Migration 0002 drops the console's tables (their rows were copied into `ov_services` first), so a rollback to a release before it finds no console tables: roll Codes forward, or restore `ov_codes` from the backup taken before the deploy.