Module: Fozzie::Interface
Instance Method Summary collapse
-
#build ⇒ Object
Registers a build for the app.
-
#built ⇒ Object
Registers that the app has been built.
-
#bulk(&block) ⇒ Object
Register multiple statistics in a single call.
-
#commit ⇒ Object
Registers a commit.
-
#committed ⇒ Object
Registers a commit.
-
#count(stat, count, sample_rate = 1) ⇒ Object
Registers a count for the given stat, with an optional sample rate.
-
#decrement(stat, sample_rate = 1) ⇒ Object
Decrements the given stat by one, with an optional sample rate.
-
#deploy(app = nil) ⇒ Object
Registers a deployment for the given app.
-
#deployed(app = nil) ⇒ Object
Registers a deployed status for the given app.
-
#event(type, app = nil) ⇒ Object
Register an event of any type.
-
#gauge(stat, value, sample_rate = 1) ⇒ Object
Register an arbitrary value.
-
#increment(stat, sample_rate = 1) ⇒ Object
Increments the given stat by one, with an optional sample rate.
-
#increment_on(stat, perf, sample_rate = 1) ⇒ Object
Registers an increment on the result of the given boolean.
-
#time(stat, sample_rate = 1) ⇒ Object
Registers the time taken to complete a given block (in ms), with an optional sample rate.
-
#time_for(stat, sample_rate = 1, &block) ⇒ Object
Registers the time taken to complete a given block (in ms), with an optional sample rate.
-
#time_to_do(stat, sample_rate = 1, &block) ⇒ Object
Registers the time taken to complete a given block (in ms), with an optional sample rate.
-
#timing(stat, ms, sample_rate = 1) ⇒ Object
Registers a timing (in ms) for the given stat, with an optional sample rate.
Instance Method Details
#build ⇒ Object
Registers a build for the app
‘Stats.build`
82 83 84 |
# File 'lib/fozzie/interface.rb', line 82 def build built end |
#built ⇒ Object
Registers that the app has been built
‘Stats.built`
75 76 77 |
# File 'lib/fozzie/interface.rb', line 75 def built event :build end |
#bulk(&block) ⇒ Object
Register multiple statistics in a single call
‘Stats.bulk do
increment 'wat'
decrement 'wot'
end`
129 130 131 |
# File 'lib/fozzie/interface.rb', line 129 def bulk(&block) Fozzie::BulkDsl.new(&block) end |
#commit ⇒ Object
Registers a commit
‘Stats.commit`
61 62 63 |
# File 'lib/fozzie/interface.rb', line 61 def commit event :commit end |
#committed ⇒ Object
Registers a commit
‘Stats.commit`
68 69 70 |
# File 'lib/fozzie/interface.rb', line 68 def committed commit end |
#count(stat, count, sample_rate = 1) ⇒ Object
Registers a count for the given stat, with an optional sample rate
‘Stats.count ’wat’, 500`
23 24 25 |
# File 'lib/fozzie/interface.rb', line 23 def count(stat, count, sample_rate=1) send(stat, count, :count, sample_rate) end |
#decrement(stat, sample_rate = 1) ⇒ Object
Decrements the given stat by one, with an optional sample rate
‘Stats.decrement ’wat’‘
16 17 18 |
# File 'lib/fozzie/interface.rb', line 16 def decrement(stat, sample_rate=1) count(stat, -1, sample_rate) end |
#deploy(app = nil) ⇒ Object
Registers a deployment for the given app
‘Stats.deploy ’watapp’‘
96 97 98 |
# File 'lib/fozzie/interface.rb', line 96 def deploy(app = nil) deployed(app) end |
#deployed(app = nil) ⇒ Object
Registers a deployed status for the given app
‘Stats.deployed ’watapp’‘
89 90 91 |
# File 'lib/fozzie/interface.rb', line 89 def deployed(app = nil) event :deploy, app end |
#event(type, app = nil) ⇒ Object
Register an event of any type
‘Stats.event ’wat’, ‘app’‘
103 104 105 |
# File 'lib/fozzie/interface.rb', line 103 def event(type, app = nil) gauge ["event", type.to_s, app], Time.now.usec end |
#gauge(stat, value, sample_rate = 1) ⇒ Object
Register an arbitrary value
‘Stats.gauge ’wat’, ‘app’‘
119 120 121 |
# File 'lib/fozzie/interface.rb', line 119 def gauge(stat, value, sample_rate = 1) send(stat, value, :gauge, sample_rate) end |
#increment(stat, sample_rate = 1) ⇒ Object
Increments the given stat by one, with an optional sample rate
‘Stats.increment ’wat’‘
9 10 11 |
# File 'lib/fozzie/interface.rb', line 9 def increment(stat, sample_rate=1) count(stat, 1, sample_rate) end |
#increment_on(stat, perf, sample_rate = 1) ⇒ Object
Registers an increment on the result of the given boolean
‘Stats.increment_on ’wat’, wat.random?‘
110 111 112 113 114 |
# File 'lib/fozzie/interface.rb', line 110 def increment_on(stat, perf, sample_rate=1) key = [stat, (perf ? "success" : "fail")] increment(key, sample_rate) perf end |
#time(stat, sample_rate = 1) ⇒ Object
Registers the time taken to complete a given block (in ms), with an optional sample rate
‘Stats.time ’wat’ { # Do something… }‘
37 38 39 40 41 42 |
# File 'lib/fozzie/interface.rb', line 37 def time(stat, sample_rate=1) start = Time.now result = yield timing(stat, ((Time.now - start) * 1000).round, sample_rate) result end |
#time_for(stat, sample_rate = 1, &block) ⇒ Object
Registers the time taken to complete a given block (in ms), with an optional sample rate
‘Stats.time_for ’wat’ { # Do something, grrr… }‘
54 55 56 |
# File 'lib/fozzie/interface.rb', line 54 def time_for(stat, sample_rate=1, &block) time(stat, sample_rate, &block) end |
#time_to_do(stat, sample_rate = 1, &block) ⇒ Object
Registers the time taken to complete a given block (in ms), with an optional sample rate
‘Stats.time_to_do ’wat’ { # Do something, again… }‘
47 48 49 |
# File 'lib/fozzie/interface.rb', line 47 def time_to_do(stat, sample_rate=1, &block) time(stat, sample_rate, &block) end |
#timing(stat, ms, sample_rate = 1) ⇒ Object
Registers a timing (in ms) for the given stat, with an optional sample rate
‘Stats.timing ’wat’, 500`
30 31 32 |
# File 'lib/fozzie/interface.rb', line 30 def timing(stat, ms, sample_rate=1) send(stat, ms, :timing, sample_rate) end |