Class: Datadog::Statsd::UDPConnection

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

Constant Summary collapse

DEFAULT_HOST =
'127.0.0.1'
DEFAULT_PORT =
8125

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Connection

#close, #write

Constructor Details

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

Returns a new instance of UDPConnection.


17
18
19
20
21
22
# File 'lib/datadog/statsd/udp_connection.rb', line 17

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

  @host = host || ENV.fetch('DD_AGENT_HOST', DEFAULT_HOST)
  @port = port || ENV.fetch('DD_DOGSTATSD_PORT', DEFAULT_PORT).to_i
end

Instance Attribute Details

#hostObject (readonly)

StatsD host. Defaults to 127.0.0.1.


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

def host
  @host
end

#portObject (readonly)

StatsD port. Defaults to 8125.


15
16
17
# File 'lib/datadog/statsd/udp_connection.rb', line 15

def port
  @port
end