From 49cf300cdf3c69157855e509b8712bf597a349c7 Mon Sep 17 00:00:00 2001 From: Yann Mahe Date: Wed, 9 Dec 2015 11:36:56 -0500 Subject: [PATCH] [util] don't raise on hostname resolution failures `hostname` is an optional API parameter. Thus, `initialize` method should not raise when unable to resolve it. --- datadog/util/hostname.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/datadog/util/hostname.py b/datadog/util/hostname.py index 278c79c3c..33f90ab79 100644 --- a/datadog/util/hostname.py +++ b/datadog/util/hostname.py @@ -101,12 +101,12 @@ def _get_hostname_unix(): hostname = socket_hostname if hostname is None: - log.critical("Unable to reliably determine host name. You can define one" - " in datadog.conf or in your hosts file") - raise Exception("Unable to reliably determine host name. You can define" - " one in datadog.conf or in your hosts file") - else: - return hostname + log.warning( + u"Unable to reliably determine host name. You can define one in your `hosts` file, " + u"or in `datadog.conf` file if you have Datadog Agent installed." + ) + + return hostname def get_ec2_instance_id():