---
title: Sinatra instrumentation
source: https://docs.newrelic.com/docs/apm/agents/ruby-agent/instrumented-gems/sinatra-instrumentation
---

New Relic's Ruby agent works with [Sinatra](http://www.sinatrarb.com/) 1.2.x or higher. In the New Relic UI, the Sinatra actions appear similar to controller actions. 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:

    ```ruby
    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 browser monitoring. For more information about required middlewares, see [Rack middlewares](https://docs.newrelic.com/docs/ruby/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:

```ruby
newrelic_ignore '/ping'

    get '/ping' do
      # ...
    end
```

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

```ruby
newrelic_ignore
```

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

[Padrino](http://www.padrinorb.com/ "Link opens in a new window") 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) [#shotgun]

The New Relic Ruby agent will not work with [shotgun](http://rubygems.org/gems/shotgun "Link opens in a new window"). It cannot make a connection before the dispatcher process exits. Neither Developer mode nor Monitor mode will work.
