All Integrations
Languagestigerops gem

Ruby Integration

Auto-instrument Ruby applications with one gem install. Rack and Rails tracing, GC heap metrics, ActiveRecord query spans, and Sidekiq job visibility — zero configuration.

Setup

How It Works

01

Install the Gem

Add gem "tigerops" to your Gemfile and run bundle install. The gem bundles the OpenTelemetry Ruby SDK with TigerOps-specific exporters, GC instrumentation, and Rack/Rails auto-patching.

02

Add the Initializer

Create config/initializers/tigerops.rb and call TigerOps.configure. For bare Rack apps, require "tigerops/auto_instrument" at the top of your config.ru before the application is built.

03

Set Your API Key

Export TIGEROPS_API_KEY as an environment variable. TigerOps reads TIGEROPS_SERVICE_NAME and TIGEROPS_ENVIRONMENT automatically from the environment or from the initializer block.

04

Traces, GC & Logs Flow In

Within seconds TigerOps receives Rack request spans, ActiveRecord query traces, GC major/minor counts, heap live slots, and structured logs forwarded from the Rails logger.

Capabilities

What You Get Out of the Box

GC Telemetry & Heap Metrics

Major and minor GC counts, GC time, heap live slots, heap free slots, and object allocation rates sampled via ObjectSpace and GC.stat. TigerOps alerts on heap growth trends before OOM occurs.

Rack Middleware Tracing

TigerOps inserts a Rack middleware that creates root spans for every HTTP request. Route, method, status code, and middleware chain timings are captured automatically for all Rack-compatible frameworks.

ActiveRecord Query Spans

Every ActiveRecord query becomes a child span with normalized SQL, adapter type, row count, and connection acquisition time. Slow queries are flagged and N+1 patterns are detected automatically.

Background Job Visibility

Sidekiq and Resque workers are auto-instrumented. Each job execution creates a trace with enqueue time, queue wait, execution duration, retry count, and exception details if the job fails.

Faraday & Net::HTTP Tracing

Outbound HTTP calls via Faraday, Net::HTTP, HTTParty, and Typhoeus are automatically wrapped in child spans with URL, method, status, and duration. W3C TraceContext headers are propagated.

Puma & Unicorn Worker Metrics

Thread pool utilization, request backlog, and worker count for Puma. Worker memory and request counts per fork for Unicorn. Both servers expose metrics via their internal stats APIs.

Configuration

Install & Initialize

One gem install. One initializer. Full Ruby observability.

terminal + config/initializers/tigerops.rb
# Install the tigerops gem
gem install tigerops

# Or add to Gemfile
gem "tigerops"

# Then run
bundle install

# Set environment variables
export TIGEROPS_API_KEY="your-api-key"
export TIGEROPS_SERVICE_NAME="my-rails-app"
export TIGEROPS_ENVIRONMENT="production"

# config/initializers/tigerops.rb
TigerOps.configure do |config|
  config.api_key     = ENV["TIGEROPS_API_KEY"]
  config.service_name = ENV.fetch("TIGEROPS_SERVICE_NAME", "rails-app")
  config.environment  = ENV.fetch("TIGEROPS_ENVIRONMENT", "production")

  # Enable specific instrumentations
  config.instrument :active_record   # SQL query spans
  config.instrument :action_controller
  config.instrument :sidekiq         # background job traces
  config.instrument :faraday         # outbound HTTP spans
  config.instrument :redis

  # GC metrics collection interval (seconds)
  config.gc_metrics_interval = 10
end

# Custom span example in a service object
class PaymentService
  def charge(order)
    TigerOps.tracer.in_span("payment.charge") do |span|
      span.set_attribute("order.id", order.id)
      span.set_attribute("payment.amount_cents", order.total_cents)

      result = stripe_client.charges.create(
        amount: order.total_cents,
        currency: "usd",
        source: order.payment_token
      )

      span.set_attribute("payment.charge_id", result.id)
      result
    rescue Stripe::CardError => e
      span.record_exception(e)
      span.status = OpenTelemetry::Trace::Status.error(e.message)
      raise
    end
  end
end
FAQ

Common Questions

Which Ruby versions does the tigerops gem support?

Ruby 3.0, 3.1, 3.2, and 3.3 are fully supported. Ruby 2.7 is supported on a best-effort basis. JRuby 9.4+ is supported with JVM metrics in addition to MRI GC metrics. TruffleRuby support is experimental.

Does the gem work with Zeitwerk and Rails autoloading?

Yes. The initializer is loaded after Zeitwerk completes autoloading, so there are no const_missing conflicts. For eager loading in production, TigerOps patches are applied after Rails.application.initialize! completes.

Can I use TigerOps with existing OpenTelemetry Ruby instrumentation?

Yes. The tigerops gem delegates to the opentelemetry-sdk gem. If you already have OTel configured, add the TigerOps OTLP exporter to your existing exporter list. All span and metric formats are compatible.

How does TigerOps handle multi-threaded Puma workers?

Each Puma thread gets its own trace context via thread-local storage. TigerOps correctly propagates context across async operations and Fiber-based code. The Puma stats endpoint is polled every 15 seconds for worker metrics.

Does TigerOps support Rails engines and mountable apps?

Yes. The Rack middleware is inserted at the top of the middleware stack and traces all mounted engines and Rack apps. Each engine can be tagged with a custom service.name attribute via the initializer.

Get Started

Full Ruby Observability in One Gem Install

GC metrics, Rack tracing, ActiveRecord spans, and Sidekiq job visibility — no code changes required.