Class: Nosey::Probe::Set
- Inherits:
-
Object
- Object
- Nosey::Probe::Set
- Defined in:
- lib/nosey/probe.rb
Overview
Contains a collection of probes that calculate velocities, counts, etc.
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#avg(key, value) ⇒ Object
Sample a number and get a sum/avg/count/min/max.
-
#decrement(key, by = 1) ⇒ Object
Decrement a counter probe.
-
#increment(key, by = 1) ⇒ Object
Increment a counter probe.
-
#initialize(name) {|_self| ... } ⇒ Set
constructor
A new instance of Set.
- #max(key, value) ⇒ Object
- #min(key, value) ⇒ Object
-
#probe(key) ⇒ Object
Get a probe and do all sorts of crazy stuff to it.
-
#probes ⇒ Object
List of all the probes that are active.
-
#report ⇒ Object
Generate a report with this ProbeSet.
-
#reset ⇒ Object
Reset the values in all the probes.
- #sum(key, value) ⇒ Object
-
#touch(key) ⇒ Object
Touch a timestamp probe.
Constructor Details
#initialize(name) {|_self| ... } ⇒ Set
Returns a new instance of Set.
100 101 102 103 104 |
# File 'lib/nosey/probe.rb', line 100 def initialize(name) @name = name yield self if block_given? self end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
98 99 100 |
# File 'lib/nosey/probe.rb', line 98 def name @name end |
Instance Method Details
#avg(key, value) ⇒ Object
Sample a number and get a sum/avg/count/min/max
117 118 119 |
# File 'lib/nosey/probe.rb', line 117 def avg(key,val) ensure_probe(Probe::Average, key).sample(val) end |
#decrement(key, by = 1) ⇒ Object
Decrement a counter probe
112 113 114 |
# File 'lib/nosey/probe.rb', line 112 def decrement(key,by=1) ensure_probe(Probe::Count, key).decrement(by) end |
#increment(key, by = 1) ⇒ Object
Increment a counter probe
107 108 109 |
# File 'lib/nosey/probe.rb', line 107 def increment(key,by=1) ensure_probe(Probe::Count, key).increment(by) end |
#max(key, value) ⇒ Object
130 131 132 |
# File 'lib/nosey/probe.rb', line 130 def max(key,value) ensure_probe(Probe::Maximum, key).sample(value) end |
#min(key, value) ⇒ Object
126 127 128 |
# File 'lib/nosey/probe.rb', line 126 def min(key,value) ensure_probe(Probe::Minimum, key).sample(value) end |
#probe(key) ⇒ Object
Get a probe and do all sorts of crazy stuff to it.
148 149 150 |
# File 'lib/nosey/probe.rb', line 148 def probe(key) probes[key] end |
#probes ⇒ Object
List of all the probes that are active
143 144 145 |
# File 'lib/nosey/probe.rb', line 143 def probes @probes ||= Hash.new end |
#report ⇒ Object
Generate a report with this ProbeSet
153 154 155 156 157 |
# File 'lib/nosey/probe.rb', line 153 def report Report.new do |r| r.probe_sets << self end end |
#reset ⇒ Object
Reset the values in all the probes
160 161 162 |
# File 'lib/nosey/probe.rb', line 160 def reset probes.each{|_, probe| probe.reset } end |