Skip to main content

Ruby on Rails OpenTelemetry Instrumentation

Step 1: Install dependencies

Install dependencies related to OpenTelemetry SDK and exporter using gem.

gem install opentelemetry-sdk
gem install opentelemetry-exporter-otlp
gem install opentelemetry-instrumentation-all

Include the required packages into your gemfile.

gem 'opentelemetry-sdk'
gem 'opentelemetry-exporter-otlp'
gem 'opentelemetry-instrumentation-all'

Run the bundle install command:

bundle install

Step 2: Initialize the OpenTelemetry SDK

Initialize the otel sdk by adding below lines to config/environment.rb of your Ruby on Rails application.

require 'opentelemetry/sdk'
require_relative 'application'

OpenTelemetry::SDK.configure do |c|


Step 3: Running your Ruby application

Now we have to set the following environment variables to export the collected telemetry data for storage and visualization.

  • OTEL_EXPORTER : It is the format of exported data. Since SigNoz natively supports otlp so it should be set as otlp

  • OTEL_SERVICE_NAME : Name of service(anything you want)

  • OTEL_EXPORTER_OTLP_ENDPOINT : Specify the endpoint of OTEL collector in format http://IP_OF_SIGNOZ:4318. The OTEL collector comes bundled with SigNoz installation. Since, we installed SigNoz on our local machine, the endpoint is http://localhost:4318.

  • OTEL_RESOURCE_ATTRIBUTES : Pass custom attributes like application name with OTEL_RESOURCE_ATTRIBUTES=application=yourAppName

Using the above mentioned environment variables, run the application:

OTEL_EXPORTER=otlp OTEL_SERVICE_NAME=yourSampleRailsApp OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 OTEL_RESOURCE_ATTRIBUTES=application=sparkapp rails server


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

Here's a detailed guide published by our community member Vederis on how to monitor your Ruby on Rails application with OpenTelemetry and SigNoz.

Sample Ruby on Rails application

We have included a sample Ruby on Rails application with at Sample Rails App Github Repo.

Feel free to use this repo to test out OpenTelemetry instrumentation and how to send telemetry data to SigNoz.

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.