Is your application using a combination of Rails, Grape, Hanami, Padrino or Sinatra? Follow our guide for instrumenting multiple Rack applications.
Installation
After installing and configuring the AppSignal gem, add the AppSignal integration after the Grape app is loaded. The Grape integration is required from the AppSignal Ruby gem, and the event and instrumentation middlewares are added in the following code examples.Legacy installation
Applications using AppSignal for Ruby gem 3.11 or older, follow these steps to install AppSignal in Grape applications. The Grape integration is required from the AppSignal Ruby gem, and the event handler and instrumentation middlewares are added in the following code examples.Mounted Grape apps
Mounting Grape applications on Ruby on Rails applications is supported. The Ruby gem needs to be a recent version to properly instrument requests for mounted Grape apps.Ignoring errors
To ignore a specific Grape error, set thegrape.skip_appsignal_error flag in the request environment. Setting this flag to true will instruct AppSignal not to report any errors during the request.
Use this flag only if you need to dynamically ignore errors from a Grape application. Specify error classes in the ignore_errors option to ignore them for the entire application. For more information on muting notifications for specific errors see our notification settings documentation.
Reporting errors from rescue_from
If an error is rescued in the app using rescue_from, AppSignal will not receive and track it. To still report the error, call Appsignal.report_error in the rescue_from block. (Use the Appsignal.set_error helper when using Ruby gem version 3 or older.)