Skip to main content

Elixir Opentelemetry Instrumentation

We’ll focus on instrumenting one of the most common combos of the Elixir world: Phoenix + Ecto.

Step 1: Add the required dependencies​

The first step to instrument your Elixir application with OpenTelemetry is to add the required dependencies to your mix.exs file and fetch them with mix deps.get

{:opentelemetry, "~> 1.0.3"},
{:opentelemetry_exporter, "~> 1.0.3"},
{:opentelemetry_phoenix, "~> 1.0.0"},
{:opentelemetry_ecto, "~> 1.0.0"}

Step 2: Configure the Elixir application to export telemetry data​

Then we need to configure our application to export telemetry data. There are two things that you need to set:

    You can put your application or service name here for identification.
  • OTEL Collector endpoint
    The OTEL collector comes bundled with SigNoz installation. Since, we installed SigNoz on our local machine, the endpoint is http://localhost:4318.
config :opentelemetry, :resource, service: %{name: "YOUR_APP_NAME"}

config :opentelemetry, :processors,
otel_batch_processor: %{
exporter: {
%{endpoints: ["http://localhost:4318"]}

Step 3: Initialize telemetry handlers​

As it is documented in the opentelemetry_phoenix and opentelemetry_ecto pages, we need to initialize both telemetry handlers.

OpentelemetryEcto.setup([:your_app_name, :repo])

:your_app_name should be replaced by your app name and congratulations, you have instrumented your application with OpenTelemetry.


Here's a tutorial with step by step guide on how to install SigNoz and start monitoring a sample Rust app.

Thanks to our community member Ricardo for creating this guide.

Frequently Asked Questions​

  1. How to find what to use in IP of SigNoz if I have installed SigNoz in Kubernetes cluster?

    Based on where you have installed your application and where you have installed SigNoz, you need to find the right value for this. Please use this grid to find the value you should use for IP of SigNoz

  2. I am sending data from my application to SigNoz, but I don't see any events or graphs in the SigNoz dashboard. What should I do?

    This could be because of one of the following reasons:

    1. Your application is generating telemetry data, but not able to connect with SigNoz installation

      Please use this troubleshooting guide to find if your application is able to access SigNoz installation and send data to it.

    2. Your application is not actually generating telemetry data

      Please check if the application is generating telemetry data first. You can use Console Exporter to just print your telemetry data in console first. Join our Slack Community if you need help on how to export your telemetry data in console

    3. Your SigNoz installation is not running or behind a firewall

      Please double check if the pods in SigNoz installation are running fine. docker ps or kubectl get pods -n platform are your friends for this.