Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

155 lines (111 sloc) 6.066 kb

RackAmole

Observe your web applications in the wild!

DESCRIPTION

The MOle is a rack application that monitors user interactions with your web site. We are not 
talking about counting page hits here. The MOle tracks all the information available to capture
the essence of a user interaction with your application. Using the MOle, you are able to see
which feature is a hit or a bust. As an added bonus, the MOle also track performance and exceptions 
that might have escaped your test suites or alpha env. To boot your managers will love you for it! 

Whether you are releasing a new application or improving on an old one, it is always a good thing 
to know if anyone is using your application and if they are, how they are using it. 
What features are your users most fond of and which features find their way into the abyss? 
You will be able to rapidly assess whether or not your application is a hit and if
your coolest features are thought as such by your users. You will be able to elegantly record user
interactions and leverage these findings for the next iteration of your application.

PROJECT INFORMATION

Developer:  Fernand Galiana
Blog:       http://www.liquidrail.com
Site:       http://rackamole.com
Twitter:    http://twitter.com/rackamole
Forum:      http://groups.google.com/group/rackamole
Git:        git://github.com/derailed/rackamole.git

FEATURES

Monitors any rack based framework such as Rails and Sinatra
Captures the essence of the request as well as user information
Tracks performance issues based on your latency threshold
Tracks exceptions that might occurred during a request

REQUIREMENTS

Logging
Hitimes
mongo + mongo_ext
Chronic
Erubis
Twitter4r  
Mail
Growl

INSTALL

sudo gem install rackamole

USAGE

Rails applications

Edit your environments ruby files and add the following lines:

config.middleware.use Rack::Mole, { :app_name => "My Cool App", :user_key => :user_name }

This instructs the mole to start logging information to the console and look for the user name 
in the session using the :user_name key. In order to associate an action with a logged in user you
must set a session env variable, in this case we use user_name. There are other options available, 
please take a look at the docs for more information.

Sinatra Applications

Add the following lines in the config section and smoke it...

require 'rackamole'
configure do
  use Rack::Mole, { :app_name => "My Sinatra App", :user_key => :user_name }
end

This assumes that you have session enabled to identify a user if not the mole will log the user
as 'Unknown'

Notables

Rackamole also comes with an option to specify a yaml config file to initialize the various settings.
This comes in very handy when you need to specify different options depending on the environment you
are operating in. Please see the spec/test_configs/rackamole_test.yml for an example.

Storing moled information

Rackamole currently comes with a single storage strategy. More will come in the near future, but
currently we are using MongoDb as our default storage. The idea here is to create a database for
a given moled app per environment. For instance, for application 'Fred', you will need to use a 
separate store for Fred running in alpha mode and Fred running in production mode.

In order to use a store, you will need to pass in the :store option. There currently 2 store 
types a logger and a mongo adapter. By default the store is set to log moled information to the console. 
To change to a mongo store simply add the following options:

use Rack::Mole, { :app_name => "Fred", :store => Rackamole::Store::MongoDb.new( :db_name => 'mole_fred_alpha_mdb' ) }

This expect a local mongo instance to be running on the default port. You can change the 
location by adding :host and :port options.

NOTE: If you intend to use Wackamole please use the following mongo database naming convention

mole_{app_name}_{environment}_mdb

NOTE: Rackamole also provides for preventing certain sensitive params from being logged. You can specify
param_excludes or session_excludes as array of symbols to exclude specific request or session params.

Alerting

Rackamole provides 3 different kind of alerting mechanisms: twitter, email, growl
Please see docs for the various configuration settings.

For example to setup email alerts, add the following lines in your rackamole config file.

# Email
email: &email
  :from: 'rackamole@acme.com'
  :to: 
    - 'fernand@acme.com'
    - 'molley@acme.com'
  :alert_on:
    - <%=Rackamole.perf%>
    - <%=Rackamole.fault%>  

Then

# => Dev
development:
  :app_name:  Killer App
  :user_key:  :user_name  
  :email:     *email

This will setup email alerts when rackamole detect performance or uncaught exceptions

LICENSE:

(The MIT License)

Copyright © 2009

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Jump to Line
Something went wrong with that request. Please try again.