ScoutApm.Logging.LogService (scout_apm v2.0.0)
Copy MarkdownBackground GenServer that batches and sends log records to an OTLP collector.
Implements a queue with batching and a maximum queue size to prevent memory issues. Follows the same pattern as ScoutApm.Error.ErrorService.
Summary
Functions
Returns a specification to start this module under a supervisor.
Waits for the queue to drain. Used in tests and shutdown.
Checks if logging is enabled.
Forces an immediate flush of queued logs. Used in tests.
Returns the current queue size.
Sends a log record to the service for batched delivery. Non-blocking - returns immediately.
Types
@type t() :: %ScoutApm.Logging.LogService{ queue: :queue.queue(ScoutApm.Logging.LogRecord.t()), queue_size: non_neg_integer(), timer_ref: reference() | nil }
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec drain(timeout :: non_neg_integer()) :: :ok | :timeout
Waits for the queue to drain. Used in tests and shutdown.
@spec enabled?() :: boolean()
Checks if logging is enabled.
@spec flush() :: :ok
Forces an immediate flush of queued logs. Used in tests.
@spec queue_size() :: non_neg_integer()
Returns the current queue size.
@spec send(ScoutApm.Logging.LogRecord.t()) :: :ok
Sends a log record to the service for batched delivery. Non-blocking - returns immediately.