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

Migrated from github.com/Trevato/SO-ARM100

/metrics.prom counts /follow frames received and dropped, and the relay logs summaryLine() once a minute #272

Merged opened this

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

The relay now counts /follow frames received and dropped, and it logs summaryLine() to stdout once a minute. I couldn't run bun x tsc --noEmit here: bun install and bun x both failed with a read-only tempdir error. The forge's check will be the first type check.

Notes

shipped merged

opened this

The relay now counts /follow frames received and dropped, and it logs summaryLine() to stdout once a minute. I couldn't run bun x tsc --noEmit here: bun install and bun x both failed with a read-only tempdir error. The forge's check will be the first type check.

I ran src/frame-limit.test.ts, src/relay.test.ts and src/live-metrics.test.ts: 38 pass, 0 fail. I did not run the rest of bun --cwd Software/so101 test.

  • Counting: in src/relay.ts, every /follow frame bumps follow_frames_received. A frame the rate limiter drops, or that ends the stream as a flood, bumps follow_frames_dropped. They show on /metrics.prom as follow_frames_received_per_second and follow_frames_dropped_per_second.
  • Summary timer: a new summaryEveryMs option on startRelay turns it on. It is off when unset, so tests don't start it, and close() clears it. I set it to 60 seconds in bench/fake-serve.ts; bench/fake-serve.ts is the only caller of startRelay outside the tests. forge.json is untouched.
  • Flood test: a new test in src/frame-limit.test.ts sends 90 frames in one burst through the relay and checks both rates are above zero on /metrics.prom.

Closes #247

commented

The relay now counts /follow frames received and dropped, and it logs summaryLine() to stdout once a minute. I couldn't run bun x tsc --noEmit here: bun install and bun x both failed with a read-only tempdir error. The forge's check will be the first type check.

I ran src/frame-limit.test.ts, src/relay.test.ts and src/live-metrics.test.ts: 38 pass, 0 fail. I did not run the rest of bun --cwd Software/so101 test.

  • Counting: in src/relay.ts, every /follow frame bumps follow_frames_received. A frame the rate limiter drops, or that ends the stream as a flood, bumps follow_frames_dropped. They show on /metrics.prom as follow_frames_received_per_second and follow_frames_dropped_per_second.
  • Summary timer: a new summaryEveryMs option on startRelay turns it on. It is off when unset, so tests don't start it, and close() clears it. I set it to 60 seconds in bench/fake-serve.ts; bench/fake-serve.ts is the only caller of startRelay outside the tests. forge.json is untouched.
  • Flood test: a new test in src/frame-limit.test.ts sends 90 frames in one burst through the relay and checks both rates are above zero on /metrics.prom.
Approved

Does what the issue asks: /follow frames received and dropped are counted, show on /metrics.prom as *_per_second, and summaryLine() is logged every minute via an opt-in summaryEveryMs that close() clears. forge.json runs bench/fake-serve.ts, so production gets the timer. The new test fails without the counters. No new surface, input or dependency. Two next steps: (1) an oversized frame closes the stream with 1009 but is not counted as dropped, so count it too; (2) the README should name the two metrics and the minute log line. The preview, at this head, serves /metrics.prom; the follow counters only appear once frames flow.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs