Sinatra

Sinatra applications are officially supported. Instrumenting Sinatra applications requires some manual setup. Follow the installation steps in AppSignal, starting by clicking 'Add app' on the accounts screen.

Is your application using a combination of Grape, Hanami, Padrino or Sinatra? Follow our guide for instrumenting multiple Rack applications.

Installation

After installing the AppSignal gem, add the AppSignal integration before requiring sinatra (or sinatra/base).

ruby
require "appsignal" # Add this require require "sinatra" # or require "sinatra/base" # Load the Sinatra integration Appsignal.load(:sinatra) # Start AppSignal Appsignal.start # For Ruby gem 3.11 and older require "appsignal/integrations/sinatra"

Then, create the AppSignal configuration file config/appsignal.yml. For more details on configuring AppSignal, see the Ruby configuration page.

After these steps, start your Sinatra app and wait for data to arrive in AppSignal.

Ignoring errors

To ignore a specific Sinatra error, set the Sinatra.skip_appsignal_error flag in the request environment. This flag will tell AppSignal to ignore the error that occurs during the request and not report it to AppSignal.

Only ignore errors like this if you need to ignore errors from a Sinatra app using code. See the ignore_errors option to ignore it for the entire app. To avoid being notified about an error, see our notification settings.

ruby
get "/" do env["sinatra.skip_appsignal_error"] = true # Add this line to an endpoint or callback raise "uh oh" # Example error, don't copy this end