class Statsby::UDPMetricsWriter

Most StatsD endpoints will be UDP. This is a super simple wrapper around UPDSocket

Constants

DEFAULT_HOST
DEFAULT_PORT

Attributes

host[RW]
port[RW]
socket[RW]

Public Class Methods

new(host = DEFAULT_HOST, port = DEFAULT_PORT) click to toggle source
# File lib/statsby/udp_metrics_writer.rb, line 12
def initialize(host = DEFAULT_HOST, port = DEFAULT_PORT)
  self.socket = ::UDPSocket.new
  self.host = host
  self.port = port
end

Public Instance Methods

write(message) click to toggle source
# File lib/statsby/udp_metrics_writer.rb, line 18
def write(message)
  socket.send(message, 0, host, port)
end