Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mtodd committed Apr 11, 2011
1 parent 0ad1556 commit 13303f9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions examples/counter.rb
Expand Up @@ -4,8 +4,8 @@
@metrics = Metrics::Agent.new
@metrics.start

counter = @metrics.add_instrument('counter', 'my_counter')
counter.inc(1)
counter.inc(1)
counter = @metrics.counter :my_counter
counter.incr
counter.incr

puts "Counter: #{counter.to_i}"
7 changes: 3 additions & 4 deletions examples/gauge.rb
Expand Up @@ -7,14 +7,13 @@
hit_count = 42
http_requests = 53

gauge = @metrics.add_instrument 'gauge', 'my_gauge' do
gauge = @metrics.gauge :my_gauge do
{
:hit_count => hit_count,
:hit_count => hit_count,
:http_requests => http_requests
}
end


puts "Gauge: #{gauge.to_s}"

hit_count = 65
Expand All @@ -24,4 +23,4 @@

result = gauge.get

puts "Result: #{result}"
puts "Result: #{result}"
5 changes: 3 additions & 2 deletions examples/meter.rb
Expand Up @@ -4,15 +4,16 @@
@metrics = Metrics::Agent.new
@metrics.start

timer = @metrics.add_instrument('meter', 'my_meter')
timer = @metrics.meter :my_meter
timer.mark(500)

step = 0

# This is here so that we will run indefinitely so you can hit the
# status page on localhost:8001/status
loop do
sleep(1)
sleep 1

modifier = rand(200).to_i
step += 1

Expand Down

0 comments on commit 13303f9

Please sign in to comment.