Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A rack based app analyzer

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION.yml
Octocat-spinner-32 abstract_analyzer.gemspec
README.rdoc

Abstract Analyzer

This is a Rack based analyzer. The idea is to use different methods and libraries to track requests on Rack app and report those back in some simple views.

I'm starting with a Fiveruns Dash analyzer that reports to a MongoDB instance. Reporting actually be it's own small Rack app and for the time being, will mostly text based.

Requirements

I hope to trim this down, but for now…

gems:

  • mongodb-mongo

  • fiveruns-dash-ruby

  • usher

  • ruport

In addition for the tests to pass, you need mongod running on localhost:27017

Implementation

You can use the DashAnalyzer with any rack app you'd like. Check the tests for an example.

Rails

If Rails is your bag, I've included a middleware implementation of the DashAnalyzer. Implementing is pretty easy.

First, require the gem in RAILS_ROOT/config/environment.rb:

Rails::Initializer.run do |config|
  # .....
  config.gem 'abstract_analyzer', :version => '>0.1.0'
  # .....
end

Second, in RAILS_ROOT/config/initializers/middlewares.rb

# Setup the Analyzer DB
abstract_analyzer_db = Mongo::Connection.new('localhost', 27017).db('aa-rails-dash-analyzer-db')
AbstractAnalyzer.const_set("DB", abstract_analyzer_db)

# Setup the Analyzer LOGGER
abstract_logger = Logger.new("#{RAILS_ROOT}/log/abstract_analyzer_logger.log")
AbstractAnalyzer.const_set("LOGGER", abstract_logger)

# Use the Analyzer and View middlewares
ActionController::Dispatcher.middleware.use AbstractAnalyzer::Middleware::Rails::Dash::Analyzer
ActionController::Dispatcher.middleware.use AbstractAnalyzer::Middleware::Rails::Dash::View

Third, make sure you actually have a mongo db running on localhost:27017 or change the connection accordingly ;)

Todo

  • Basic html views

  • Implementing reports for Non-time based metrics

  • Non-Rails middlewares?

  • Non-Dash implementations?

Props

  • Carl Lerche and Yehuda Katz for their Extending Rails training at the Lone Star Ruby Conference that planted this seed

  • The company formally known as Fiveruns for open sourcing their reporter gems

  • Adam Keys for explaining how the Dash gems work

  • The guys a SqueeJee for saying MongoDB enough times to make me try it in something

License

See LICENSE

Something went wrong with that request. Please try again.