Impact. Runtime
(Impact v0.0.1)
Copy Markdown
One-call runtime configuration. Designed to be invoked from config/runtime.exs
in a Phoenix/Mix application — BEFORE any application starts — so the
:opentelemetry and :opentelemetry_exporter supervision trees boot with
Impact's OTLP endpoint and auth header already wired in.
Why this exists
The Erlang OpenTelemetry exporter reads its endpoint and headers from
Application env at supervision-tree startup. Calling Impact.init/1 from
inside a running application is too late — the exporter has already booted
with empty config and will not pick up new values without being restarted.
config/runtime.exs is the standard Elixir hook that runs after compile
but before any application starts. It is the correct seam for this kind
of dependency-time configuration.
Usage in a Phoenix / Mix app
# config/runtime.exs
import Config
Impact.Runtime.configure!()That single line is the full integration. :impact reads
IMPACT_API_KEY (required) and IMPACT_BASE_URL (optional — derived from
the key's region if absent) at boot. No Impact.init/1 call is required;
the :impact OTP application picks the config up on its own start.
Usage in a one-off script
Mix scripts (mix run path.exs) do not evaluate config/runtime.exs,
so scripts must call Impact.Runtime.configure!/1 at the top with
--no-start, then start apps explicitly:
Impact.Runtime.configure!(api_key: "impact_dev_...")
{:ok, _} = Application.ensure_all_started(:impact)Overrides
All values can be passed as keyword options, taking precedence over env vars:
Impact.Runtime.configure!(
api_key: "impact_dev_...",
endpoint: "https://api.dev.impact.ai",
service_name: "my_app",
resource_attributes: %{deployment: %{environment: "staging"}}
)
Summary
Functions
@spec configure!(keyword()) :: :ok