statsd: use safe mode and disable statsd if we can't connect
This commit is contained in:
parent
159c758565
commit
7a2bd60f22
1 changed files with 8 additions and 2 deletions
|
|
@ -38,8 +38,14 @@ def client_from_config(configuration, prefix='statsd.', **kwargs):
|
|||
ipv6 = asbool(_config.pop('statsd_ipv6', IPV6))
|
||||
log.debug('configured statsd client %s:%s', host, port)
|
||||
|
||||
return StatsClient(
|
||||
host=host, port=port, prefix=prefix, maxudpsize=maxudpsize, ipv6=ipv6)
|
||||
try:
|
||||
client = StatsClient(
|
||||
host=host, port=port, prefix=prefix, maxudpsize=maxudpsize, ipv6=ipv6)
|
||||
except Exception:
|
||||
log.exception('StatsD is enabled, but failed to connect to statsd server, fallback: disable statsd')
|
||||
client = None
|
||||
|
||||
return client
|
||||
|
||||
|
||||
def get_statsd_client(request):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue