Coder Social home page Coder Social logo

rubik's Introduction

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

rubik's People

Contributors

demirhanaydin avatar matrushka avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

demirhanaydin

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.