Skip to content
CloseYourItdocsPages

Documentation / Connect / Connect your apps

Ruby / Rails

The closeyourit-ruby gem sends errors, logs, slow queries and job metrics from a Rails app.

What it collects

On its own, with Rails:

  • unhandled exceptions, with the HTTP request that caused them;
  • errors in background jobs (ActiveJob and Sidekiq);
  • handled errors reported with Rails.error.report;
  • slow queries and slow methods;
  • background job metrics;
  • usage telemetry: which routes, jobs and keys really run, as Controller#action, never the address. Turn it off with usage_enabled = false.

When you ask for it:

  • structured logs, tied to the request by the same id: the ones you write with CloseYourIt.log and, with capture_rails_logs, the lines of Rails.logger;
  • performance issues: N+1, too many queries, slow HTTP calls.

It does not collect page views or record sessions: for those you need JavaScript.

Install

# Gemfile
gem "closeyourit-ruby"

Configure

# config/initializers/closeyourit.rb
CloseYourIt.init do |c|
  c.endpoint_url = "https://bugs.example.com"
  c.token        = ENV["CLOSEYOURIT_TOKEN"]
  c.project_id   = ENV["CLOSEYOURIT_PROJECT_ID"]
  c.environment  = Rails.env
end

Without an address, a token or a project the gem does nothing: it is safe in development and in tests.

Good to know

  • Sending happens in the background: it does not slow the request and never crashes the app.
  • Of the user only the id leaves. The visitor's IP, the query string, the request body and the rest of the user leave only with send_pii, which is off.
  • Some things leave as they are: the Referer header keeps its query string, and in error messages only the Authorization header and the credentials after Bearer, Basic or Token are hidden. Data the SDKs send lists everything the gem sends and hides.
  • In production an http:// address is refused: the token would travel in clear text.

OpenTelemetry and trace context

The native gem collects errors and performance issues. Its optional W3C propagation correlates requests; it does not turn the gem into an OTLP exporter. Use an official server-side exporter with the OpenTelemetry receiver for complete spans and general metrics. Verify the receiver is enabled before configuring it.