summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2018-04-30 08:27:22 -0600
committerChad Smith <chad.smith@canonical.com>2018-04-30 08:27:22 -0600
commit4bd5870f62df771f2a346b0003fd03e44d7fac19 (patch)
tree0ce203ee458bef2c45a6917ce5839a90e6014978 /cloudinit/util.py
parent6ef92c98c3d2b127b05d6708337efc8a81e00071 (diff)
downloadvyos-cloud-init-4bd5870f62df771f2a346b0003fd03e44d7fac19.tar.gz
vyos-cloud-init-4bd5870f62df771f2a346b0003fd03e44d7fac19.zip
Add reporting events and log_time around early source of blocking time
In looking at some boot time for Xenial, Artful and Bionic, we noticed some long amounts of time that appeared to be part of the DataSource but we related to resolving URLs. In Artful and Bionic, there was an issue (bug: #1739672) that resulted in slow getaddrinfo() calls when systemd-resolved was in use. This patch adds two events that track time for datasource.setup_datasource() and datasource.activate_datasource() Additionally use log_time() to wrapper util.is_resolvable_url() which leaves info in cloud-init.log about how much time was spent.
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 2828ca38..fc30018c 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1154,7 +1154,9 @@ def gethostbyaddr(ip):
def is_resolvable_url(url):
"""determine if this url is resolvable (existing or ip)."""
- return is_resolvable(urlparse.urlparse(url).hostname)
+ return log_time(logfunc=LOG.debug, msg="Resolving URL: " + url,
+ func=is_resolvable,
+ args=(urlparse.urlparse(url).hostname,))
def search_for_mirror(candidates):