class Librato::Collector

collects and stores measurement values over time so they can be reported periodically to the Metrics service

Attributes

tags[R]

Public Class Methods

new(options={}) click to toggle source
# File lib/librato/collector.rb, line 15
def initialize(options={})
  @tags = options[:tags]
end

Public Instance Methods

aggregate() click to toggle source

access to internal aggregator object

# File lib/librato/collector.rb, line 20
def aggregate
  @aggregator_cache ||= Aggregator.new(prefix: @prefix, default_tags: @tags)
end
clear()
Alias for: delete_all
counters() click to toggle source

access to internal counters object

# File lib/librato/collector.rb, line 25
def counters
  @counter_cache ||= CounterCache.new(default_tags: @tags)
end
delete_all() click to toggle source

remove any accumulated but unsent metrics

# File lib/librato/collector.rb, line 30
def delete_all
  aggregate.delete_all
  counters.delete_all
end
Also aliased as: clear
group(prefix) { |group| ... } click to toggle source
# File lib/librato/collector.rb, line 36
def group(prefix)
  group = Group.new(self, prefix)
  yield group
end
prefix() click to toggle source
# File lib/librato/collector.rb, line 47
def prefix
  @prefix
end
prefix=(new_prefix) click to toggle source

update prefix

# File lib/librato/collector.rb, line 42
def prefix=(new_prefix)
  @prefix = new_prefix
  aggregate.prefix = @prefix
end