Sinatra support

Starting in version 2.10, New Relic's Ruby agent works with Sinatra. Sinatra 1.2.x and higher is supported.

Sinatra actions appear in the user interface similar to controller actions with breakdown charts and transaction traces. Error collection and cross application tracing are available as well.

The actions in the UI correspond to the pattern expression used to match them. HTTP operations are not distinguished. Multiple matches are all tracked as separate actions.

Getting started

To get started, install the latest newrelic_rpm gem and do

require 'newrelic_rpm'

in your Sinatra app, below the Sinatra require directive.

Then set RACK_ENV to the environment corresponding to the configuration definitions in the newrelic.yml file; i.e., development, staging, production, etc.

Note: Developer mode only works with Rails.

Middleware installation

Versions of the Ruby agent prior to 3.6.3 required manual addition of New Relic middlewares to enable certain features such as cross-application tracing and real user monitoring auto-instrumentation.

See Rack Middlewares for detailed instructions on the middlewares necessary, or upgrade to the most recent agent.

Ignoring routes

Version 3.6.3 and later of the Ruby agent support ignoring certain routes, similar to what's previously been available in Rails controller instrumentation.

Ignores are specified via the same style of routes used to define your Sinatra application. For example, to ignore a ping route in a Sinatra app, you would include the following code in the app:

newrelic_ignore '/ping'

If you want an entire application to be ignored (in a mounted application for instance), you can simply call newrelic_ignore without parameters:


Additionally, newrelic_ignore_apdex and newrelic_ignore_enduser are supported. newrelic_ignore_apdex will exclude a given route from consideration in overall apdex calculations. newrelic_ignore_enduser will prevent automatic injection of real user monitoring javascript when a route is rendered.


Padrino is a framework built on top of Sinatra. Starting with Ruby agent version 3.6.3, New Relic's Sinatra instrumentation works with Padrino. Versions 0.10.x and later of Padrino are supported.


The New Relic Ruby agent will not work with shotgun. It cannot make a connection before the dispatcher process exits. Neither Developer mode nor Monitor mode will work.

For more help

If you need additional help, get support at