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
11
packages/ludic.telemetry/index.ludic
Normal file
11
packages/ludic.telemetry/index.ludic
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# ludic.telemetry - what a game says about how it is played: each event is encoded once into a
|
||||
# line, the lines go out in batches on Http's own thread, and a failed send waits longer next time
|
||||
module ludic_telemetry uses ludic_base
|
||||
numbers float
|
||||
import "ludic.base"
|
||||
import "state.ludic"
|
||||
import "ports.ludic"
|
||||
import "queue.ludic"
|
||||
import "send.ludic"
|
||||
import "ident.ludic"
|
||||
import "queries.ludic"
|
||||
Loading…
Add table
Add a link
Reference in a new issue