Module: Librato::Metrics

Extended by:
SingleForwardable
Defined in:
lib/librato/metrics.rb,
lib/librato/metrics/queue.rb,
lib/librato/metrics/errors.rb,
lib/librato/metrics/client.rb,
lib/librato/metrics/version.rb,
lib/librato/metrics/processor.rb,
lib/librato/metrics/annotator.rb,
lib/librato/metrics/smart_json.rb,
lib/librato/metrics/aggregator.rb,
lib/librato/metrics/connection.rb,
lib/librato/metrics/collection.rb,
lib/librato/metrics/middleware/retry.rb,
lib/librato/metrics/persistence/test.rb,
lib/librato/metrics/persistence/direct.rb,
lib/librato/metrics/middleware/request_body.rb,
lib/librato/metrics/middleware/expects_status.rb,
lib/librato/metrics/middleware/count_requests.rb

Overview

Note:

Most of the methods you can call directly on Librato::Metrics are delegated to Client and are documented there.

Metrics provides a simple wrapper for the Metrics web API with a number of added conveniences for common use cases.

See the README for more information and examples.

Examples:

Simple use case

Librato::Metrics.authenticate 'email', 'api_key'

# list current metrics
Librato::Metrics.list

# submit a metric immediately
Librato::Metrics.submit :foo => 12712

# fetch the last 10 values of foo
Librato::Metrics.get_measurements :foo, :count => 10

Queuing metrics for submission

queue = Librato::Metrics::Queue.new

# queue some metrics
queue.add :foo => 12312
queue.add :bar => 45678

# send the metrics
queue.submit

Using a Client object

client = Librato::Metrics::Client.new
client.authenticate 'email', 'api_key'

# list client's metrics
client.list

# create an associated queue
queue = client.new_queue

# queue up some metrics and submit
queue.add :foo => 12345
queue.add :bar => 45678
queue.submit

Defined Under Namespace

Modules: Middleware, Persistence, Processor Classes: Aggregator, Annotator, Client, ClientError, Collection, Connection, CredentialsMissing, EntityAlreadyExists, Forbidden, InvalidMeasureTime, MetricsError, NetworkError, NoClientProvided, NoMetricsProvided, NotFound, NotMergeable, Queue, ServerError, SmartJSON, Unauthorized

Constant Summary

TYPES =
[:counter, :gauge]
PLURAL_TYPES =
[:counters, :gauges]
MIN_MEASURE_TIME =
(Time.now-(3600*24*365)).to_i
VERSION =
"1.4.0"

Class Method Summary (collapse)

Class Method Details

+ (Client) client

The Librato::Metrics::Client being used by module-level access.



92
93
94
# File 'lib/librato/metrics.rb', line 92

def self.client
  @client ||= Librato::Metrics::Client.new
end