Change in vdsm[master]: repoplot: More correct log parsing
nsoffer at redhat.com
nsoffer at redhat.com
Sat Feb 27 16:44:46 UTC 2016
Nir Soffer has uploaded a new change for review.
Change subject: repoplot: More correct log parsing
......................................................................
repoplot: More correct log parsing
For correctness, parse also function name embedded into the last field.
This filed is available now as log.func. Reformat Log namedtuple as it
does not fit in one line now.
Change-Id: I05a675e3a2087d9899341afb28a5b470bb0d0ee2
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M contrib/repoplot
1 file changed, 19 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/54112/1
diff --git a/contrib/repoplot b/contrib/repoplot
index b79c40b..4dd083f 100755
--- a/contrib/repoplot
+++ b/contrib/repoplot
@@ -68,7 +68,16 @@
return parser.parse_args(args)
-Log = namedtuple("Log", "thread,loglevel,timestamp,module,lineno,logger,text")
+Log = namedtuple("Log", (
+ "thread",
+ "loglevel",
+ "timestamp",
+ "module",
+ "lineno",
+ "logger",
+ "func",
+ "text"
+))
class Stats(object):
@@ -253,7 +262,7 @@
"""
Add commands start and stop events from execCmd calls
"""
- if " SUCCESS:" in log.text or " ERROR:" in log.text:
+ if "SUCCESS:" in log.text or "ERROR:" in log.text:
commands[log.thread].end(log.timestamp)
else:
commands[log.thread].start(log.timestamp)
@@ -275,16 +284,20 @@
"""
Add qemu-img commands start or stop events (pre 4.0).
"""
- if " SUCCESS:" in log.text or " ERROR:" in log.text:
+ if "SUCCESS:" in log.text or "ERROR:" in log.text:
commands[log.thread].end(log.timestamp)
elif "/usr/bin/qemu-img convert " in log.text:
commands[log.thread].start(log.timestamp)
def parse_log(line):
- # MainThread::DEBUG::2016-02-17
- # 19:26:03,875::sp::398::Storage.StoragePool::(cleanupMasterMount) ...
- fields = line.split("::", 7)
+ # thread::loglevel::timestamp::module::lineno::logger::(func) text
+ fields = line.split("::", 6)
+ # Split "(func) text"
+ func, text = fields[6].split(" ", 1)
+ fields[6] = func[1:-1]
+ fields.append(text)
+ # Parse timestamp
timestamp = fields[2]
timestamp = timestamp.replace(",", ".")
fields[2] = pandas.Timestamp(timestamp)
--
To view, visit https://gerrit.ovirt.org/54112
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I05a675e3a2087d9899341afb28a5b470bb0d0ee2
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