Class: Librato::LogReporter::Group
- Inherits:
-
Object
- Object
- Librato::LogReporter::Group
- Defined in:
- lib/librato/logreporter/group.rb
Overview
Encapsulates state for grouping operations
Instance Method Summary collapse
- #group(prefix) {|self.class.new(collector: @collector, prefix: prefix)| ... } ⇒ Object
- #increment(counter, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Group
constructor
A new instance of Group.
- #measure(*args, &block) ⇒ Object (also: #timing)
Constructor Details
#initialize(options = {}) ⇒ Group
Returns a new instance of Group.
8 9 10 11 |
# File 'lib/librato/logreporter/group.rb', line 8 def initialize(={}) @collector = [:collector] @prefix = "#{[:prefix]}." end |
Instance Method Details
#group(prefix) {|self.class.new(collector: @collector, prefix: prefix)| ... } ⇒ Object
13 14 15 16 |
# File 'lib/librato/logreporter/group.rb', line 13 def group(prefix) prefix = apply_prefix(prefix) yield self.class.new(collector: @collector, prefix: prefix) end |
#increment(counter, options = {}) ⇒ Object
18 19 20 21 |
# File 'lib/librato/logreporter/group.rb', line 18 def increment(counter, ={}) counter = apply_prefix(counter) @collector.increment counter, end |
#measure(*args, &block) ⇒ Object Also known as: timing
23 24 25 26 |
# File 'lib/librato/logreporter/group.rb', line 23 def measure(*args, &block) args[0] = apply_prefix(args[0]) @collector.measure(*args, &block) end |