feat(ludic.telemetry): an event queue batched to a PostHog-shaped endpoint
Events are encoded once into lines held in memory; a batch is the first lines joined, with the player id put in where a mark stood, POSTed on Http's own thread every flush_ms or at flush_at events; a failure keeps its lines and doubles the wait up to backoff_max; the queue is on disk every save_ms and read back at the next start; off (the enabled port) drops the request in flight, empties the queue and deletes the file; and a run that may not send (can_send) keeps nothing. The player id is the machine's own id (MachineGuid, IOPlatformUUID, /etc/machine-id) hashed with the game's salt, else random; it lives in the game's id file beside whatever else the game keeps there. Ports: TelemetryWorld (can_send, enabled, now_ms, stamp) and TelemetryTransport (send, poll, drop; unbound: Http). Config is a record (host, key, path, lib, queue_file, id_file, id_salt, and the timings). Facts: TELEMETRY_SENT, _FAILED, _ID. Not a System: it runs from a launcher's first frame, before any world exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
cac8c740fa
commit
e8c1d54a96
10 changed files with 711 additions and 0 deletions
5
packages/ludic.telemetry/package.ludic
Normal file
5
packages/ludic.telemetry/package.ludic
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# ludic.telemetry - events queued in memory, batched to a PostHog-shaped endpoint, backed off when
|
||||
# offline, kept on disk between starts, and forgotten when the player says no. See README.md.
|
||||
package "ludic.telemetry"
|
||||
version "0.1.0"
|
||||
kind source
|
||||
Loading…
Add table
Add a link
Reference in a new issue