Class: StatsD::Instrument::UdsConnection
- Inherits:
-
Object
- Object
- StatsD::Instrument::UdsConnection
- Defined in:
- lib/statsd/instrument/uds_connection.rb
Constant Summary collapse
- DEFAULT_MAX_PACKET_SIZE =
8_192
Instance Method Summary collapse
- #close ⇒ Object
- #host ⇒ Object
-
#initialize(socket_path, max_packet_size: DEFAULT_MAX_PACKET_SIZE) ⇒ UdsConnection
constructor
A new instance of UdsConnection.
- #port ⇒ Object
- #send_datagram(message) ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(socket_path, max_packet_size: DEFAULT_MAX_PACKET_SIZE) ⇒ UdsConnection
Returns a new instance of UdsConnection.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/statsd/instrument/uds_connection.rb', line 8 def initialize(socket_path, max_packet_size: DEFAULT_MAX_PACKET_SIZE) if max_packet_size <= 0 StatsD.logger.warn do "[StatsD::Instrument::UdsConnection] max_packet_size must be greater than 0, " \ "using default: #{DEFAULT_MAX_PACKET_SIZE}" end end @socket_path = socket_path @max_packet_size = max_packet_size end |
Instance Method Details
#close ⇒ Object
23 24 25 26 |
# File 'lib/statsd/instrument/uds_connection.rb', line 23 def close @socket&.close @socket = nil end |
#host ⇒ Object
28 29 30 |
# File 'lib/statsd/instrument/uds_connection.rb', line 28 def host nil end |
#port ⇒ Object
32 33 34 |
# File 'lib/statsd/instrument/uds_connection.rb', line 32 def port nil end |
#send_datagram(message) ⇒ Object
19 20 21 |
# File 'lib/statsd/instrument/uds_connection.rb', line 19 def send_datagram() socket.sendmsg(, 0) end |
#type ⇒ Object
36 37 38 |
# File 'lib/statsd/instrument/uds_connection.rb', line 36 def type :uds end |