Supervised Erlang Logger handler exporting bounded OTLP/HTTP log batches.
Add {OtlpShipper.LogHandler, service_name: "checkout"} to your supervision
tree. This starts a dedicated Finch pool, buffer, and handler registration in
that order. A :rest_for_one supervisor refreshes registration after buffer or
pool failure. Shutdown removes the handler before draining the buffer.
Accepts all OtlpShipper.Config options plus :max_body_bytes (16,384 encoded
AnyValue bytes), :max_attribute_bytes (1024 encoded value bytes and key bytes),
:max_attributes (64), :level (:info), and :diagnostic_interval_ms (60,000).
Collection conversion is limited to 64 entries per container and depth eight.
For independent instances provide distinct :handler_id (default
:otlp_shipper), :finch_name (default OtlpShipper.LogHandler.Finch), and
:buffer_name (default OtlpShipper.LogHandler.Buffer), all atoms. These names
must be application-owned constants. :name optionally names the supervisor.
Configuration changes require a restart, except Logger's handler level/filters.
The application's primary Logger level still applies; it is never changed here.
Logging performs bounded conversion and direct ETS insertion in the caller, never an HTTP request or a message per event. Overflow drops oldest queued records. Crashes can lose queued/in-flight records and logs during restart. Export is best effort; retries can duplicate remotely accepted records.
Trace IDs come from complete valid otel_* event metadata, then the current
span if the optional tracing API is available. With that API installed, IDs
inherited from process metadata without an active span are ignored: the API can
leave stale IDs after detaching. Use a distinct explicit event pair for forwarded
logs. Exporter diagnostics and HTTP
client internal logs (Finch, Mint, NimblePool) are excluded to prevent recursion.
Failure diagnostics are rate limited, contain no payloads/headers/URLs, and use
domain [:otlp_shipper]. Telemetry still reports every export outcome.
Summary
Functions
Starts the supervised log pipeline. Invalid options return tagged errors.
Functions
@spec start_link(keyword()) :: Supervisor.on_start() | {:error, atom()} | {:error, atom(), atom()}
Starts the supervised log pipeline. Invalid options return tagged errors.