0.0
No commit activity in last 3 years
No release in over 3 years
Librato API Client for for Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 3.0.0

Runtime

 Project Readme

Librato::Client

Librato API Client for for Ruby.

Installation

Add this line to your application's Gemfile:

gem 'librato-client'

And then execute:

$ bundle

Or install it yourself as:

$ gem install librato-client

Usage

Create client

require 'librato/client'

client = Librato::Client.new(
  user: '...',
  token: '...'
  # [, Other Options]
)
  • Other Options
    • :debug
    • :expand_pageable_resources
    • :raise_error_if_not_exist
    • :wrap_faraday_client_error
    • :default_alerts_version

List metrics

client.metrics.get
#=> [{"name"=>"login-delay",
#     "display_name"=>nil,
#     "type"=>"gauge",
#     "attributes"=>{"created_by_ua"=>"Ruby Librato Client 0.1.0"},
#     "description"=>nil,
#     "period"=>nil,
#     "source_lag"=>nil}]

Show a metric

client.metrics("login-delay").get
#=> {"name"=>"login-delay",
#    "display_name"=>nil,
#    "type"=>"gauge",
#    "attributes"=>{"created_by_ua"=>"Ruby Librato Client 0.1.0"},
#    "description"=>nil,
#    "period"=>nil,
#    "source_lag"=>nil}
client.metrics("login-delay").get(
  compose: 'series("*")',
  start_time: 1439108273,
  resolution: 300
)

#=> {"measurements"=>
#     {"foo.bar.com"=>
#       [{"measure_time"=>1439108400,
#         "value"=>3.5,
#         "count"=>5,
#         "min"=>3.5,
#         "max"=>3.5,
#         "sum"=>17.5,
#         "sum_squares"=>61.25},
#         ...

see Composite Metrics Language Specification – Customer Feedback & Support for Librato

Create a metric

client.metrics.post({
  gauges: {
    "login-delay" => {
      value: 3.5,
      source: "foo.bar.com"
    }
  }
})

Update a metric

client.metrics("login-delay").put(display_name: "Login delay")

Delete a metrics

client.metrics("login-delay").delete

List spaces

client.spaces.get

Show a space

client.spaces(12345).get

Create a space

client.spaces.post(name: "My Space")

List charts

client.spaces(12345).charts.get

Show a chart

client.spaces(12345).charts(6789).get

Create a chart

client.spaces(77109).charts.post(
  name: "My Chart",
  type: "line",
  streams: [...]
)