Git Product home page Git Product logo

rails_metrics's Introduction

RailsMetrics

RailsMetrics is an engine that hooks into your application to listen ActiveSupport::Notifications and show you statistics about them. RailsMetrics uses threads to save those notifications in the database through an in-process Queue. You can see charts based on each request and see what queries, actions, templates rendering, etc. are slow.

So far RailsMetrics supports only ActiveRecord as ORM but adding other datastore should be easy (take a look at lib/rails_metrics/orm/active_record.rb). Due to the threaded behavior in RailsMetrics, you cannot use SQLite as database, however MySQL and PostgreSQL work fine.

There’s an example application at github.com/engineyard/rails_metrics_example .

Installation

Installing RailsMetrics is simple. Since it’s a Rails::Engine, you need to install it as gem:

gem install rails_metrics

Then add it to your gemfile. So far, I recommend you to install it only on development:

group :development do
  gem "rails_metrics"
end

Finally, create your model using the built-in generator:

rails g rails_metrics Metric

You can choose another name than Metric as your rails metrics store. Run the created migration, restart your server and now you should be able to access “/rails_metrics”. Navigate on your application and head back to “/rails_metrics” to see the stored data.

Configuration

There are three parameters you can add to your application to configure RailsMetrics. The first one is to set the RailsMetrics store, which is done automatically when you use the generator:

config.rails_metrics.set_store = lambda { ::Metric }

The other parameters allows you to ignore an specific notification, based on a given block or on its name. Let’s suppose you have a plugin in your application which is yielding an useless notification. You can silence it by doing:

config.rails_metrics.ignore_patterns << /verbose_plugin/

If you need to ignore a notification based on its payload, it’s also easy:

config.rails_metrics.ignore_lambdas[:verbose_plugin] = lambda { |name, payload|
  payload[:some_value] =~ /some_expression/
}

Running the test suite

To run the test suite, please execute the following commands on the project root:

1) gem install bundler

2) bundle install

3) rake prepare

4) rake test

TODO

Please refer to TODO file.

Maintainers

Bugs and Feedback

If you discover any bugs or want to drop a line, feel free to create an issue on GitHub.

github.com/engineyard/rails_metrics/issues

MIT License. Copyright 2010 Engine Yard. www.engineyard.com

rails_metrics's People

Contributors

josevalim avatar snusnu avatar solnic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.