Skip to main content
There is no Squasher SDK for Ruby. Use OpenTelemetry, the Sentry SDK for Ruby, or the HTTP API. This page is tested with the OpenTelemetry Ruby SDK 1.13, Sinatra 4, and sentry-ruby 7.0 on Ruby 4.0.

Send errors with OpenTelemetry

1

Add the gems

Gemfile
Then run bundle install.
2

Configure the SDK

config/initializers/opentelemetry.rb
use_all turns on the instrumentation for each gem that it finds, such as Rack, Rails, Sinatra, and ActiveRecord.
3

Set the exporter variables

The Ruby exporter sends OTLP over HTTP, which Squasher needs. OTLP requests do not need the project ID. To get a key, see Create an ingest key.
The app sends traces. Automatic AI triage runs only on issues from the production environment, so set deployment.environment.name to production in production.

How errors become issues

A span with the error status becomes an issue. Squasher titles the issue with the status message, or with the span name when the message is empty. An exception recorded on a span without the error status also becomes an issue, titled with the exception message.
  • An unhandled exception in a Sinatra request. The Rack instrumentation marks the request span as an error, with the exception class as the message, and records the exception. The issue title is, for example, RuntimeError.
  • An error that you catch. Record it on a span and set the status yourself:
    The issue title is the error message. record_exception alone also makes an issue, titled with the exception message.
The issue page shows the stack trace that record_exception sends.

Use the Sentry SDK for Ruby

If your app already uses sentry-ruby, point its DSN at Squasher. Squasher reads the gzip envelopes that sentry-ruby sends for large events.
config/initializers/sentry.rb
The DSN is https://<ingest key>@ingest.squasher.ai/1. The ingest key selects the project; the SDK needs a number at the end. Squasher keeps errors, traces, logs, metrics, and sessions from the SDK, so you can keep tracing on. See Sentry for what each item becomes.

Send errors with the HTTP API

This module posts one error to the ingest endpoint with the standard library:
lib/squasher.rb
Call Squasher.capture_exception(e, order_id: order.id) where you rescue an error. The call blocks until Squasher answers, so in a web request, run it in a background job. stack is shown as the stack trace on the issue page. See the HTTP API for all fields.

Send a test error

  • OpenTelemetry: add a route that runs raise "Squasher test error", and open it once.
  • HTTP API: run Squasher.capture_exception(RuntimeError.new("Squasher test error")).
Then select Issues in the sidebar of your project. If the error does not appear, see Troubleshooting.

Give the setup to a coding agent

Copy this prompt into your coding agent to set up Ruby the same way:

Next steps

OpenTelemetry

See which OTLP data Squasher accepts.

Move from Sentry

Move an app from Sentry to Squasher.

HTTP API

See every field of the ingest endpoint.

Troubleshooting

Find out why an event does not appear.