Elixir

Send OpenTelemetry traces from any Elixir or Phoenix server to Sophonz using the official opentelemetry Erlang/Elixir packages — no Sophonz package required.

There is no sophonz hex package, and you don't need one. Sophonz's collector speaks standard OTLP, so any Elixir service can send it traces using the official opentelemetry Erlang/Elixir packages, a few lines of application config, and environment variables for the connection details.

What you get

  • The official Erlang/Elixir SDK — opentelemetry + opentelemetry_api + opentelemetry_exporter, which ships an OTLP exporter that reads OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_PROTOCOL, and OTEL_EXPORTER_OTLP_HEADERS automatically.
  • Drop-in instrumentation packages for the libraries most Phoenix apps already use — opentelemetry_phoenix for controller/LiveView spans, opentelemetry_bandit or opentelemetry_cowboy for the HTTP layer depending on your adapter, and opentelemetry_ecto for database query spans — each attaches to :telemetry events your app is likely already emitting.
  • Automatic resource attribute detection from the OS environment — the SDK reads OTEL_RESOURCE_ATTRIBUTES by default via its built-in resource detector.

How it works

The Erlang/Elixir SDK is configured through a small amount of Application config rather than only environment variables — this is standard OTel-Erlang practice, still nothing Sophonz-specific:

  1. In config/runtime.exs, tell :opentelemetry to batch spans and export them over OTLP (span_processor: :batch, traces_exporter: :otlp).
  2. Add the instrumentation packages for Phoenix, your HTTP adapter, and Ecto — each one attaches to telemetry events on application start (typically in Application.start/2).
  3. Environment variables handle everything about where telemetry goes and who it belongs to: the collector endpoint, protocol, headers, and resource attributes including service.key.

CAUTION — Telemetry without a valid service.key is dropped silently

Sophonz's collector runs in enforce mode: it accepts the OTLP payload over the wire but silently drops anything that doesn't carry a resolvable service.key resource attribute. There's no error in your app and no rejected request — the console will simply stay empty. Double-check OTEL_RESOURCE_ATTRIBUTES (and OTEL_EXPORTER_OTLP_HEADERS) before assuming something else is broken.

TIP — Where to next

Head to Installation for the exact mix.exs dependencies, config, environment variable table, and Phoenix/Ecto notes.