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

A box's TPS and tick time show live on its games pane, from spark's health report or `/spark tps` at check-in #18143

opened this

Merged 5h 37m ago, live in production

A box's TPS and tick time now come from spark's /spark tps output when Paper's own tps command says nothing. A garbled answer records no number, so the pane still reads "not reported". I ran test/game-metrics.test.ts and test/tui-games.test.ts (28 pass), tsc --noEmit and scripts/gate.ts, all green.

Notes

opened this

A box's TPS and tick time now come from spark's /spark tps output when Paper's own tps command says nothing. A garbled answer records no number, so the pane still reads "not reported". I ran test/game-metrics.test.ts and test/tui-games.test.ts (28 pass), tsc --noEmit and scripts/gate.ts, all green. The agent's shell change was not run against a real server, and I did not run the full suite.

What changed

  • Parser: parseSpark in src/games/metrics.ts reads /spark tps output. It takes the 1 m TPS figure and the median of the 10 s tick durations. A label with no value, a count that doesn't match, or a figure that isn't a sane number gives nothing for that field.
  • Recording: recordMetrics tries Paper's tps and mspt first, then spark, then the Fabric Prometheus text.
  • Agent: src/games/agent.sh asks rcon-cli spark tps only when tps returned no TPS line, and sends the raw answer as spark. It reads the Prometheus page only when both are silent. The sync stays backward compatible.
  • Pane and terminal: the existing pane and the Games screen read the same stored metrics, so nothing changed there.
  • Docs: docs/features/games.md mentions the spark fallback. The commit line says No door: ….

Tests

  • parseSpark: a recorded /spark tps answer with colour codes and [⚡] tags gives 19.4 TPS and 4.1 ms. Garbled variants give {}.
  • recordMetrics: a spark sync stores both numbers, and a garbled spark sync stores neither.
  • Games screen: it shows "18.6 TPS · 4.1 ms tick" from spark output. A garbled answer shows neither.

Not done

  • The spark format is written from memory of its output, not captured from a live server.
  • I did not add a web-page test of "not reported". The garbled case is covered at the recording and terminal level.

Reused: the plain() colour stripper, recordMetrics' existing fallback chain and the Games screen's existing TPS segment. I did not run similar.ts.

Closes #18141

commented

A box's TPS and tick time now come from spark's /spark tps output when Paper's own tps command says nothing. A garbled answer records no number, so the pane still reads "not reported". I ran test/game-metrics.test.ts and test/tui-games.test.ts (28 pass), tsc --noEmit and scripts/gate.ts, all green. The agent's shell change was not run against a real server, and I did not run the full suite.

What changed

  • Parser: parseSpark in src/games/metrics.ts reads /spark tps output. It takes the 1 m TPS figure and the median of the 10 s tick durations. A label with no value, a count that doesn't match, or a figure that isn't a sane number gives nothing for that field.
  • Recording: recordMetrics tries Paper's tps and mspt first, then spark, then the Fabric Prometheus text.
  • Agent: src/games/agent.sh asks rcon-cli spark tps only when tps returned no TPS line, and sends the raw answer as spark. It reads the Prometheus page only when both are silent. The sync stays backward compatible.
  • Pane and terminal: the existing pane and the Games screen read the same stored metrics, so nothing changed there.
  • Docs: docs/features/games.md mentions the spark fallback. The commit line says No door: ….

Tests

  • parseSpark: a recorded /spark tps answer with colour codes and [⚡] tags gives 19.4 TPS and 4.1 ms. Garbled variants give {}.
  • recordMetrics: a spark sync stores both numbers, and a garbled spark sync stores neither.
  • Games screen: it shows "18.6 TPS · 4.1 ms tick" from spark output. A garbled answer shows neither.

Not done

  • The spark format is written from memory of its output, not captured from a live server.
  • I did not add a web-page test of "not reported". The garbled case is covered at the recording and terminal level.

Reused: the plain() colour stripper, recordMetrics' existing fallback chain and the Games screen's existing TPS segment. I did not run similar.ts.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs