[PR #6625] [MERGED] Telemetry server: protected export of benchmark reports and per-machine totals #6992

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6625
Author: @ludovic111
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: feat/telemetry-export


📝 Commits (1)

  • 23d6bc0 Telemetry server: protected export of benchmark reports and per-machine totals

📊 Changes

7 files changed (+616 additions, -1 deletions)

View changed files

📝 crates/horizon-telemetry-server/Cargo.lock (+1 -0)
📝 crates/horizon-telemetry-server/Cargo.toml (+2 -0)
📝 crates/horizon-telemetry-server/README.md (+3 -0)
➕ crates/horizon-telemetry-server/src/export.rs (+281 -0)
📝 crates/horizon-telemetry-server/src/lib.rs (+15 -1)
➕ crates/horizon-telemetry-server/tests/export.rs (+313 -0)
📝 docs/telemetry.md (+1 -0)

📄 Description

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

The perf wave needs players' raw benchmark reports and their CPU core counts, and today nobody can read them without an SSH key on Ludovic's Railway account (workstream 12b in the perf baseline). This adds a read-only, token-protected export instead.

  • GET /v1/export/benchmarks?after=<id>&limit=100: the raw benchmark reports, oldest first, paginated by id (next).
  • GET /v1/export/hardware?days=30&offset=0&limit=200: play sessions per machine description (CPU, threads, physical cores, RAM, GPU, drive, OS…) with installs, sessions, hours, mean p50/p99 and frame buckets. No minimum group size (the public aggregate keeps its k-anonymity).
  • Auth: Authorization: Bearer <TELEMETRY_EXPORT_TOKEN> (HORIZON_TELEMETRY_EXPORT_TOKEN also works), compared in constant time (time depends on the token length only). Unset: both answer 404. Wrong or missing: 401. Wrong tokens take from the address's rate limit, right ones do not.
  • JSON, no-store, gzip when the client sends Accept-Encoding: gzip (flate2, pure Rust, already in the lockfile through ureq).
  • No new personal data: no install ID leaves the database, and the fields are the ones a player already consents to (docs/telemetry.md). No client change is needed: logical threads, physical cores and the drive kind are already recorded in play sessions (System.threads/cores/storage) and benchmark reports (hardware.cpu_threads/cpu_cores/storage).

Server-only (skip-release): the server deploys from main on Railway; players get nothing new.

Checks

crates/horizon-telemetry-server is its own workspace, so pr_ready doesn't cover it. Run inside it: cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test (all green, including the 5 new tests in tests/export.rs: off/401/404, rate limit on guesses only, pagination, machines with core counts, gzip).

After merge

The token is in 1Password (Agents) and on the Railway service as TELEMETRY_EXPORT_TOKEN; the deploy is checked from the Mac mini (200 with the token, 401 without).

🤖 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/6625 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/telemetry-export` --- ### 📝 Commits (1) - [`23d6bc0`](https://github.com/horizon-rust/horizon/commit/23d6bc07661a40a85bca28f55440a8d7566bdb91) Telemetry server: protected export of benchmark reports and per-machine totals ### 📊 Changes **7 files changed** (+616 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-telemetry-server/Cargo.lock` (+1 -0) 📝 `crates/horizon-telemetry-server/Cargo.toml` (+2 -0) 📝 `crates/horizon-telemetry-server/README.md` (+3 -0) ➕ `crates/horizon-telemetry-server/src/export.rs` (+281 -0) 📝 `crates/horizon-telemetry-server/src/lib.rs` (+15 -1) ➕ `crates/horizon-telemetry-server/tests/export.rs` (+313 -0) 📝 `docs/telemetry.md` (+1 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. The perf wave needs players' raw benchmark reports and their CPU core counts, and today nobody can read them without an SSH key on Ludovic's Railway account (workstream 12b in the perf baseline). This adds a read-only, token-protected export instead. - `GET /v1/export/benchmarks?after=<id>&limit=100`: the raw benchmark reports, oldest first, paginated by id (`next`). - `GET /v1/export/hardware?days=30&offset=0&limit=200`: play sessions per machine description (CPU, **threads**, **physical cores**, RAM, GPU, drive, OS…) with installs, sessions, hours, mean p50/p99 and frame buckets. No minimum group size (the public aggregate keeps its k-anonymity). - Auth: `Authorization: Bearer <TELEMETRY_EXPORT_TOKEN>` (`HORIZON_TELEMETRY_EXPORT_TOKEN` also works), compared in constant time (time depends on the token length only). Unset: both answer 404. Wrong or missing: 401. Wrong tokens take from the address's rate limit, right ones do not. - JSON, `no-store`, gzip when the client sends `Accept-Encoding: gzip` (`flate2`, pure Rust, already in the lockfile through `ureq`). - No new personal data: no install ID leaves the database, and the fields are the ones a player already consents to (`docs/telemetry.md`). **No client change is needed**: logical threads, physical cores and the drive kind are already recorded in play sessions (`System.threads/cores/storage`) and benchmark reports (`hardware.cpu_threads/cpu_cores/storage`). Server-only (`skip-release`): the server deploys from main on Railway; players get nothing new. ## Checks `crates/horizon-telemetry-server` is its own workspace, so `pr_ready` doesn't cover it. Run inside it: `cargo fmt --check`, `cargo clippy --all-targets -- -D warnings`, `cargo test` (all green, including the 5 new tests in `tests/export.rs`: off/401/404, rate limit on guesses only, pagination, machines with core counts, gzip). ## After merge The token is in 1Password (Agents) and on the Railway service as `TELEMETRY_EXPORT_TOKEN`; the deploy is checked from the Mac mini (200 with the token, 401 without). 🤖 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:31:10 +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#6992
No description provided.