breaking into the unknown…

Rails metrics : load, performance and code quality

Leave a comment

Sometime, we need some evaluation of our code to see its robustness, performance, quality etc. These can be gather into a metrics, we will call it Rails Metrics. Fortunately, gems are available to provide all these metrics. A good detail of available metrics can be found here . I personally, feel that at start of your project, we should also set up tools to provide us with metrics under below category.

Metric 1: Code Quality

This will track our code quality in terms of best practice. Best Practices can be found on this site.  it will show error in the metrics when we deviate from the best practices. The rails_best_practices gem can be used for this.

Metric 2: Code test coverage.

This metric will tell you, how much of your code is covered under different test cases and how much is left out. You can then add test cases for those piece of code. A no of tools are available for this on ruby tool box. The gem I preferred is simplecov . If you are using below ruby 1.9.x, you can also use rcov. rcov  do not support ruby 1.9.x.

Metric 3:  Code Performance

It will provide metrics about, your active record calls, method replication, query optimisation etc. newrelic provide performance testing service. Though, it is paid service. In Development mode you can use it for free. The newrelic rpm gem is available here

Metric 4: load metrics

This metric is generally needed for production. I have discussed in detail about various tools available for this in this post

NOTE : There is a no of other metrics also available. metric_fu is the gem which integrate a no of other tool metrics like Flog, Flay, RCov, Saikuro, Churn, Reek, Roodi etc.  So , You can install it directly to get all the metrics at once or keep installing other metric gem as per your need.


Author: arunyadav4u

over 7 years experience in web development with Ruby on Rails.Involved in all stage of development lifecycle : requirement gathering, planing, coding, deployment & Knowledge transfer. I can adept to any situation, mixup very easily with people & can be a great friend.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s