support for connecting to statsd via tcp
Closed this issue · 1 comments
Statsd can be configured to accept messages over tcp (instead of udp)
Would this be easy to add?
The basic principle would be trivial to implement. Simply pass SOCK_STREAM
instead of SOCK_DGRAM
to the socket()
call here: https://github.com/WoLpH/python-statsd/blob/master/statsd/connection.py#L41
But generally you really don't want to. TCP has loads of overhead due to making connections, keeping them open. Handling disconnects, handling timeouts, etc... For development it might be convenient to have but I would strongly recommend against using it for production.
With UDP if the server is down/unavailable/broken/whatever the library will still work without any problems. With TCP it will hang until it times out effectively making the measuring a slow/heavy process.