Class: InfluxDB::Writer::UDP
- Inherits:
-
Object
- Object
- InfluxDB::Writer::UDP
- Defined in:
- lib/influxdb/writer/udp.rb
Overview
Writes data to InfluxDB through UDP
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#socket ⇒ Object
Returns the value of attribute socket.
Instance Method Summary collapse
-
#initialize(client, host: "localhost".freeze, port: 4444) ⇒ UDP
constructor
A new instance of UDP.
- #write(payload, _precision = nil, _retention_policy = nil, _database = nil) ⇒ Object
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
#host ⇒ Object (readonly)
Returns the value of attribute host.
6 7 8 |
# File 'lib/influxdb/writer/udp.rb', line 6 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
6 7 8 |
# File 'lib/influxdb/writer/udp.rb', line 6 def port @port end |
#socket ⇒ Object
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 |