# `Tlm.Sender`

Sends events to Tlm in the background, one at a time, so that a
slow or unreachable Tlm never slows the app down.

  * The queue is bounded (1000 events by default); when full, the
    oldest event is dropped.
  * A 5xx or network error resends the same event (same uuid, so it is
    counted once) after a backoff of 1s, 2s, 4s, … up to a minute, at
    most 8 times.
  * An event that can't be encoded as JSON is dropped.
  * A 429 means "slow down": that event was already counted, so it is
    dropped, and sending pauses for `Retry-After` seconds.
  * 400, 404, 413 and 422 drop the event; resending can't help.
  * 401 or 403 mean the key isn't accepted: nothing more is sent, events
    or heartbeats, until the app restarts with another.
  * A 425 (sent as TLS early data) is resent, like a 5xx.

Heartbeats (see `Tlm.Heartbeat`) share the queue, with their own
rules, all silent:

  * At most one waits in the queue: a newer one replaces it.
  * A 5xx or network error resends it, like an event.
  * A 429 drops it without pausing events (heartbeats have their own
    budget), and later ones are dropped until `Retry-After` passes.
  * 401 or 403 stop heartbeats; 404 (a Tlm without heartbeats),
    413 and 422 drop that one; 425 resends it.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `heartbeat`

Queues a heartbeat, replacing one still waiting. Never blocks.

# `send`

Queues `event`. Never blocks.

# `start_link`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
