MiregoElixirOtelAgent.Config (mirego_elixir_otel_agent v0.2.0)

Copy Markdown View Source

Agent configuration.

Library-specific settings are nested under config :mirego_elixir_otel_agent, .... The official :opentelemetry and :opentelemetry_exporter applications are configured directly by the host app, just as if this library were not present.

The metric exporter reads OTLP settings from the official :opentelemetry_exporter application env (or from standard env vars) and passes them directly to this library's internal metric exporter at startup.

Example

# Official OTEL configuration — lives in the official OTP apps
config :opentelemetry,
  resource: [
    {"service.name", "my-app"},
    {"service.version", "1.0.0"}
  ],
  traces_exporter: :otlp,
  span_processor: :batch

config :opentelemetry_exporter,
  otlp_protocol: :http_protobuf,
  otlp_endpoint: System.fetch_env!("OTEL_EXPORTER_OTLP_ENDPOINT")

# This library's configuration
config :mirego_elixir_otel_agent,
  enabled: true,
  metric_export_period: 30_000,
  phoenix_adapter: :bandit

Options

  • :enabled (boolean) — when not true, start_link/1 returns :ignore. Default: false.

  • :metric_export_period (pos_integer) — metrics export interval in ms. Default: 30_000.

  • :phoenix_adapter (:bandit | :cowboy2) — adapter passed to OpentelemetryPhoenix.setup/1 when auto-instrumenting Phoenix. Default: :bandit.

  • :metric_exporter (keyword) — optional internal metric-exporter settings, such as :resource, :otlp_headers, and :otlp_timeout.

Summary

Functions

Whether the agent should run.

Metrics export interval in ms (default 30000).

Phoenix adapter used for auto-instrumentation (default bandit).

Resolve agent config from application env.

Types

t()

@type t() :: %{
  enabled: boolean(),
  metric_export_period: pos_integer(),
  phoenix_adapter: :bandit | :cowboy2
}

Functions

enabled?()

@spec enabled?() :: boolean()

Whether the agent should run.

metric_export_period()

@spec metric_export_period() :: pos_integer()

Metrics export interval in ms (default 30000).

phoenix_adapter()

@spec phoenix_adapter() :: :bandit | :cowboy2

Phoenix adapter used for auto-instrumentation (default bandit).

resolve()

@spec resolve() :: t()

Resolve agent config from application env.