shared lita handler that submits data to librato
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
CHANGELOG.md
Gemfile
Gemfile.lock
MIT-LICENSE
README.md
lita-librato.gemspec

README.md

lita-librato

A lita plugin that listens for events and submits the data to librato. It's not much use on its own - it's intended to be used in as a common dependency of other lita plugins that need to submit to librato.

Installation

Add this gem to your lita installation by including the following line in your Gemfile:

gem "lita-librato"

Configuration

Add the following to your lita_config.rb file:

config.handlers.librato.email = "user@example.com"
config.handlers.librato.key = "librato-api-key"

Submitting Data to Librato

To submit data, emit an event on the lita eventbus. Each event must have four attributes:

  • name - a string that defines the metric name
  • type - :gauge or :counter
  • source - a string that describes the data source. Often a hostname
  • value - a number

All four attributes are passed directly to the librato-metrics gem - check its documentation for more details.

class ExampleHandler < Lita::Handlers::Handler

  route(/librato test/i, :librato_test

  def librato_test(response)
    data = {
      name: "ci.job-runtime.#{event.pipeline_slug}.#{event.job_slug}",
      type: :guage,
      source: event.agent_hostname,
      value: 2
    }
    robot.trigger(:librato_submit, data) 

    response.reply("test done")
  end
end