diff options
author | Ryan Harper <ryan.harper@canonical.com> | 2018-04-30 08:27:22 -0600 |
---|---|---|
committer | Chad Smith <chad.smith@canonical.com> | 2018-04-30 08:27:22 -0600 |
commit | 4bd5870f62df771f2a346b0003fd03e44d7fac19 (patch) | |
tree | 0ce203ee458bef2c45a6917ce5839a90e6014978 /cloudinit/stages.py | |
parent | 6ef92c98c3d2b127b05d6708337efc8a81e00071 (diff) | |
download | vyos-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/stages.py')
-rw-r--r-- | cloudinit/stages.py | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/cloudinit/stages.py b/cloudinit/stages.py index bc4ebc85..3998cf68 100644 --- a/cloudinit/stages.py +++ b/cloudinit/stages.py @@ -362,16 +362,22 @@ class Init(object): self._store_vendordata() def setup_datasource(self): - if self.datasource is None: - raise RuntimeError("Datasource is None, cannot setup.") - self.datasource.setup(is_new_instance=self.is_new_instance()) + with events.ReportEventStack("setup-datasource", + "setting up datasource", + parent=self.reporter): + if self.datasource is None: + raise RuntimeError("Datasource is None, cannot setup.") + self.datasource.setup(is_new_instance=self.is_new_instance()) def activate_datasource(self): - if self.datasource is None: - raise RuntimeError("Datasource is None, cannot activate.") - self.datasource.activate(cfg=self.cfg, - is_new_instance=self.is_new_instance()) - self._write_to_cache() + with events.ReportEventStack("activate-datasource", + "activating datasource", + parent=self.reporter): + if self.datasource is None: + raise RuntimeError("Datasource is None, cannot activate.") + self.datasource.activate(cfg=self.cfg, + is_new_instance=self.is_new_instance()) + self._write_to_cache() def _store_userdata(self): raw_ud = self.datasource.get_userdata_raw() |