Class: InfluxDB::Writer::UDP

Inherits:
Object
  • Object
show all
Defined in:
lib/influxdb/writer/udp.rb

Overview

Writes data to InfluxDB through UDP

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, host: "localhost".freeze, port: 4444) ⇒ UDP

Returns a new instance of UDP.



8
9
10
11
12
# File 'lib/influxdb/writer/udp.rb', line 8

def initialize(client, host: "localhost".freeze, port: 4444)
  @client = client
  @host = host
  @port = port
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



6
7
8
# File 'lib/influxdb/writer/udp.rb', line 6

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



6
7
8
# File 'lib/influxdb/writer/udp.rb', line 6

def port
  @port
end

#socketObject

Returns the value of attribute socket.



5
6
7
# File 'lib/influxdb/writer/udp.rb', line 5

def socket
  @socket
end

Instance Method Details

#write(payload, _precision = nil, _retention_policy = nil, _database = nil) ⇒ Object



14
15
16
# File 'lib/influxdb/writer/udp.rb', line 14

def write(payload, _precision = nil, _retention_policy = nil, _database = nil)
  with_socket { |sock| sock.send(payload, 0) }
end