Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

The relay feeds src/live-metrics.ts and serves it: Pi round trip, camera fps in, viewers, follow frames dropped, bytes out at /metrics.prom, one log line a minute #238

Parked opened this
Closed without merging

The relay now feeds a LiveMetrics and serves it at GET /metrics.prom. The touched suites (relay.test.ts, arm-link.test.ts, camera-feed.test.ts, fake-serve.test.ts) pass and bun x tsc --noEmit is clean. I did not run the full bun test; the forge runs that on the push.

Notes

stopped parked by the crew deploy e2c9557

opened this

The relay now feeds a LiveMetrics and serves it at GET /metrics.prom. The touched suites (relay.test.ts, arm-link.test.ts, camera-feed.test.ts, fake-serve.test.ts) pass and bun x tsc --noEmit is clean. I did not run the full bun test; the forge runs that on the push.

  • What is counted:

- src/arm-link.ts observes each round trip as arm_round_trip_ms, for both the WebSocket ping and the polling GET. - src/camera-feed.ts counts camera_frames_in and camera_bytes_out, covering both MJPEG viewers and the camera WebSocket. - The /follow handler counts follow_frames_received and follow_frames_dropped. A frame counts as dropped if it was rate-limited, oversized or part of a flood. The turn ending, the gate, the reconnecting link or the speed cap can also hold it back, as can an arm socket that isn't open. - A viewers{kind=...} gauge covers /live, /follow, /machine and camera sockets.

  • GET /metrics.prom: it answers text/plain; version=0.0.4 with the security headers. The JSON /metrics still passes through to the arm server untouched, and a test checks that.
  • Log line: startRelay takes summaryEveryMs. It defaults to 0 (never), so tests stay quiet. bench/fake-serve.ts sets it to 60 s, and the line goes to stdout as live: ….
  • Metrics ownership: RelayOptions.metrics lets a caller share one instance with the camera hub's feeds. fake-serve.ts builds its own CameraHub, so without this the production camera numbers would not reach the relay.
  • New test in relay.test.ts:

- A fake arm answers each ping 80 ms late, and a fake MJPEG source sends frames. - A flood of 150 frames goes over /follow. - The scrape then shows round-trip p95 of at least 70 ms, 150 frames received and at least 50 dropped. It also shows camera frames in, camera bytes out and one /follow viewer.

  • Limits: camera and /follow series carry no per-camera or per-driver labels, because label values must come from a small fixed set. The sim's own watch link isn't measured, only the real arm's.

Closes #110

2 earlier comments
commented

The relay now feeds a LiveMetrics and serves it at GET /metrics.prom. The touched suites (relay.test.ts, arm-link.test.ts, camera-feed.test.ts, fake-serve.test.ts) pass and bun x tsc --noEmit is clean. I did not run the full bun test; the forge runs that on the push.

  • What is counted:

- src/arm-link.ts observes each round trip as arm_round_trip_ms, for both the WebSocket ping and the polling GET. - src/camera-feed.ts counts camera_frames_in and camera_bytes_out, covering both MJPEG viewers and the camera WebSocket. - The /follow handler counts follow_frames_received and follow_frames_dropped. A frame counts as dropped if it was rate-limited, oversized or part of a flood. The turn ending, the gate, the reconnecting link or the speed cap can also hold it back, as can an arm socket that isn't open. - A viewers{kind=...} gauge covers /live, /follow, /machine and camera sockets.

  • GET /metrics.prom: it answers text/plain; version=0.0.4 with the security headers. The JSON /metrics still passes through to the arm server untouched, and a test checks that.
  • Log line: startRelay takes summaryEveryMs. It defaults to 0 (never), so tests stay quiet. bench/fake-serve.ts sets it to 60 s, and the line goes to stdout as live: ….
  • Metrics ownership: RelayOptions.metrics lets a caller share one instance with the camera hub's feeds. fake-serve.ts builds its own CameraHub, so without this the production camera numbers would not reach the relay.
  • New test in relay.test.ts:

- A fake arm answers each ping 80 ms late, and a fake MJPEG source sends frames. - A flood of 150 frames goes over /follow. - The scrape then shows round-trip p95 of at least 70 ms, 150 frames received and at least 50 dropped. It also shows camera frames in, camera bytes out and one /follow viewer.

  • Limits: camera and /follow series carry no per-camera or per-driver labels, because label values must come from a small fixed set. The sim's own watch link isn't measured, only the real arm's.
commented

The preview failure was a rate limit, not a problem in the code. I pushed an empty commit to re-run the deploy, and I haven't seen its result.

During bun install the npm registry answered 429 (too many requests) for every package. The branch doesn't touch package.json or bun.lock, and git status is clean. The tests and type check passed locally before my first push.

If the retry hits another 429, the fix is to re-run the deploy later; no code change on this branch would help.

The pull's description is unchanged: the relay feeds LiveMetrics and serves it at GET /metrics.prom, with a one-line summary once a minute.

commented

Parked by the crew: the preview's deploy failed in the place it ran, not in the change, and it could not be run again

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs