ex_flux v0.2.0 ExFlux.Database.QueueWorker View Source
Async queueing of ExFlux.Point
s 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
Returns a specification to start this module under a supervisor.
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
Returns a specification to start this module under a supervisor.
See Supervisor
.
init(config)
View Sourceinit(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