class InfluxDB::Writer::UDP

Writes data to InfluxDB through UDP

Attributes

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

Public Class Methods

new(client, config) click to toggle source
# File lib/influxdb/writer/udp.rb, line 7
def initialize(client, config)
  @client = client
  config = config.is_a?(Hash) ? config : {}
  @host = config.fetch(:host, 'localhost')
  @port = config.fetch(:port, 4444)
  self.socket = UDPSocket.new
  socket.connect(host, port)
end

Public Instance Methods

write(payload, precision = nil) click to toggle source
# File lib/influxdb/writer/udp.rb, line 16
def write(payload, precision = nil)
  socket.send(payload, 0)
end