Closed ossareh closed 8 years ago
I can look into the IPv6 failures if you think the patch, in essence, is correct.
Hey @ossareh, thanks for the PR! We strongly suggest using an IP address instead of a hostname because of exactly this issue but I don't see any reason not to improve the experience for those who do use a hostname.
:+1: from me. @raggi, any thoughts?
The problem with this patch is that it stops people who use DNS for management from gracefully handling upgrades.
We could consider installing a HUP handler that re-resolves. What do you think to that?
n.b. under MRI the trap method returns previously set handlers so that one can create correct chains.
@raggi I honestly feel like this could be solved with better documentation. Resolving DNS at the time the client is instantiated could easily be done by the consuming code.
We have a note already. I'm not sure how far to push this.
Hey,
I'm not entirely sure why you do not resolve the hostname once in your version, given we just had a production issue related to this decision I figured it a reasonable idea to supply a patch that caches the resolved address. Is the concerns that the IP address of the host may change?
Making this change has a slight performance increase (a few ms per request according to http://matt.aimonetti.net/posts/2013/06/26/practical-guide-to-graphite-monitoring/ ) - it also stops busy sites like ours crippling our DNS server when under load. We could, as you suggest, run a caching dns server on each of our app servers - but that seems like a poor tradeoff when the library could do it so easily.
As an aside, this brings it inline with the python statsd client too: https://github.com/jsocol/pystatsd/blob/master/statsd/client.py#L42