Integrating AppSignal in Ruby

It's possible that AppSignal does not provide automatic integration for your framework of choice, or maybe you're using your own application setup.

See our list of supported integrations to see what frameworks and gems we support with the AppSignal gem.

When AppSignal does not support your application automatically, it's still possible to add AppSignal instrumentation. Our Ruby gem needs to be configured and started once at the beginning of a process. It can be configured through a configuration file or by using environment variables.

Configuration

Environment variables

When using environment variables to configure AppSignal the gem will read the configuration from the environment once it starts. Calling Appsignal.start is enough.

ruby
require "appsignal" # Load your app Appsignal.start

Configuration file

When using a configuration file to configure AppSignal, the Ruby gem needs to be configured before it is started. It will look for the config/appsignal.yml file in the current working directory of the application process. Alternatively, it can also be configured using the Appsignal.configure helper as shown in the example below.

ruby
require "appsignal" # Require the AppSignal gem # Optional: load integrations manually # These integrations need to be loaded before `Appsignal.configure` is called. # Appsignal.load(:sinatra) # Optional: Configure AppSignal via the configure helper # Appsignal.configure do |config| # # Some config # end # Lastly, start AppSignal Appsignal.start

AppSignal will look in the path of the first argument for a config/ directory containing an appsignal.yml file to load the configuration. The second argument is the environment it will load from the configuration file.

Next steps

Continue with our instrumentation for scripts and background jobs guide for applications that we don't automatically instrument. Use instrumentation helpers to break down the instrumented code in more detail.