Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
cadbb73a
Commit
cadbb73a
authored
Dec 12, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to work with the current zlog output from ZEO2.
parent
d9741d14
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
35 deletions
+52
-35
src/scripts/parsezeolog.py
src/scripts/parsezeolog.py
+52
-35
No files found.
src/scripts/parsezeolog.py
View file @
cadbb73a
"""Parse the BLATHER logging generated by ZEO.
"""Parse the BLATHER logging generated by ZEO
2
.
An example of the log format is:
An example of the log format is:
2002-04-15T13:05:29 BLATHER(-100) ZEO Server storea(3235680, [714], 235339406490168806) ('10.0.26.30', 45514)
2002-04-15T13:05:29 BLATHER(-100) ZEO Server storea(3235680, [714], 235339406490168806) ('10.0.26.30', 45514)
...
@@ -20,7 +20,7 @@ def parse_time(line):
...
@@ -20,7 +20,7 @@ def parse_time(line):
time_l
=
[
int
(
elt
)
for
elt
in
time_
.
split
(
':'
)]
time_l
=
[
int
(
elt
)
for
elt
in
time_
.
split
(
':'
)]
return
int
(
time
.
mktime
(
date_l
+
time_l
+
[
0
,
0
,
0
]))
return
int
(
time
.
mktime
(
date_l
+
time_l
+
[
0
,
0
,
0
]))
rx_meth
=
re
.
compile
(
"
ZEO Server (
\
w+)
\
((.*)
\
)
\
('(.*)', (
\
d+
)
"
)
rx_meth
=
re
.
compile
(
"
zrpc:
\
d+ c
a
lling (
\
w+)
\
((.*
)"
)
def
parse_method
(
line
):
def
parse_method
(
line
):
pass
pass
...
@@ -34,67 +34,82 @@ def parse_line(line):
...
@@ -34,67 +34,82 @@ def parse_line(line):
if
mo
is
None
:
if
mo
is
None
:
return
None
,
None
,
None
return
None
,
None
,
None
meth_name
=
mo
.
group
(
1
)
meth_name
=
mo
.
group
(
1
)
meth_args = mo.group(2)
meth_args
=
mo
.
group
(
2
).
strip
()
if
meth_args
.
endswith
(
')'
):
meth_args
=
meth_args
[:
-
1
]
meth_args
=
[
s
.
strip
()
for
s
in
meth_args
.
split
(
","
)]
meth_args
=
[
s
.
strip
()
for
s
in
meth_args
.
split
(
","
)]
m
=
meth_name
,
tuple
(
meth_args
)
m
=
meth_name
,
tuple
(
meth_args
)
c = mo.group(3), mo.group(4)
return
t
,
m
return t, m, c
class
TStats
:
class
TStats
:
pass
counter
=
1
def
__init__
(
self
):
self
.
id
=
TStats
.
counter
TStats
.
counter
+=
1
def
report
(
self
):
"""Print a report about the transaction"""
print
time
.
ctime
(
self
.
begin
),
if
hasattr
(
self
,
"vote"
):
print
self
.
vote
-
self
.
begin
,
else
:
print
"*"
,
if
hasattr
(
self
,
"finish"
):
print
self
.
finish
-
self
.
begin
,
else
:
print
"*"
,
print
self
.
user
,
self
.
url
class
TransactionParser
:
class
TransactionParser
:
def
__init__
(
self
):
def
__init__
(
self
):
self.transactions = []
self
.
txns
=
{}
self.cur_t = {}
self
.
skipped
=
0
self
.
skipped
=
0
def
parse
(
self
,
line
):
def
parse
(
self
,
line
):
t, m
, c
= parse_line(line)
t
,
m
=
parse_line
(
line
)
if
t
is
None
:
if
t
is
None
:
return
return
name
=
m
[
0
]
name
=
m
[
0
]
meth
=
getattr
(
self
,
name
,
None
)
meth
=
getattr
(
self
,
name
,
None
)
if
meth
is
not
None
:
if
meth
is
not
None
:
meth(t, m[1]
, c
)
meth
(
t
,
m
[
1
])
def tpc_begin(self, time, args
, client
):
def
tpc_begin
(
self
,
time
,
args
):
t
=
TStats
()
t
=
TStats
()
t
.
begin
=
time
t
.
begin
=
time
t
.
user
=
args
[
1
]
t
.
url
=
args
[
2
]
t
.
url
=
args
[
2
]
t
.
objects
=
[]
t
.
objects
=
[]
self.cur_t[client] = t
tid
=
eval
(
args
[
0
])
self
.
txns
[
tid
]
=
t
def
get_txn
(
self
,
args
):
tid
=
eval
(
args
[
0
])
try
:
return
self
.
txns
[
tid
]
except
KeyError
:
print
"uknown tid"
,
repr
(
tid
)
return
None
def tpc_finish(self, time, args
, client
):
def
tpc_finish
(
self
,
time
,
args
):
t = self.
cur_t.get(client, None
)
t
=
self
.
get_txn
(
args
)
if
t
is
None
:
if
t
is
None
:
self.skipped += 1
return
return
t
.
finish
=
time
t
.
finish
=
time
## self.transactions.append(t)
self.report(t)
self.cur_t[client] = None
def
storea(self, time, args, client
):
def
vote
(
self
,
time
,
args
):
t = self.
cur_t.get(client, None
)
t
=
self
.
get_txn
(
args
)
if
t
is
None
:
if
t
is
None
:
self.skipped += 1
return
return
# append the oid and the length of the object
t
.
vote
=
time
# parse the length as [NNN]
info = int(args[0]), int(args[1][1:-1])
t.objects.append(info)
def report(self, t):
def
get_txns
(
self
):
"""Print a report about the transaction"""
L
=
[(
t
.
id
,
t
)
for
t
in
self
.
txns
.
values
()]
if t.objects:
L
.
sort
()
bytes = reduce(operator.add, [size for oid, size in t.objects])
return
[
t
for
(
id
,
t
)
in
L
]
else:
bytes = 0
print "
%
s
%
2
d
%
4
d
%
10
d
%
s
" % (t.begin, t.finish - t.begin,
len(t.objects), bytes,
time.ctime(t.begin)), t.url
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
import
fileinput
import
fileinput
...
@@ -108,4 +123,6 @@ if __name__ == "__main__":
...
@@ -108,4 +123,6 @@ if __name__ == "__main__":
except
:
except
:
print
"line"
,
i
print
"line"
,
i
raise
raise
print len(p.transactions)
print
"Transaction: %d"
%
len
(
p
.
txns
)
for
txn
in
p
.
get_txns
():
txn
.
report
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment