Change in vdsm[master]: virt: stats: make compute_latency more robust

fromani at redhat.com fromani at redhat.com
Wed Dec 16 12:51:47 UTC 2015


Francesco Romani has uploaded a new change for review.

Change subject: virt: stats: make compute_latency more robust
......................................................................

virt: stats: make compute_latency more robust

Make compute_latency more robust and less noisy
when some fields are missing from bulk stats.
This can happen, so we must handle this case silently.

Bug-Url: https://bugzilla.redhat.com/1281337
Change-Id: Ie4670309d48bd65a3afaba8124407598b76d808d
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/virt/vmstats.py
1 file changed, 12 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/50593/1

diff --git a/vdsm/virt/vmstats.py b/vdsm/virt/vmstats.py
index 6324690..9ec4ba5 100644
--- a/vdsm/virt/vmstats.py
+++ b/vdsm/virt/vmstats.py
@@ -342,11 +342,18 @@
         )
         return elapsed_time / operations
 
-    return {
-        'readLatency': str(compute_latency('rd')),
-        'writeLatency': str(compute_latency('wr')),
-        'flushLatency': str(compute_latency('fl'))
-    }
+    stats = {}
+
+    def add_latency(name, mode):
+        try:
+            stats[name] = str(compute_latency(mode))
+        except KeyError:
+            pass
+
+    add_latency('readLatency', 'rd')
+    add_latency('writeLatency', 'wr')
+    add_latency('flushLatency', 'fl')
+    return stats
 
 
 def _disk_iops_bytes(first_sample, first_index, last_sample, last_index):


-- 
To view, visit https://gerrit.ovirt.org/50593
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4670309d48bd65a3afaba8124407598b76d808d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list