Change in vdsm[master]: repoplot: Prepare for collecting other commands

nsoffer at redhat.com nsoffer at redhat.com
Fri Feb 26 23:09:57 UTC 2016


Nir Soffer has uploaded a new change for review.

Change subject: repoplot: Prepare for collecting other commands
......................................................................

repoplot: Prepare for collecting other commands

Change add_lvm_command to generic add_command, so we can use the same
logic for detecting start and stop of a command for collecting other
commands statistics.

Change-Id: Ib553d3653230f1eb4a4ed950021e6d95cbbf0a49
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M contrib/repoplot
1 file changed, 13 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/04/54104/1

diff --git a/contrib/repoplot b/contrib/repoplot
index baaa326..eda5f40 100755
--- a/contrib/repoplot
+++ b/contrib/repoplot
@@ -100,7 +100,8 @@
         # jsonrpc.Executor/5::INFO::2016-02-17
         # 19:26:33,837::logUtils::51::dispatcher::(wrapper) Run and protect:
         # repoStats, Return response: ...
-        (add_repostats, "Run and protect: repoStats, Return response:"),
+        (add_repostats, "Run and protect: repoStats, Return response:",
+            "repostats"),
 
         # Match LVM commands begin or end logs.
         #
@@ -112,35 +113,39 @@
         # End:
         # Thread-57::DEBUG::2016-02-17
         # 19:26:33,933::lvm::286::Storage.Misc.excCmd::(cmd) SUCCESS: ...
-        (add_lvm_command, "::Storage.Misc.excCmd::(cmd)"),
+        (add_command, "::Storage.Misc.excCmd::(cmd)", "lvm_commands"),
     ]
 
     stats = Stats()
 
     for line in fileinput.input(files):
-        for func, pattern in patterns:
+        for func, pattern, name in patterns:
             if pattern in line:
                 log = parse_log(line)
-                func(stats, log)
+                substats = getattr(stats, name)
+                func(substats, log)
 
     return stats
 
 
-def add_repostats(stats, log):
+def add_repostats(repostats, log):
     """
     Add repostats samples from repoStats response line
     """
     start = log.text.find("{")
     response = eval(log.text[start:])
     for uuid, info in response.items():
-        ds = stats.repostats[uuid]
+        ds = repostats[uuid]
         ds.timestamp.append(log.timestamp)
         ds.lastcheck.append(float(info["lastCheck"]))
         ds.delay.append(float(info["delay"]))
 
 
-def add_lvm_command(stats, log):
-    cs = stats.lvm_commands[log.thread]
+def add_command(commands, log):
+    """
+    Add commands start and stop events from execCmd calls
+    """
+    cs = commands[log.thread]
     if " SUCCESS:" in log.text or " ERROR:" in log.text:
         if not cs.running:
             return


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib553d3653230f1eb4a4ed950021e6d95cbbf0a49
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list