Skip to main content
Grape applications are officially supported. Instrumenting Grape 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 Rails, Grape, Hanami, Padrino or Sinatra? Follow our guide for instrumenting multiple Rack applications.

Installation

This installation guide is for Ruby gem 3.12 and newer. For applications using an older AppSignal for Ruby gem, follow our legacy installation guide.
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.
The next step is to add the AppSignal middleware to the application’s base API class. It will report any unhandled exceptions from the application.

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.
The next step is to add the AppSignal middleware to the application’s base API class. It will report any unhandled exceptions from the application.

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 the grape.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.)