Class: Harness::FakeCollector
- Inherits:
-
Object
- Object
- Harness::FakeCollector
- Defined in:
- lib/harness/fake_collector.rb
Defined Under Namespace
Classes: Decrement, Gauge, Increment
Instance Attribute Summary collapse
-
#counters ⇒ Object
readonly
Returns the value of attribute counters.
-
#decrements ⇒ Object
readonly
Returns the value of attribute decrements.
-
#gauges ⇒ Object
readonly
Returns the value of attribute gauges.
-
#increments ⇒ Object
readonly
Returns the value of attribute increments.
-
#timers ⇒ Object
readonly
Returns the value of attribute timers.
Instance Method Summary collapse
- #count(*args) ⇒ Object
- #decrement(*args) ⇒ Object
- #gauge(*args) ⇒ Object
- #increment(*args) ⇒ Object
-
#initialize ⇒ FakeCollector
constructor
A new instance of FakeCollector.
- #time(stat, sample_rate = 1) ⇒ Object
- #timing(*args) ⇒ Object
Constructor Details
#initialize ⇒ FakeCollector
Returns a new instance of FakeCollector.
9 10 11 |
# File 'lib/harness/fake_collector.rb', line 9 def initialize @gauges, @counters, @timers, @increments, @decrements = [], [], [], [], [] end |
Instance Attribute Details
#counters ⇒ Object (readonly)
Returns the value of attribute counters.
7 8 9 |
# File 'lib/harness/fake_collector.rb', line 7 def counters @counters end |
#decrements ⇒ Object (readonly)
Returns the value of attribute decrements.
7 8 9 |
# File 'lib/harness/fake_collector.rb', line 7 def decrements @decrements end |
#gauges ⇒ Object (readonly)
Returns the value of attribute gauges.
7 8 9 |
# File 'lib/harness/fake_collector.rb', line 7 def gauges @gauges end |
#increments ⇒ Object (readonly)
Returns the value of attribute increments.
7 8 9 |
# File 'lib/harness/fake_collector.rb', line 7 def increments @increments end |
#timers ⇒ Object (readonly)
Returns the value of attribute timers.
7 8 9 |
# File 'lib/harness/fake_collector.rb', line 7 def timers @timers end |
Instance Method Details
#count(*args) ⇒ Object
32 33 34 |
# File 'lib/harness/fake_collector.rb', line 32 def count(*args) counters << Harness::Counter.new(*args) end |
#decrement(*args) ⇒ Object
28 29 30 |
# File 'lib/harness/fake_collector.rb', line 28 def decrement(*args) decrements << Decrement.new(*args) end |
#gauge(*args) ⇒ Object
36 37 38 |
# File 'lib/harness/fake_collector.rb', line 36 def gauge(*args) gauges << Gauge.new(*args) end |
#increment(*args) ⇒ Object
24 25 26 |
# File 'lib/harness/fake_collector.rb', line 24 def increment(*args) increments << Increment.new(*args) end |
#time(stat, sample_rate = 1) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/harness/fake_collector.rb', line 17 def time(stat, sample_rate = 1) start = Time.now result = yield timing(stat, ((Time.now - start) * 1000).round, sample_rate) result end |