Knowledge Base: Monitoring Rails Applications
Supported versions of Rails
Dash supports Rails >= 2.1. For more information, see the Support Scale page.
Installation
After adding a new Dash application, you'll need to instrument your Rails application using the following steps.
Step 1: Add the gem dependencies
First, we need to add some gem dependencies in your
config/environment.rb
Reference the gems inside the Rails::Initializer
block.
Rails::Initializer.run do |config|
# ...
config.gem 'fiveruns-dash-rails',
:lib => 'fiveruns_dash_rails',
:source => 'http://gems.github.com'
# ...
end
Note: The fiveruns-dash-rails gem
depends on the fiveruns-dash-ruby and
fiveruns-dash-activerecord gems.
Step 2: Install the gems
Inside your Rails application, execute the following Rake task:
$ rake gems:install
This should install fiveruns-dash-ruby and any
other dependencies.
Step 3: Configure your App tokens and environments
An application token will be used to identify your application (running in a specific environment) to Dash; you'll need to create a new Dash application for every environment you intend to monitor—since performance characteristics of environments can wildly differ, it doesn't make sense to mix the data, and sometimes it's very useful to compare them.
You can find the application token for your app in its "Configuration" pages.
Create config/initializers/dash.rb and add this
code:
if defined?(Fiveruns::Dash)
Fiveruns::Dash::Rails.start(:production => 'YOUR-APP-TOKEN-HERE')
end
Please note that instrumenting the
development environment is not
recommended. If you insist on doing so, you will need to disable
automatic class reloading (config.cache_classes = true
in config/environments/development.rb) to capture any
custom-defined metrics.
For more information and to add your own recipes and custom metrics (which we strongly recommend), see the Customization Guide.
Step 4: Restart your application and begin collecting data
After restarting your application, "exercise" your app a bit; you should see data flow into Dash within a minute or two.
Customization
The Ruby Customization Guide contains a more in-depth look at how to customize your configuration to include your own custom metrics.