Code Monkey home page Code Monkey logo

cube-ruby's Introduction

cube-ruby

A Cube client for Ruby (http://square.github.com/cube). Heavily based on this statsd ruby client.

MIT licensed. See the LICENSE file for more details. for more details.

Installation

Since Cube is under constant development, it's best if you specify a particular version of cube-ruby in your Gemfile. That way, you can ensure your Ruby application and your Cube instance will be compatible with each other.

Here's a version compatibility table:

Cube   | cube-ruby
--------------------
0.2.0  | 0.0.1
0.2.1+ | 0.0.2 (master)

Add this line to your application's Gemfile:

gem 'cube-ruby', require: "cube"

# or specify a particular version:
gem 'cube-ruby', '0.0.2', require: "cube"

And then execute:

$ bundle

Or install it yourself as:

$ gem install cube-ruby

Usage

Set up a global Cube client

# use default hostname and port of localhost:1180
$cube = Cube::Client.new

# use custom hostname and port
$cube = Cube::Client.new 'cube.example.org', 2280

Send Cube some metrics!

# send a new "foo" event to cube
$cube.send "foo"

# send a new event to cube that looks like this:
# { type: "request", data: { value: "somevalue" } }
$cube.send "request", value: "somevalue"

# optionally specify a specific date/time (two days ago)
$cube.send "request", DateTime.now - 2, value: "othervalue"

# specify an event id (https://github.com/square/cube/wiki/Events)
event_id = 42
$cube.send "request", DateTime.now, event_id, duration_ms: 234

Yes, the method is called send. You can still call Object#send on Cube::Client objects by using the __send__ method, per the Ruby docs.

Testing

Run the specs with rake.

To include real UDP socket testing in the specs, run LIVE=true rake.

Contributing

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

cube-ruby's People

Contributors

codykrieger avatar

Watchers

Jordan Ritter avatar Rick Cobb avatar YZ avatar Kenneth Berland avatar James Cloos 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.