Class: Kstatsd
- Inherits:
-
Object
- Object
- Kstatsd
- Defined in:
- lib/kstatsd.rb
Instance Method Summary collapse
- #gauge(bucket, ms) ⇒ Object
- #increment(bucket) ⇒ Object
-
#initialize(serverhost, serverport) ⇒ Kstatsd
constructor
A new instance of Kstatsd.
- #time_diff_milli(start) ⇒ Object
- #timeEnd(bucket, startTime) ⇒ Object
- #timing(bucket, ms) ⇒ Object
Constructor Details
#initialize(serverhost, serverport) ⇒ Kstatsd
Returns a new instance of Kstatsd.
5 6 7 8 9 |
# File 'lib/kstatsd.rb', line 5 def initialize(serverhost,serverport) if($statsd == nil) $statsd = Statsd.new serverhost,serverport end end |
Instance Method Details
#gauge(bucket, ms) ⇒ Object
19 20 21 |
# File 'lib/kstatsd.rb', line 19 def gauge (bucket, ms) $statsd.gauge bucket, ms end |
#increment(bucket) ⇒ Object
11 12 13 |
# File 'lib/kstatsd.rb', line 11 def increment(bucket) $statsd.increment bucket end |
#time_diff_milli(start) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/kstatsd.rb', line 27 def time_diff_milli(start) finish = Time.now puts 'start' + start.to_s puts 'finish' + finish.to_s return (((finish - start)* 1000.0).to_i).to_s end |
#timeEnd(bucket, startTime) ⇒ Object
23 24 25 |
# File 'lib/kstatsd.rb', line 23 def timeEnd(bucket,startTime) $statsd.timing bucket, time_diff_milli(startTime) end |
#timing(bucket, ms) ⇒ Object
15 16 17 |
# File 'lib/kstatsd.rb', line 15 def timing(bucket,ms) $statsd.timing bucket,ms end |