Sinatra support

New Relic's Ruby agent works with Sinatra 1.2.x or higher. The Sinatra actions appear in the user interface similar to controller actions, including dashboards and breakdown charts. Other features depend on your New Relic subscription level.

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 set up Sinatra:

  1. Install the latest newrelic_rpm gem.
  2. In your Sinatra app, immediately below the Sinatra require directive, add:

    require 'newrelic_rpm'
  3. Set RACK_ENV to the environment corresponding to the configuration definitions in your newrelic.yml file; for example, development, staging, production, etc.

Note: Developer mode only works with Rails.

Middleware installation

Ruby agent versions prior to 3.6.3 required manual addition of New Relic middlewares to enable certain features, such as cross application tracing and auto-instrumentation for page load timing (sometimes referred to as real user monitoring or RUM). For more information about required middlewares, see Rack middlewares, or upgrade to the most recent Ruby agent.

Ignoring routes

Ruby agent versions 3.6.3 or higher support ignoring certain routes, similar to what was previously available in Rails controller instrumentation. To specify these values, use the same style of routes that you use to define your Sinatra application. For example, to ignore a ping route in a Sinatra app, include the following code in the app:

    newrelic_ignore '/ping'

    get '/ping' do
      # ...

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


Additionally, newrelic_ignore_apdex and newrelic_ignore_enduser are supported.

  • The newrelic_ignore_apdex call will exclude a given route from consideration in overall Apdex calculations.
  • The newrelic_ignore_enduser call will prevent automatic injection of the page load timing 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 or higher.

Shotgun (not 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

Additional documentation resources include:

  • Middleware changes in 3.9.0 (summary of request timing changes as of Ruby agent version 3.9.0)
  • Page load timing in Ruby (requirements, auto-instrumentation, manual instrumentation, and troubleshooting your Ruby agent configuration for page load timing, sometimes referred to as real user monitoring or RUM)

If you need additional help, get support at