[PR #5235] [MERGED] Official SMP player count in the launcher, and its history on the telemetry server #6155

Closed
opened 2026-11-03 06:14:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5235
Author: @ludovic111
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: feat/official-smp-stats


📝 Commits (1)

  • 8c913df Official SMP count: in the launcher and in the telemetry server's history

📊 Changes

14 files changed (+659 additions, -79 deletions)

View changed files

📝 crates/horizon-client/src/multiplayer.rs (+6 -2)
📝 crates/horizon-telemetry-server/README.md (+3 -2)
📝 crates/horizon-telemetry-server/src/history.rs (+195 -42)
📝 crates/horizon-telemetry-server/src/lib.rs (+58 -14)
📝 crates/horizon-telemetry-server/src/main.rs (+9 -1)
📝 crates/horizon-telemetry-server/tests/live.rs (+77 -11)
📝 crates/horizon-telemetry/src/lib.rs (+2 -0)
➕ crates/horizon-telemetry/src/server_status.rs (+247 -0)
📝 docs/telemetry.md (+8 -5)
📝 launcher/src/backend.rs (+3 -0)
📝 launcher/src/home.rs (+15 -1)
📝 launcher/src/main.rs (+5 -0)
📝 launcher/src/server_list.rs (+5 -1)
📝 launcher/src/telemetry.rs (+26 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Stacked on #5217 (it retargets to main when that merges). Ludovic's follow-up ask (2026-10-31): show the official server's live player count in the launcher next to "N playing now", and chart its players over time on playhorizon.dev/stats.

What changes

  • horizon_telemetry::server_status (new, std + serde_json only): the server-list status ping a client sends for its Multiplayer list (handshake with next state 1, status request, JSON answer read with a 256 KiB cap), players.online/players.max. OFFICIAL_ADDRESS is the one place the official server's address is kept: the launcher's server_list::OFFICIAL and the game's multiplayer::OFFICIAL_SERVER now use it, so the coming move to the new Sculk machine is one line (plus HORIZON_TELEMETRY_OFFICIAL_SERVER on Railway, which overrides it without a deploy).
  • Launcher. · M on the official SMP beside N playing now: pinged once a minute on its own thread (telemetry::watch_official), 3-second timeout, hidden when the server doesn't answer (and skipped with HORIZON_TELEMETRY_URL=off, like the live count, so tests and automated runs ping nothing). Clicking it opens the Servers page, where the official server is listed.
  • Telemetry server. Each minute, after writing the live count, it pings the official server off the async workers and keeps the player count as an official series in official_minute/hour/day (same shapes and retention as the live count's; a minute it didn't answer has no row, so downtime is a gap). GET /v1/live/history takes series=players|official (default players) and now answers source and the latest minute too.
  • TPS/MSPT: later. The admin API's Prometheus metrics (#5163) listen on 127.0.0.1 only, so Railway can't reach them; the status ping gives players only. Charting MSPT needs the admin API's fixed address and token (#5163's next PR), then a series like this one.

Checked against the real server from a local telemetry server: {"source":"official",…,"series":[[1793461800,38.5,39],[1793462100,33.3,35]],"peak":{"playing":39,…}}.

Checks

  • crates/horizon-telemetry-server: cargo fmt, cargo clippy --all-targets -- -D warnings, cargo test: pass (new: the official series kept apart, record/serve end to end against a stand-in server, nothing written when nobody answers).
  • horizon-telemetry: server_status tests (varints, address parsing, a real socket answer, bad answers, timeout) and clippy -D warnings: pass.
  • launcher: cargo fmt --check, cargo clippy --all-targets --locked -- -D warnings, cargo test --lib -- telemetry server_list: pass.
  • horizon-client: cargo check -p horizon-client --lib passes (only the constant changed). The full pr_ready (workspace clippy, harnesses) is left to CI: the Mac mini's disk is too tight today for the whole workspace.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5235 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/official-smp-stats` --- ### 📝 Commits (1) - [`8c913df`](https://github.com/horizon-rust/horizon/commit/8c913dff6f119b162c4f15aff8a477ee58270fb7) Official SMP count: in the launcher and in the telemetry server's history ### 📊 Changes **14 files changed** (+659 additions, -79 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/multiplayer.rs` (+6 -2) 📝 `crates/horizon-telemetry-server/README.md` (+3 -2) 📝 `crates/horizon-telemetry-server/src/history.rs` (+195 -42) 📝 `crates/horizon-telemetry-server/src/lib.rs` (+58 -14) 📝 `crates/horizon-telemetry-server/src/main.rs` (+9 -1) 📝 `crates/horizon-telemetry-server/tests/live.rs` (+77 -11) 📝 `crates/horizon-telemetry/src/lib.rs` (+2 -0) ➕ `crates/horizon-telemetry/src/server_status.rs` (+247 -0) 📝 `docs/telemetry.md` (+8 -5) 📝 `launcher/src/backend.rs` (+3 -0) 📝 `launcher/src/home.rs` (+15 -1) 📝 `launcher/src/main.rs` (+5 -0) 📝 `launcher/src/server_list.rs` (+5 -1) 📝 `launcher/src/telemetry.rs` (+26 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Stacked on #5217 (it retargets to main when that merges). Ludovic's follow-up ask (2026-10-31): show the official server's live player count in the launcher next to "N playing now", and chart its players over time on playhorizon.dev/stats. ## What changes - **`horizon_telemetry::server_status`** (new, std + serde_json only): the server-list status ping a client sends for its Multiplayer list (handshake with next state 1, status request, JSON answer read with a 256 KiB cap), `players.online`/`players.max`. `OFFICIAL_ADDRESS` is the one place the official server's address is kept: the launcher's `server_list::OFFICIAL` and the game's `multiplayer::OFFICIAL_SERVER` now use it, so the coming move to the new Sculk machine is one line (plus `HORIZON_TELEMETRY_OFFICIAL_SERVER` on Railway, which overrides it without a deploy). - **Launcher.** `· M on the official SMP` beside `N playing now`: pinged once a minute on its own thread (`telemetry::watch_official`), 3-second timeout, hidden when the server doesn't answer (and skipped with `HORIZON_TELEMETRY_URL=off`, like the live count, so tests and automated runs ping nothing). Clicking it opens the Servers page, where the official server is listed. - **Telemetry server.** Each minute, after writing the live count, it pings the official server off the async workers and keeps the player count as an `official` series in `official_minute/hour/day` (same shapes and retention as the live count's; a minute it didn't answer has no row, so downtime is a gap). `GET /v1/live/history` takes `series=players|official` (default `players`) and now answers `source` and the `latest` minute too. - **TPS/MSPT: later.** The admin API's Prometheus metrics (#5163) listen on 127.0.0.1 only, so Railway can't reach them; the status ping gives players only. Charting MSPT needs the admin API's fixed address and token (#5163's next PR), then a series like this one. Checked against the real server from a local telemetry server: `{"source":"official",…,"series":[[1793461800,38.5,39],[1793462100,33.3,35]],"peak":{"playing":39,…}}`. ## Checks - `crates/horizon-telemetry-server`: `cargo fmt`, `cargo clippy --all-targets -- -D warnings`, `cargo test`: pass (new: the official series kept apart, record/serve end to end against a stand-in server, nothing written when nobody answers). - `horizon-telemetry`: `server_status` tests (varints, address parsing, a real socket answer, bad answers, timeout) and clippy `-D warnings`: pass. - `launcher`: `cargo fmt --check`, `cargo clippy --all-targets --locked -- -D warnings`, `cargo test --lib -- telemetry server_list`: pass. - `horizon-client`: `cargo check -p horizon-client --lib` passes (only the constant changed). The full `pr_ready` (workspace clippy, harnesses) is left to CI: the Mac mini's disk is too tight today for the whole workspace. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:14:59 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6155
No description provided.