Rack::Mole, {opts}

• Rackamole on Rails (say that 3 times...)

  • Add the Rackamole gem to your dependencies

    config.gem 'rackamole'

    The rackamole gem is currently hosted at http://gemcutter.org

  • Add rackamole to your middleware stack

    config.middleware.use Rack::Mole, options

    Where options is a hash of configuration parameters. See table below.

  • Edit your application controller file

    class ApplicationController < ActionController::Base
      include Rackamole::Interceptor

    You might already one of the many variants of exception notifiers. Which is fine. Alternatively, the mole can handle your application exceptions as well.

  • That's should do her...

    Once you've restarted, the mole should now start spewing stuff out to your console. If not, deal with it!!
    Oh snap! just kidding...
    To fine tune her, please check the various option below...

• Rackamole on Sinatra ( Missed the saturday dance...)

  • In your main application file

    gem 'rackamole'
    require 'rackamole'

    The rackamole gem is currently hosted at http://gemcutter.org

  • Add rackamole to your configure block

    configure #:env do
      use Rack::Mole, options   ...
    end

    Where options is a hash of configuration parameters. See table below.

  • You're done...

    Once you've restarted, the mole should now start spewing stuff out to your console. To fine tune her, please check the various option below...

• Rackamole Options...

  Name Description Type Default
Tick :moleable Makes this application moleable. Setting this options to false will render Rackamole a complete pass thru component. boolean true
Tick :app_name The name of the application to be moled. String Moled App
Tick :environment The name of the environment under which the application is running. This allow you to monitor an app in production and test environment simultaneously without mucking the logs. String test
Tick :perf_threshold The performance threshold is used to monitor request run-time issued on your application. Any response taking longer than this threshold will be moled. float 10.0
Tick :store Specify a storage mechanism to store moled information. Currently Rackmole provides two stores: a logger and a mongo database. Using the logger you can view moled information in your console which is the default. You can change and log to disk by passing the path to a mole log file to the constructor. Alternatively, you can use the provided mongo store to persist moled information via the provided Rackamole::Store::MongoDb. Object Rackmole::Store::Log
Tick :excluded_paths You can filter out certain requests from being moled, by specifying a collection of regular expressions. When a request path matches a provided regex it will not be moled. Array [/.?\.ico/, /.?\.png/]
  :user_key Attach a user name or id to the moled information. This is very useful if you would like to track your top users or assist an online user. Typically if your application requires auth you will have in your session some user identifier say :user_id. This option will look in the session for that user key and use it to log the associated request. You can alternatively specify a hash with keys :session_key, :extractor to produce a user name from that session key. Please see the rdoc for more information on that option. String/Hash Unkown
  :email When special requests come by ie a performance issue or an exception is raised, you may want to be notified of such an event. The mole provides a mailer that will notify you and your team when something in your app required your prompt attention. This option is a hash with the following keys :from, :to, :alert_on. The :alert_on key uses an array of notable moled types. Currently the mole uses feature, fault and performance type to register a request. The features key can take any of these 3 mole types. When a request matches this type and it is enabled an email will be sent with the request details. The allowed mole types must be defined using Rackamole.feature, Rackamole.perf, Rackamole.fault Hash N/A
  :twitter In conjunction with email alerts, your application can twitt its status, don't you know. We thought 'what's happening' was just as well relevant to your apps as with people... This option takes in a hash with keys :username, :password and :alert_on and work just like :email above but for twitter notifications. Hash N/A
  :log_level Sets the rackamole logger level Symbol :info
  :expiration Number of seconds to alert expiration. The mole will not keep sending alert if a particular mole type has been reported in the past. This threshold specifies the limit at which the previously sent alerts will expire and thus will be sent again. For instance, it might be the case that the app is consistently slow for a particular action. On the first encounter an alert will be sent ( if configured ). Any subsequent requests for this action will not fire an alert until the expiration threshold is hit. The default is 1 hour. Setting this threshold to Rackamole::Stash::Collector::NEVER will result in alerts being fired continually. Symbol :info