Class: Tremolo::Sender

Inherits:
Object
  • Object
show all
Includes:
Celluloid::IO
Defined in:
lib/tremolo/sender.rb

Instance Method Summary collapse

Constructor Details

#initialize(host, port) ⇒ Sender

Returns a new instance of Sender.



5
6
7
8
# File 'lib/tremolo/sender.rb', line 5

def initialize(host, port)
  @socket = UDPSocket.new
  @socket.connect(host, port) # client
end

Instance Method Details

#write_points(series_name, values, tags = {}) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/tremolo/sender.rb', line 10

def write_points(series_name, values, tags = {})
  begin
    @socket.send(prepare(series_name, values, tags), 0)
  rescue Errno::ECONNREFUSED
    nil
  end
end