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

Migrated from github.com/Trevato/SO-ARM100

The app counts its own numbers: Pi round trip, camera fps in, viewers, frames dropped and bytes out, at /metrics.prom and a one-line log each minute #105

Parked opened this
Closed without merging

The relay now counts its own numbers, serves them at GET /metrics.prom, and logs a one-line summary to stdout every 60 seconds. The code is unchanged since the first push. Pull #100 was closed without merging, and this push is a retry of the preview deploy.

Notes

stopped parked by the crew deploy 468faf4

opened this

The relay now counts its own numbers, serves them at GET /metrics.prom, and logs a one-line summary to stdout every 60 seconds. The code is unchanged since the first push. Pull #100 was closed without merging, and this push is a retry of the preview deploy.

Why the earlier check failed: the preview deploy failed, not the tests. /status answered 503 for 30 seconds while the preview's link to the Pi at 100.89.95.68:8101 was reconnecting. Pull #99 failed the same way at the same time, so I read it as an environment problem rather than something this change caused. I didn't touch that readiness behaviour, since it is out of scope here. If the preview still can't reach the Pi, the deploy will fail again.

What changed:

  • Counters: src/live-metrics.ts keeps the Pi round-trip p50/p95, camera frames in (total and per second), viewers per kind (follow, live, machine, camera), /follow commands received and dropped, and bytes sent to viewers. Hot paths only add to a number.
  • Endpoint and log: /metrics.prom is Prometheus text and needs no login. The JSON /metrics is untouched. The summary interval is the relay option summaryEveryMs, default 60 s.
  • Hooks: ArmLink has a new onRtt option, and FeedOptions gains onFrame and onBytes. relay.ts counts a drop at each early return in the /follow handler.
  • Bytes sent: this covers camera streams and the replies the arm sends back on /follow. The /live and /machine pushes aren't counted.

Tests:

  • live-metrics.test.ts covers injected delays showing up in p95, the fps window aging out, and every Prometheus line parsing as name, labels, value.
  • relay.test.ts checks /metrics.prom over the real relay.
  • Locally the type check is clean and the full suite passes (400 tests, 0 failures).

🤖 Generated with Claude Code

Closes #88

commented

The relay now counts its own numbers, serves them at GET /metrics.prom, and logs a one-line summary to stdout every 60 seconds. The code is unchanged since the first push. Pull #100 was closed without merging, and this push is a retry of the preview deploy.

Why the earlier check failed: the preview deploy failed, not the tests. /status answered 503 for 30 seconds while the preview's link to the Pi at 100.89.95.68:8101 was reconnecting. Pull #99 failed the same way at the same time, so I read it as an environment problem rather than something this change caused. I didn't touch that readiness behaviour, since it is out of scope here. If the preview still can't reach the Pi, the deploy will fail again.

What changed:

  • Counters: src/live-metrics.ts keeps the Pi round-trip p50/p95, camera frames in (total and per second), viewers per kind (follow, live, machine, camera), /follow commands received and dropped, and bytes sent to viewers. Hot paths only add to a number.
  • Endpoint and log: /metrics.prom is Prometheus text and needs no login. The JSON /metrics is untouched. The summary interval is the relay option summaryEveryMs, default 60 s.
  • Hooks: ArmLink has a new onRtt option, and FeedOptions gains onFrame and onBytes. relay.ts counts a drop at each early return in the /follow handler.
  • Bytes sent: this covers camera streams and the replies the arm sends back on /follow. The /live and /machine pushes aren't counted.

Tests:

  • live-metrics.test.ts covers injected delays showing up in p95, the fps window aging out, and every Prometheus line parsing as name, labels, value.
  • relay.test.ts checks /metrics.prom over the real relay.
  • Locally the type check is clean and the full suite passes (400 tests, 0 failures).

🤖 Generated with Claude Code

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