Class: Camayoc::Handlers::Statsd

Inherits:
Object
  • Object
show all
Includes:
ThreadSafety
Defined in:
lib/camayoc/handlers/statsd.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ThreadSafety

#synchronize, #thread_safe=, #thread_safe?

Constructor Details

#initialize(options = {}) ⇒ Statsd

Returns a new instance of Statsd.



13
14
15
16
17
18
19
# File 'lib/camayoc/handlers/statsd.rb', line 13

def initialize(options={})
  self.namespace = options[:namespace]
  @host = options[:host]
  @port = options[:port]
  @socket = UDPSocket.new
  self.thread_safe = Camayoc.thread_safe?
end

Instance Attribute Details

#namespaceObject

Returns the value of attribute namespace.



11
12
13
# File 'lib/camayoc/handlers/statsd.rb', line 11

def namespace
  @namespace
end

Instance Method Details

#event(ev) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/camayoc/handlers/statsd.rb', line 21

def event(ev)
  case ev.type
    when :timing then timing(ev)
    when :count  then count(ev)
    else other(ev)
  end
end