ex_flux v0.1.0 ExFlux.Database.QueueWorker View Source

Async queueing of ExFlux.Points and load shedding per database

Batching must be done per-database. To support this effectively, a single worker for each database receives datapoints from your service. If the queue is sufficiently full, it will command one of its pool workers to send a portion of your stats using the configured connection (UDP or HTTP).

The queue is implemented via Erlang’s :queue and the size is tracked alongside the queue to reduce the frequency of calculating the length.

Link to this section Summary

Functions

Schedule a the initial flush of queued data points, create the :queue, and initialize the size which is tracked manually to avoid calculating the length of the queue via :queue.len/1

Link to this section Functions

Link to this function init(config) View Source
init(config :: map()) :: {:ok, %{queue: :queue.queue(), config: map(), size: non_neg_integer()}}

Schedule a the initial flush of queued data points, create the :queue, and initialize the size which is tracked manually to avoid calculating the length of the queue via :queue.len/1