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

Games: host the spark profiler viewer and its uploads in the forge #18058

Closed opened this has it

Landed in pull #18096 · 2 runs · run

opened this

The spark profiler uploads every profile to the plugin author's hosted service, and its viewer fetches it, plus deobfuscation mappings, from there. The owner wants that data kept in the forge.

What to build

  1. A bytebin-compatible store in the forge, scoped to one game box.
    • POST <base>/post takes a gzipped protobuf body (Content-Type: application/x-spark-*) and answers 201 with a Location: <key> header and no body.
    • GET <base>/<key> returns the stored bytes with their content type, plus CORS headers for the viewer's origin.
    • spark cannot send an auth header, so <base> carries a per-box upload secret in its path. The secret only allows writes. Reads need a forge session with the box's existing game grants (no new grant tables).
    • The store keeps a size cap and an expiry, and the box's games page lists the stored profiles.
  2. The viewer, served by the forge at /games/<box>/spark/<key>.
    • Use the open-source spark-viewer (GPLv3, Next.js). Build it with NEXT_PUBLIC_SPARK_BASE_URL and NEXT_PUBLIC_SPARK_BYTEBIN_URL pointed at the forge.
    • Also point NEXT_PUBLIC_SPARK_MAPPINGS_URL, NEXT_PUBLIC_SPARK_API_URL, SPARK_JSON_SERVICE_URL and SPARK_THUMBNAIL_SERVICE_URL at the forge, or disable them. Nothing should leave.
    • It has no basePath today, so it needs a static export with a basePath patch, or a rewrite. Keep the patch as a small file in the repo.
  3. spark pointed at the forge. Through the existing plugin config path, set viewerUrl (with a trailing slash) and bytebinUrl in config/spark/config.json. Install the mod and this config together, so a box never uploads elsewhere even once.
  4. Proof. An outbound check on the box shows no connection to the author's hosts during a profiler run, and the profile opens from the games page.

Until this ships

/spark profiler stop --save-to-file keeps a profile local (config/spark/profile-*.sparkprofile).

Sources

  • spark-common/.../SparkPlatform.java (the config keys)
  • BytebinClient.java (the upload contract)
  • spark-viewer src/env.ts and src/viewer/common/logic/fetch.ts

Direction: owner, 12-04: "this is the kind of thing that i would like to build into the forge. dont love my data leaving"

🤖 Generated with Claude Code

commented

Direction change from the owner: rebuild the viewer the forge's own way, and do not host spark-viewer.

  • Keep the spark mod as the sampler on the box. It is the best collector there is. Its upload goes to the forge store described above, with the same POST/Location contract.
  • A native forge page decodes the profile. spark's .proto schemas are published in spark-common/src/main/proto, so the page decodes the protobuf itself. It shows:
    • a call tree and flame graph
    • the slowest ticks, and per-mod and per-plugin time
    • memory, GC, and the platform and mod list
  • No Next.js, no outside fetches, no mapping service. Fabric names on 1.21.6 come out of the official mappings; build a small table only if needed.
  • The same data feeds the games page numbers. TPS and tick time say "not reported" today. They should come from spark's health reports, or /spark tps parsed at check-in, so the box's pane shows them live.
  • Findings link to the slow frame. For example: "tick time 62 ms p95, chunk generation 40%: pre-generate while nobody is on (C2ME)".

🤖 Generated with Claude Code

commented

Red on three checks: pull #18096 failed its check 3 times in a row, so no builder starts on it again. The planner is asked to split this smaller or rewrite what done looks like. The last failure:

a join meets the job in order > freeze at once, then stop when memory is needed; the job goes back as interrupted, never done or abandoned

Sign in to join this conversation.

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

Keyboard shortcuts

Docs