Giter VIP home page Giter VIP logo

riemann-ruby-experiments's Introduction

riemann-ruby-experiments

Description

A Riemann client for ruby

Just another client, to experiment with.

Requirements

  • A riemann server to talk to

Installation

gem install riemann-ruby-experiments

Use

Include the following line in your Gemfile:

gem 'riemann-ruby-experiments'

Then, you can use it like this:

client = Riemann::Experiment::Client.new(server: "localhost:5555", service: "A new riemann logger!")
e1 = {time: Time.now.to_i,
     description: "An event of some sort",
     metric: 42.15,
     anotherkey: "anothervalue"}
client.add_event(e1)
e2 = {time: Time.now.to_i, description: "Another event", metric: 73}
client.add_event(e2)
response = client.send_message()
if response.ok == 'ok'
  # acknowledged by server...
end

You can also send queries to the Riemann server:

client = Riemann::Experiment::Client.new()
events = client['service = "http/head/mysite"']
puts events.first.roundtrip

New attributes can be assigned to an Riemann::Experiment::Event object as though they were defined on the object with simple attr_accessors. To create events yourself, make sure to call setup() on them, passing the client, before doing other manipulations (and especially before serializing) in order to make sure that client-wide default values are applied correctly.

e = Riemann::Experiment::Event.new
e.setup(client)
e.time = Time.now
e.website = "http://example.com/"
Base64.strict_encode64(e)  # Just for illustration:
  => "CKyWs7oFGiMuL3JpZW1hbm4tcnVieS1leHBlcmltZW50cy5yYjsxMDU4NyIFdGh5bWVKHgoHd2Vic2l0ZRITaHR0cDovL2V4YW1wbGUuY29tLw=="

For most purposes, though, it’s easier to just pass a hash of field values to the client’s add_event() and let it take care of the details.

Contributing

Pull requests welcome.

Contributors

  • Chris Riddoch

License

Copyright © 2016 Chris Riddoch

See LICENSE for license details

riemann-ruby-experiments's People

Contributors

riddochc avatar

Watchers

 avatar  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.