Collector.Sender (collector v0.1.1)

Copy Markdown

Sends events to Collector in the background, one at a time, so that a slow or unreachable Collector 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, 401, 403, 404, 413 and 422 drop the event; resending can't help.

Summary

Functions

Returns a specification to start this module under a supervisor.

Queues event. Never blocks.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

send(server \\ __MODULE__, event)

Queues event. Never blocks.

start_link(opts)