diff --git a/lib/puma/plugin/statsd.rb b/lib/puma/plugin/statsd.rb index 876c8e6..e1b65ae 100644 --- a/lib/puma/plugin/statsd.rb +++ b/lib/puma/plugin/statsd.rb @@ -26,7 +26,8 @@ def send(metric_name:, value:, type:, tags: nil) socket.connect(Socket.pack_sockaddr_un(@socket_path)) socket.sendmsg_nonblock(data) else - socket = UDPSocket.new + address_family, _, _ = Socket.getaddrinfo(host, port)[0] + socket = UDPSocket.new(Socket.const_get(address_family)) socket.send(data, 0, host, port) end ensure