Francesco Romani has uploaded a new change for review. Change subject: sampling: hoststats: use custom logger ......................................................................
sampling: hoststats: use custom logger Now HostStatsThread uses its own logger instead the client-provided one, which by the way was too generic. As nice side effect we may wrap the main loop into utils.traceback, to make sure we don't lose stacktraces. Change-Id: I1a15fd11cdd2d03cadddac5b71dc265eec15639e Signed-off-by: Francesco Romani <[email protected]> --- M tests/samplingTests.py M vdsm/clientIF.py M vdsm/virt/sampling.py 3 files changed, 7 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/44/47944/1 diff --git a/tests/samplingTests.py b/tests/samplingTests.py index 621b236..b881471 100644 --- a/tests/samplingTests.py +++ b/tests/samplingTests.py @@ -165,7 +165,7 @@ with MonkeyPatchScope([(sampling, 'HostSample', WrapHostSample), (sampling.HostStatsThread, 'SAMPLE_INTERVAL_SEC', 0.1)]): - self._hs = sampling.HostStatsThread(self.log) + self._hs = sampling.HostStatsThread() self._hs.start() self._samplingDone.wait(3.0) self.assertTrue(self._samplingDone.is_set()) @@ -208,7 +208,7 @@ pass with MonkeyPatchScope([(sampling, 'HostSample', FakeHostSample)]): - self._hs = sampling.HostStatsThread(self.log, samples) + self._hs = sampling.HostStatsThread(samples) self._hs._sampleInterval = 0 # we cannot monkey patch, it will interfer on threading internals self._hs._stopEvent = FakeEvent() diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py index d1e801f..8db687e 100644 --- a/vdsm/clientIF.py +++ b/vdsm/clientIF.py @@ -101,7 +101,7 @@ try: self.vmContainer = {} self._hostStats = sampling.HostStatsThread( - log, sampling.host_samples) + sampling.host_samples) self._hostStats.start() self.lastRemoteAccess = 0 self._enabled = True diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py index 71e8381..c13189d 100644 --- a/vdsm/virt/sampling.py +++ b/vdsm/virt/sampling.py @@ -547,8 +547,9 @@ """ _CONNLOG = logging.getLogger('connectivity') - def __init__(self, log, samples=host_samples, clock=utils.monotonic_time): - self._log = log + _log = logging.getLogger('vds.sampling.HostStats') + + def __init__(self, samples=host_samples, clock=utils.monotonic_time): self._samples = samples self._pid = os.getpid() @@ -572,6 +573,7 @@ def wait(self): self._thread.join() + @utils.traceback(on=_log) def _run(self): try: # wait a bit before starting to sample -- To view, visit https://gerrit.ovirt.org/47944 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1a15fd11cdd2d03cadddac5b71dc265eec15639e Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
