Class: Datadog::Statsd::UDPConnection

Inherits:
Connection
  • Object
show all
Defined in:
lib/datadog/statsd/udp_connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Connection

#reset_telemetry, #write

Constructor Details

#initialize(host, port, **kwargs) ⇒ UDPConnection

Returns a new instance of UDPConnection.



14
15
16
17
18
19
20
# File 'lib/datadog/statsd/udp_connection.rb', line 14

def initialize(host, port, **kwargs)
  super(**kwargs)

  @host = host
  @port = port
  @socket = nil
end

Instance Attribute Details

#hostObject (readonly)

StatsD host.



9
10
11
# File 'lib/datadog/statsd/udp_connection.rb', line 9

def host
  @host
end

#portObject (readonly)

StatsD port.



12
13
14
# File 'lib/datadog/statsd/udp_connection.rb', line 12

def port
  @port
end

Instance Method Details

#closeObject



22
23
24
25
# File 'lib/datadog/statsd/udp_connection.rb', line 22

def close
  @socket.close if @socket
  @socket = nil
end