libhoney
Ruby gem for sending events to Honeycomb. (For more information, see the documentation and Ruby SDK guide.)
Installation
To install the stable release:
gem install libhoney
or add libhoney
to your Gemfile:
gem 'libhoney'
# or, to follow the bleeding edge:
#gem 'libhoney', git: 'https://github.com/honeycombio/libhoney-rb.git'
This gem has some native dependencies, so if you see an error along the lines of "Failed to build gem native extension", you may need to install the Ruby development headers and a C++ compiler. e.g. on Ubuntu:
sudo apt-get install build-essential ruby-dev
Note that libhoney requires Ruby 2.2 or greater.
Documentation
An API reference is available at http://www.rubydoc.info/gems/libhoney
Example Usage
Honeycomb can calculate all sorts of statistics, so send the values you care about and let us crunch the averages, percentiles, lower/upper bounds, cardinality -- whatever you want -- for you.
require 'libhoney'
# Create a client instance
honeycomb = Libhoney::Client.new(
# Use an environment variable to set your write key with something like
# `:writekey => ENV["HONEYCOMB_WRITEKEY"]`
:writekey => "YOUR_WRITE_KEY",
:dataset => "honeycomb-ruby-example"
)
honeycomb.send_now({
duration_ms: 153.12,
method: "get",
hostname: "appserver15",
payload_length: 27
})
# Call close to flush any pending calls to Honeycomb
honeycomb.close
You can find a more complete example demonstrating usage in example/fact.rb
Contributions
Features, bug fixes and other changes to libhoney are gladly accepted. Please open issues or a pull request with your change. Remember to add your name to the CONTRIBUTORS file!
All contributions will be released under the Apache License 2.0.
Releasing a new version
Travis will automatically upload tagged releases to Rubygems. To release a new version, run
bump patch --tag # Or bump minor --tag, etc.
git push --follow-