Mmtrix Ruby Agent

Mmtrix is a performance management system, developed by Mmtrix, Inc (http://www.mmtrix.com). It provides you with deep information about the performance of your Rails or Ruby application as it runs in production. The Mmtrix Ruby Agent is dual-purposed as a either a Gem or a Rails plugin, hosted on (http://git.mmtrix.com/mmtrix/mmtrix_rpm/tree/master).

The Mmtrix Ruby Agent runs in one of two modes:

Production Mode Low overhead instrumentation that captures detailed information on your application running in production and transmits them to mmtrix.com where you can monitor them in real time.

Developer Mode A Rack middleware that maps /mmtrix to an application for showing detailed performance metrics on a page by page basis. Installed automatically in Rails applications.

Supported Environments

  • Ruby 1.8.7, REE, 1.9.x, 2.0.x, 2.1.x, 2.2.x
  • JRuby 1.6 and 1.7
  • Rubinius 2.x (Experimental support only)
  • Rails 2.1 or later for Production Mode
  • Rails 2.3 or later for Developer Mode
  • Sinatra
  • Rack

Getting Started

Add the Ruby Agent to your project's Gemfile.

gem 'mmtrix_rpm'

To monitor your applications in production, create an account at http://mmtrix.com/ . There you can sign up for a free Lite account or one of our paid subscriptions.

Once you receive the welcome e-mail with a license key and mmtrix.yml file. You can copy the mmtrix.yml file into your app config directory OR can generate the file manually with command:

mmtrix install --license_key="YOUR_KEY" "My application"

The initial configuration is done in the mmtrix.yml file. This file is by default read from the config directory of the application root and is subsequently searched for in the application root directory, and then in a ~/.mmtrix directory. Once you're up and running you can enable Server Side Config and manage your mmtrix configuration from the web UI.

Rails Installation

You can install the agent as a Gem:

For Bundler:

Add the following line to your Gemfile:

gem 'mmtrix_rpm'

For Rails 2.x without Bundler:

edit environment.rb and add to the initalizer block:

config.gem "mmtrix_rpm"

Sinatra Installation

To use the Ruby Agent with a Sinatra app, add

require 'mmtrix_rpm'

in your Sinatra app, below the Sinatra require directive.

Then make sure you set RACK_ENV to the environment corresponding to the configuration definitions in the mmtrix.yml file; e.g., development, staging, production, etc.

To use Developer Mode in Sinatra, add Mmtrix::Rack::DeveloperMode to the middleware stack. See the config.ru sample below.

Other Environments

You can use the Ruby Agent to monitor any Ruby application. Add

require 'mmtrix_rpm'

to your startup sequence and then manually start the agent using

Mmtrix::Agent.manual_start

Developer Mode

When running the Developer Mode, the Ruby Agent will track the performance of every HTTP request serviced by your application, and store in memory this information for the last 100 HTTP transactions.

To view this performance information, including detailed SQL statement analysis, open /mmtrix in your web application. For instance if you are running mongrel or thin on port 3000, enter the following into your browser:

http://localhost:3000/mmtrix

Developer Mode is only initialized if the developer_mode setting in the mmtrix.yml file is set to true. By default, it is turned off in all environments but development.

Production Mode

When your application runs in the production environment, the New Mmtrix agent runs in production mode. It connects to the Mmtrix service and sends deep performance data to the UI for your analysis. To view this data, log in to http://mmtrix.com.

NOTE: You must have a valid account and license key to view this data online. Refer to instructions in Getting Started.

Mmtrix, Inc.