Change in vdsm[master]: virt: sampling: add StatsCache
fromani at redhat.com
fromani at redhat.com
Tue Mar 31 12:18:57 UTC 2015
Francesco Romani has posted comments on this change.
Change subject: virt: sampling: add StatsCache
......................................................................
Patch Set 2:
(5 comments)
https://gerrit.ovirt.org/#/c/39331/2/vdsm/virt/sampling.py
File vdsm/virt/sampling.py:
Line 402:
Line 403:
Line 404: class StatsCache(object):
Line 405: def __init__(self, log=None):
Line 406: self._log = (log if log is not None else
> I see no reason to pass log as arg, at all. a static getLogger call seems e
Actually there is not good reason, fixed.
Line 407: logging.getLogger("sampling.StatsCache"))
Line 408: self._samples = SampleWindow(2)
Line 409: self._last_sample_time = 0
Line 410:
Line 404: class StatsCache(object):
Line 405: def __init__(self, log=None):
Line 406: self._log = (log if log is not None else
Line 407: logging.getLogger("sampling.StatsCache"))
Line 408: self._samples = SampleWindow(2)
> move here the change from patch 38066
Done
Line 409: self._last_sample_time = 0
Line 410:
Line 411: def get(self, vmid):
Line 412: first_batch, last_batch, interval = self._samples.stats()
Line 410:
Line 411: def get(self, vmid):
Line 412: first_batch, last_batch, interval = self._samples.stats()
Line 413: if first_batch is None:
Line 414: return (None, None, interval)
> interval is always None in this case. Let's return None.
Done (both comments)
Line 415:
Line 416: first_sample = first_batch.get(vmid)
Line 417: last_sample = last_batch.get(vmid)
Line 418: return (first_sample, last_sample, interval)
Line 413: if first_batch is None:
Line 414: return (None, None, interval)
Line 415:
Line 416: first_sample = first_batch.get(vmid)
Line 417: last_sample = last_batch.get(vmid)
> What happens if a vm becomes non-responsive? nowadays, we keep reporting th
Will do. Unfortunately I didn't take this case in account: I wrongly thought stale old data is always meaningless, that is no actually true. Will fix in a followup patch. Not sure this must be fixed at sampling level or at Vm level.
Line 418: return (first_sample, last_sample, interval)
Line 419:
Line 420: def put(self, bulk_stats, monotonic_ts):
Line 421: if monotonic_ts >= self._last_sample_time:
Line 430: else:
Line 431: sample = batch.get(vmid)
Line 432:
Line 433: if sample is None:
Line 434: return None, 0
> same here always return None
Done
Line 435: else:
Line 436: return sample, timestamp
Line 437:
Line 438:
--
To view, visit https://gerrit.ovirt.org/39331
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I11d5069f49d54bb5f43a7c4914c7e4b9f8093db9
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list