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 #100
The relay now counts its own numbers, serves them at GET /metrics.prom, and logs a one-line summary to stdout every 60 seconds. I ran the type check and the live-metrics, relay, arm-link, camera-feed and cameras tests. They pass.
stopped closed without shipping deploy 45debd2
The relay now counts its own numbers, serves them at GET /metrics.prom, and logs a one-line summary to stdout every 60 seconds. I ran the type check and the live-metrics, relay, arm-link, camera-feed and cameras tests. They pass. I didn't run the whole suite; the forge does that on the push.
- Counters: the new
src/live-metrics.tsholds them. Hot paths only add to a number. The Pi round trip comes from the last 512 samples and p50/p95 are worked out when asked. - What it counts:
- The Pi round trip, p50 and p95.
- Camera frames in, as a total and as frames per second over 10 s.
- Connected viewers per kind: follow, live, machine, camera.
- /follow commands received and dropped.
- Bytes sent to viewers.
- Bytes sent: this covers camera streams and the replies the arm sends back on
/follow. The/liveand/machinepushes aren't counted. - Hooks:
- ArmLink has a new onRtt option, called on each ping reply or polled GET.
- FeedOptions gains onFrame and onBytes.
- In relay.ts, each early return in the /follow message handler counts a drop.
- Viewers are counted from the socket or response closing.
- Endpoint:
/metrics.promanswerstext/plain; version=0.0.4. The existing JSON/metricsis untouched. - Log timer:
summaryEveryMsis a new relay option, default 60 s. The timer is unref'd and cleared on close. - Tests:
- live-metrics.test.ts: injected delays show up in p95 (p50 stays put), the fps window ages out, and every Prometheus sample line parses as name, labels, value.
- relay.test.ts: /metrics.prom is served over the real relay.
/metrics.prom needs no login, like the JSON /metrics.
🤖 Generated with Claude Code
Declined: the failed check on #100 is not caused by this change, so I made no code change and pushed nothing. Run log: https://forge.open-platform.sh/trevato/arm/runs/01m5dx93qte79n8qxrtrtxajqb
The relay now counts its own numbers, serves them at
GET /metrics.prom, and logs a one-line summary to stdout every 60 seconds. I ran the type check and thelive-metrics,relay,arm-link,camera-feedandcamerastests. They pass. I didn't run the whole suite; the forge does that on the push.src/live-metrics.tsholds them. Hot paths only add to a number. The Pi round trip comes from the last 512 samples and p50/p95 are worked out when asked.- The Pi round trip, p50 and p95. - Camera frames in, as a total and as frames per second over 10 s. - Connected viewers per kind:
follow,live,machine,camera. -/followcommands received and dropped. - Bytes sent to viewers./follow. The/liveand/machinepushes aren't counted.-
ArmLinkhas a newonRttoption, called on each ping reply or polled GET. -FeedOptionsgainsonFrameandonBytes. - Inrelay.ts, each early return in the/followmessage handler counts a drop. - Viewers are counted from the socket or response closing./metrics.promanswerstext/plain; version=0.0.4. The existing JSON/metricsis untouched.summaryEveryMsis a new relay option, default 60 s. The timer is unref'd and cleared on close.-
live-metrics.test.ts: injected delays show up in p95 (p50 stays put), the fps window ages out, and every Prometheus sample line parses as name, labels, value. -relay.test.ts:/metrics.promis served over the real relay./metrics.promneeds no login, like the JSON/metrics.🤖 Generated with Claude Code
Closes #88