-
Notifications
You must be signed in to change notification settings - Fork 177
Open
Labels
help-wantedopen to a pull request to address this issueopen to a pull request to address this issue
Description
Curious to know if this is intended behaviour or not.
Example:
>>> import statsd
>>> # use the default, "localhost"
... # there is _not_ a statsd server running on localhost:8125
... # initialises ok,
... sc = statsd.StatsClient()
>>> # this time, specify a random hostname
... # again, no statsd server running at this host
... # initialisation causes error
... sc = statsd.StatsClient(host='foobar')
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
File "/usr/local/lib/python3.7/site-packages/statsd/client/udp.py", line 35, in __init__
host, port, fam, socket.SOCK_DGRAM)[0]
File "/usr/local/lib/python3.7/socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
I'm wondering if it would be better to catch-pass this error? On the one hand, it's more in-line with the philosophy that errors with stats should not bring down the application, but on the other, I could imagine wanting to be sure that my application can log anything at all.
Perhaps a middle ground would be some kind of strict=True/False argument, which toggles between the behaviours?
Metadata
Metadata
Assignees
Labels
help-wantedopen to a pull request to address this issueopen to a pull request to address this issue