Insider.Collector.Logger (Insider v0.1.0)

Copy Markdown View Source

Supervised, bounded ingestion of structured OTP Logger events.

OTP invokes handlers synchronously in the logging process. The handler only performs bounded shaping and a single fixed-slot ETS insertion. This process drains that inbox into the recorder, keeping recorder recovery and pressure work out of application logging paths.

Set include_payload: false to retain only normalized semantic attributes and record payload: nil; this prevents Logger message content from entering the recorder when a capture needs a stricter privacy boundary.

Set rich: true (with the payload included) to record the formatted message text, the level, and the rendered Logger metadata instead of the bounded message shape, with credentials masked. The live session's rich disclosure profile uses it.

A gate with a Logger summary (Insider.Collector.Gate) counts the messages it summarises by level, message template and call site, a burst; every interval this process records one logger_summary event per burst, after recording the burst's first message of the interval as its exemplar, and names the exemplar's receipt. The gate admits at most Insider.Collector.Gate.max_bursts/0 bursts per interval; the messages of the others are one overflow event per level, which counts the bursts folded into it.

Summary

Functions

Returns a specification to start this module under a supervisor.

Drains the currently visible bounded inbox before returning collector status.

Removes the Logger filter, then drains the inbox, records every pending burst interval, and stops, so every event admitted before the removal is recorded or summarised. A filter call already running in another process when the filter is removed may still insert after the drain.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

flush(server)

@spec flush(GenServer.server()) :: {:ok, map()} | {:error, :unavailable}

Drains the currently visible bounded inbox before returning collector status.

This is a barrier for entries visible when the collector handles the call. Callers must quiesce producers before using it as an incident freeze boundary; concurrently executing Logger filters may insert after the bounded scan.

start_link(arg1)

@spec start_link({Insider.Recorder.Handle.t(), keyword()}) :: GenServer.on_start()

start_link(recorder, options)

status(server)

@spec status(GenServer.server()) :: {:ok, map()} | {:error, :unavailable}

stop(server)

@spec stop(GenServer.server()) :: {:ok, map()} | {:error, :unavailable}

Removes the Logger filter, then drains the inbox, records every pending burst interval, and stops, so every event admitted before the removal is recorded or summarised. A filter call already running in another process when the filter is removed may still insert after the drain.