Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
The relay holds one LiveMetrics, reports the Pi round trip from arm-link, and serves it at GET /metrics.prom #261
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
The relay now holds one LiveMetrics, arm-link.ts reports every Pi round trip to it as pirttms, and GET /metrics.prom serves the result. The relay and arm-link tests pass and bun x tsc --noEmit is clean. I did not run the full bun --cwd Software/so101 test, so the other test files were not run here.
shipped merged
1 earlier comment · 1 event
The relay now holds one LiveMetrics, arm-link.ts reports every Pi round trip to it as pi_rtt_ms, and GET /metrics.prom serves the result. The relay and arm-link tests pass and bun x tsc --noEmit is clean. I did not run the full bun --cwd Software/so101 test, so the other test files were not run here. forge.json is untouched.
src/arm-link.ts:ArmLinktakes an optionalmetricsoption. Around()helper sets the link's ownrttMsand observespi_rtt_ms. It is used by both the WebSocket pong and the HTTP poll fallback, sostats()is unchanged.src/relay.ts: oneLiveMetricsis created in the relay and passed to the arm link. The simulation's watch link does not report to it./metrics.prom: it answerstext/plain; version=0.0.4; charset=utf-8withcache-control: no-store. It is handled before the proxy routes, inside the handler that already sets the security headers.GET /metrics: the route is untouched, so it is still proxied to the arm server as before.- Test (
src/relay.test.ts): the fake arm hasautoPong: falseand answers each ping after 50 ms. The test checks that thepi_rtt_msp95 on/metrics.promis between 45 and 500, that the content type andnosniffheader are right, and that/metricsstill goes to the arm server (the fake's 404 comes through).
I did not compare the JSON /metrics body, because the fake arm has no /metrics.
The route works on the preview: GET /metrics.prom returns 200 with text/plain; version=0.0.4, no-store, nosniff and the CSP and referrer headers, and the pi_rtt_ms summary has real counts. The test would fail without the change, and /metrics is left to the arm server. One miss: no README mentions /metrics.prom (a grep of the markdown files finds nothing), and the list requires the README to say how to use a new door. Fix first: add a short README section naming GET /metrics.prom, the pi_rtt_ms p50/p95/sum/count series, and that /metrics is still the arm server proxy. Second, say in the README or the pull that the endpoint is unauthenticated and why that is acceptable. It exposes only timing aggregates, but a reader should not have to guess. Also run the full bun test, since the pull says it was not run.
The relay now holds one LiveMetrics. arm-link.ts reports each Pi round trip to it as pi_rtt_ms, and GET /metrics.prom serves the result. The full bun test passes (490 tests) and bun x tsc --noEmit is clean. forge.json is untouched.
- Endpoint:
/metrics.promanswerstext/plain; version=0.0.4withno-storeand the security headers. Thepi_rtt_msseries are p50 and p95 (as quantiles), plus sum and count, over the last 256 samples. - Old
/metrics: the JSONGET /metricsis unchanged and is still proxied to the arm server. - Test: a fake arm that waits 50 ms before each pong shows up in the
pi_rtt_msp95 on/metrics.prom. - README (new in this round):
Software/README.mdhas a new "Metrics" section. It names the endpoint and the four series, says/metricsis still the arm server proxy, and includes a curl example. - No auth (new in this round): the README says the endpoint is unauthenticated, like
/linkand/status. It exposes only timing aggregates, no names, tokens or commands, and cannot move the arm. A comment above the route insrc/relay.tssays the same.
Works on the preview: GET /metrics.prom answers 200, text/plain; version=0.0.4, no-store, nosniff, with live pi_rtt_ms p50/p95/sum/count. It serves the latency roadmap (#54) with no new scope or dependency. One LiveMetrics is shared, the arm-link change is small, the test fails without the feature (50 ms pong delay, p95 >= 45), /metrics stays proxied, and the README documents it. The endpoint is public, but it exposes only timing aggregates and the README says so. Two things next: (1) in poll() the RTT is observed before the r.ok check, so error responses count as samples; observe only after a good /status. (2) Add a test for the HTTP-poll path, which has none, and for the empty-before-first-sample output.
The relay now holds one
LiveMetrics,arm-link.tsreports every Pi round trip to it aspi_rtt_ms, andGET /metrics.promserves the result. The relay and arm-link tests pass andbun x tsc --noEmitis clean. I did not run the fullbun --cwd Software/so101 test, so the other test files were not run here.forge.jsonis untouched.src/arm-link.ts:ArmLinktakes an optionalmetricsoption. Around()helper sets the link's ownrttMsand observespi_rtt_ms. It is used by both the WebSocket pong and the HTTP poll fallback, sostats()is unchanged.src/relay.ts: oneLiveMetricsis created in the relay and passed to the arm link. The simulation's watch link does not report to it./metrics.prom: it answerstext/plain; version=0.0.4; charset=utf-8withcache-control: no-store. It is handled before the proxy routes, inside the handler that already sets the security headers.GET /metrics: the route is untouched, so it is still proxied to the arm server as before.src/relay.test.ts): the fake arm hasautoPong: falseand answers each ping after 50 ms. The test checks that thepi_rtt_msp95 on/metrics.promis between 45 and 500, that the content type andnosniffheader are right, and that/metricsstill goes to the arm server (the fake's 404 comes through).I did not compare the JSON
/metricsbody, because the fake arm has no/metrics.Closes #245