Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
/ rubik Public archive

A simple gem for metric collection and tracking

License

Notifications You must be signed in to change notification settings

matrushka/rubik

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rubik

Rubik is a gem to track realtime quantitive metrics such as the average duration of a method executed. Rubik is not suitable for long term metric collection since it

Installation

Add this line to your application's Gemfile:

gem 'rubik', git: '[email protected]:matrushka/rubik.git'

And then execute:

$ bundle

Usage

Configuration

There are 2 options for configuration.

Class Method

You can set the redis server by using the class method "redis=".

Rubik.redis = Redis.new

Global Variable

Rubik uses the global $redis variable if the redis server is not set with the class method.

$redis = Redis.new

Method Tracking

Rubik can track instance method execution times easily.

class MyClass
  include Rubik
  track_method :run

  def run
    sleep 1
  end
end

Custom Metrics

Just use the Rubik.push_metric method to push your custom metric.

  Rubik.push_metric 'my-metric-name', value

Monitoring

Rails 3+

Add slim to your Gemfile

gem 'slim'

Add the following to your "config/routes.rb"

require 'rubik/server'
mount Rubik::Server => '/rubik'

And then you can use the mounted route to see the monitoring dashboard.

Stand alone

Prepare a Gemfile for the standalone version

gem 'rubik', git: '[email protected]:matrushka/rubik.git'
gem 'slim'

Fill the config.ru file for booting Rubik::Server in your choice of Rack Server

require 'rubik/server'
Rubik.redis = Redis.new
run Rubik::Server.new

TODO

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

A simple gem for metric collection and tracking

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published