Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
/metrics.prom counts camera frames in, bytes out and viewers per socket kind #273
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
/metrics.prom now reports camera frames in, camera bytes out and a gauge of open sockets per kind. bun test in Software/so101 passes (515 tests), but bun x tsc --noEmit does not pass. It reports src/lobby.ts(357,80): 'span' is possibly 'undefined'.
shipped merged
/metrics.prom now reports camera frames in, camera bytes out and a gauge of open sockets per kind. bun test in Software/so101 passes (515 tests), but bun x tsc --noEmit does not pass. It reports src/lobby.ts(357,80): 'span' is possibly 'undefined'. That file is untouched here, and the same error shows up with my changes stashed, so I left it alone.
- Counters:
CameraFeedtakes an optionalmetricsin its options. It countscamera_frames_inonce per whole part from the source. It countscamera_bytes_outfor every byte written to an MJPEG viewer and for each frame sent to a WebSocket sink. The relay passes itsLiveMetricsinto the feeds it builds, so aCameraHubsupplied throughoptions.camerasis not counted.LiveMetrics.counthas no label cap, so I left these two unlabelled rather than per camera. - Gauge:
sockets_open{kind="live"|"follow"|"machine"|"camera"}goes up at the upgrade inrelay.tsand down when the socket closes. All four kinds show 0 from startup./followis counted from the upgrade, so a connection that is refused and closed straight away blips it. The/camera/<id>/videosockets are not counted, since the issue lists only the four kinds. - Test: a new relay test in
relay.test.tsuses a fake MJPEG source. It checks that the camera gauge is 0, then 1 with a socket open, then 0 again after it closes. It also checks that frames-in and bytes-out are above zero while the socket is open. - Not touched:
forge.json.
Does what #246 asked, and nothing beyond it. The preview serves sockets_open for live, follow, machine and camera at 0 on /metrics.prom. The new relay test covers the camera gauge going 0, 1, 0 and the frame and byte rates above zero. It adds no dependency and only touches the metrics path, so no write or gate changes. I did not run the suite myself; I am relying on the pull saying 515 tests pass and on the forge check. Two things to do next: (1) the /camera/<id>/video sockets are untracked, and CameraHubs passed in through options.cameras are not counted, so add them to the gauge and counters if anyone relies on those numbers. (2) The /follow gauge goes up before the lobby refusal, so refused handshakes briefly show as open sockets. Either count them after the refusal check, or write down that they are counted. The tsc error in lobby.ts is already on main and was not caused by this pull.
/metrics.promnow reports camera frames in, camera bytes out and a gauge of open sockets per kind.bun testinSoftware/so101passes (515 tests), butbun x tsc --noEmitdoes not pass. It reportssrc/lobby.ts(357,80): 'span' is possibly 'undefined'. That file is untouched here, and the same error shows up with my changes stashed, so I left it alone.CameraFeedtakes an optionalmetricsin its options. It countscamera_frames_inonce per whole part from the source. It countscamera_bytes_outfor every byte written to an MJPEG viewer and for each frame sent to a WebSocket sink. The relay passes itsLiveMetricsinto the feeds it builds, so aCameraHubsupplied throughoptions.camerasis not counted.LiveMetrics.counthas no label cap, so I left these two unlabelled rather than per camera.sockets_open{kind="live"|"follow"|"machine"|"camera"}goes up at the upgrade inrelay.tsand down when the socket closes. All four kinds show 0 from startup./followis counted from the upgrade, so a connection that is refused and closed straight away blips it. The/camera/<id>/videosockets are not counted, since the issue lists only the four kinds.relay.test.tsuses a fake MJPEG source. It checks that the camera gauge is 0, then 1 with a socket open, then 0 again after it closes. It also checks that frames-in and bytes-out are above zero while the socket is open.forge.json.Closes #246