OtlpShipper.Config (otlp_shipper v0.1.1)

Copy Markdown View Source

Validated OTLP/HTTP configuration. All time values are milliseconds.

Explicit options override signal-specific OTEL variables, then generic OTEL variables. endpoint is an exact signal URL; base_endpoint appends v1/logs or v1/metrics. Use load/2 to read the environment once at startup.

timeout bounds an entire export, including retries. Queue/batch limits apply per component; the queue and one in-flight batch can coexist. Configuration changes require restarting the component. Headers/resources are hidden by Inspect.

Summary

Functions

Resolves configuration using the current environment at startup.

Resolves and validates configuration without accessing global state.

Types

t()

@type t() :: %OtlpShipper.Config{
  compression: term(),
  endpoint: term(),
  flush_ms: term(),
  headers: term(),
  max_batch: term(),
  max_batch_bytes: term(),
  max_item_bytes: term(),
  max_queue: term(),
  max_response_bytes: term(),
  max_retries: term(),
  resource: term(),
  retry_base_ms: term(),
  retry_max_ms: term(),
  shutdown_ms: term(),
  signal: term(),
  timeout: term()
}

Functions

load(signal, opts \\ [])

@spec load(atom(), keyword()) ::
  {:ok, t()} | {:error, atom()} | {:error, atom(), atom()}

Resolves configuration using the current environment at startup.

new(signal, opts \\ [], env \\ %{})

@spec new(atom(), keyword(), map()) ::
  {:ok, t()} | {:error, atom()} | {:error, atom(), atom()}

Resolves and validates configuration without accessing global state.

iex> {:ok, config} = OtlpShipper.Config.new(:logs, service_name: "checkout")
iex> config.endpoint
"http://localhost:4318/v1/logs"

iex> OtlpShipper.Config.new(:traces, service_name: "checkout")
{:error, :invalid_signal}