Public: anyone can read this; the crew can change it.
Games survival step 2b: read FabricExporter Prometheus metrics at check-in so TPS and tick time show on the games page #18116
Merged 8h 23m ago, live in production
This pull reads FabricExporter's Prometheus page at check-in, so a Fabric server's TPS and tick time now reach the games page. I ran bun test test/game-metrics.test.ts, bun x tsc --noEmit and bun scripts/gate.ts, and all pass. I did not run the full suite, and I did not run the agent script against a real container.
-
Reviews
Changes requested — before the latest pushThe parser and the rollup are tidy and tested, and the Paper path is untouched. Two things must change before this lands.
- (fix first) The terminal change has no test.
playersTpsin src/tui/screens/games.ts now printsN ms tick, and nothing fails if that is removed. Add a test next to the existing Games screen tests: record a Fabricpromsample withrecordMetrics, render the screen, and expectms tickin the line. Also cover the case wheremsptis null, where the segment must be absent. - The metric names are a guess that is not checked anywhere.
agent.shgreps formc_|minecraft_plustps|tick|mspt, andparsePrometheusaccepts only a fixed few names. Nothing in the pull shows what FabricExporter really emits, and nothing installs it or says so. If a name is off, the result is silent: no numbers and no error. Do these: (a) put a real sample of the exporter's output in the test fixture, or cite its documented metric names in the comment abovePROM_TPS; (b) say in docs/features/games.md that the exporter must be installed on the Fabric server, and which port it listens on. A person who reads the Numbers section today cannot tell why a Fabric server shows no TPS.
Smaller points, to fix in the same round:
- The agent's grep (
[a-z_](tps|tick|mspt)[a-z_]) is looser than the parser, so it can send lines that are thrown away. That is harmless, but a comment should say the parser is the authority. - The new
promfield has no test at therecordMetricsboundary for oversized or non-string input. Add one case, for example a 20 KB string or a number, to showtext(..., 16_000)holds.
ApprovedRead every changed line. Security: the agent's curl hits a fixed loopback URL inside the container, with no user text in the command. The output is bounded three times (grep, head -c 4000, and text(..., 16_000) at the boundary), and parsePrometheus caps its own input and rejects NaN, Inf and negative values. Nothing is built from user input. Tests cover the parser, the recordMetrics fallback to prom, the 16 KB cut and non-string input, and the terminal line both with and without the tick segment. The terminal change and the docs/features/games.md how-to are in the same pull, and README is untouched. Paper's path is unchanged because prom is read only when tps said nothing.
One caveat, not blocking: the FabricExporter metric names and port 25585 are unverified against a real exporter page, and the pull says so in the code comment and the docs. If a name is off, the result is silent (no numbers). Whoever first runs a Fabric server with the exporter should check it and add a captured page as a fixture.
- (fix first) The terminal change has no test.
-
Checks
shipped production is serving it deploy a338207
-
History
- Games survival step 2b: test the terminal's tick time and the prom cut, say which exporter names are unverified (#18088) 2f7d644
- Games survival step 2b: wrap comments (#18088) cf3bcba
- Games survival step 2b: read FabricExporter's Prometheus text at check-in for TPS and tick time (#18088) cdf18fb
- Access 1: one Principal for who is asking, an anonymous visitor included (#18060) c347b92
- Apps without a login 3: an app made on one device opens on another, as a file or a read-only link (#18079) 868ed93
- API routes the Apple app lacks: the arcade's games, an app's log, pausing a runner (#18075) cd50587
- Full suite red: test/talk-preview-frame.test.ts (#18098) 78d5a5f
- Post-quantum: the game agent's channel uses a hybrid key exchange (#18074) 2df3631
- Trace index backfill stands aside when the database is locked (the hold on v0.7.729) (#18082) 52a26e1
- Every new TLS socket must check the peer's certificate (a lint) (#18063) c09e592
- Post-quantum: one test proves every door negotiates a hybrid key exchange (#18064) f0fb2b5
- Post-quantum signatures and host keys: track ML-DSA, nothing to build yet (#18078) c265edf
- Sentinel: Crew runs in trevato/deal-clock keep failing at the push or the sandbox (#18076) a98d939
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:sh74wg48ib is past its budget: trevato/forge: "on production's size > a cold /map answers within a few passes over the runs" failed on 3 pulls in the … (#18070) c5a926e
- Traces 2: /traces lists every trace with facets and search (#18015) 1c60934
- Traces 1a: a trace index table, filled when a run or Talk turn ends and backfilled once off the serving thread (#18061) 35e4ee2
- Games: pin forge-velocity f7d5d4e72 (/forge words as you type, Yes and No to click, an answer shown once) (#18036) 0003ecb
- Merge pull request #18054 from sold/agent-rollback d6960b3
- Games: a new server's words are searched on Modrinth, not matched against five names (#18041) 31cdee4
- Lists answer next_cursor as a string, as openapi.json declares (full suite red, #18027) (#18040) ab67833
This update adds the missing tests and documentation. It doesn't fully meet point 2: I couldn't check the metric names against a real FabricExporter page. The two test files pass (test/game-metrics.test.ts and test/tui-games.test.ts), and tsc is clean. I didn't run the rest of the suite.
Changes
- Terminal test: a new test in
test/tui-games.test.tsrecords a Fabricpromsample withrecordMetricsand renders the Games list. It expects18.5 TPS · 7.5 ms tick. It also coversmsptbeing null, wherems tickis absent. - Boundary test: a new test in
test/game-metrics.test.tsshows thepromfield is cut at 16 KB. A sample past the cut is ignored, one inside it is read, and a number or an object gives nothing. - Parser comment: the comment above
PROM_TPSinsrc/games/metrics.tsnow says the parser decides what counts. Theagent.shcomment says the same about its looser grep. - Docs: the Numbers section of
docs/features/games.mdnow says four things:- FabricExporter must be installed on the Fabric server, and the forge doesn't install it.
- The agent reads
127.0.0.1:25585/metricsinside the container withcurl. - It lists the metric names that are read.
- A mod that spells the names differently shows no numbers and no error.
What I couldn't do
- Metric names: no real FabricExporter sample was reachable from this sandbox, so I did not invent one as a fixture. The comment and the docs say plainly that the names are the conventional spellings and unverified. A reviewer who has a captured page should add it as a fixture or correct the names.
- Port 25585: this is also unverified. It is the default the agent already assumed.
What I left out
- A configurable port or metric-name list.
- Installing the exporter from the forge.
Check for the gate: gate --explain and --fix ran. The only note was two long comment lines that the nightly rewrap handles on main. The commit line does not carry a No door: line. It touches the terminal and the doc, which already existed for this feature.
This pull reads FabricExporter's Prometheus page at check-in, so a Fabric server's TPS and tick time now reach the games page. I ran
bun test test/game-metrics.test.ts,bun x tsc --noEmitandbun scripts/gate.ts, and all pass. I did not run the full suite, and I did not run the agent script against a real container.src/games/agent.sh): whenrcon-cli tpssays nothing, which a Fabric server does, it readshttp://127.0.0.1:25585/metricsinside the container. It keeps only the tick, TPS andmsptlines, capped at 4 KB, and sends them asprombesidelist,tpsandmspt. I only syntax-checked the script (bash -n).parsePrometheusinsrc/games/metrics.ts): takes the TPS, or the tick time in ms or seconds. If only tick time is present it derives TPS, capped at 20.recordMetricsuses Paper's answer first and falls back to it, so Paper servers behave as before and nothing outsidegame_metricchanged.mc_/minecraft_followed bytps, ortick_time/tick_duration/msptwith an_ms,_millisecondsor_secondssuffix. Please check them against a real FabricExporter before relying on them.game_metric, so it needed no change. The terminal's Games screen showed only TPS, so it now showsN ms tickbeside it (src/tui/screens/games.ts).docs/features/games.mdis updated.test/game-metrics.test.ts): the parser, and a Fabric sync recorded into the series.recordMetrics' existing upsert and rollup. I added no module-level state and no new exports beyondparsePrometheus, whichrecordMetricscalls.Try: open
/games/<box>for a Fabric box with FabricExporter and look at Numbers for TPS and Tick time; the terminal's Games screen lists both.Closes #18088