Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apachedex
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
apachedex
Commits
1b74aad6
Commit
1b74aad6
authored
Apr 03, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dates are not necessarily utc, apdex is not necessarily daily.
parent
8e1bd9f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
apachedex/__init__.py
apachedex/__init__.py
+13
-13
No files found.
apachedex/__init__.py
View file @
1b74aad6
...
...
@@ -128,12 +128,12 @@ class GenericSiteStats(object):
self
.
prefix
=
prefix
self
.
status
=
defaultdict
(
partial
(
defaultdict
,
int
))
self
.
slowest_list
=
[(
-
1
,
None
,
None
,
None
)]
self
.
daily_
apdex
=
defaultdict
(
partial
(
APDEXStats
,
threshold
))
self
.
apdex
=
defaultdict
(
partial
(
APDEXStats
,
threshold
))
def
accumulate
(
self
,
match
,
url_match
,
utc
date
):
self
.
status
[
match
.
group
(
'status'
)][
utc
date
]
+=
1
def
accumulate
(
self
,
match
,
url_match
,
date
):
self
.
status
[
match
.
group
(
'status'
)][
date
]
+=
1
duration
=
match
.
group
(
'duration'
)
self
.
daily_apdex
[
utc
date
].
accumulate
(
match
)
self
.
apdex
[
date
].
accumulate
(
match
)
if
duration
is
not
None
:
duration
=
int
(
duration
)
if
url_match
is
None
:
...
...
@@ -154,19 +154,19 @@ class GenericSiteStats(object):
def
getApdexData
(
self
):
apdex
=
APDEXStats
(
self
.
threshold
)
for
data
in
self
.
daily_
apdex
.
itervalues
():
for
data
in
self
.
apdex
.
itervalues
():
apdex
.
accumulateFrom
(
data
)
return
[
(
date
,
apdex
.
getApdex
()
*
100
,
apdex
.
getAverage
()
/
US_PER_S
,
float
(
apdex
.
duration_max
)
/
US_PER_S
,
apdex
.
hit
)
for
date
,
apdex
in
sorted
(
self
.
daily_
apdex
.
iteritems
(),
key
=
ITEMGETTER0
)]
in
sorted
(
self
.
apdex
.
iteritems
(),
key
=
ITEMGETTER0
)]
def
asHTML
(
self
):
self
.
_housekeeping
()
result
=
[]
append
=
result
.
append
apdex
=
APDEXStats
(
self
.
threshold
)
for
data
in
self
.
daily_
apdex
.
itervalues
():
for
data
in
self
.
apdex
.
itervalues
():
apdex
.
accumulateFrom
(
data
)
append
(
'<h2>Overall</h2><p>Hits: %i</p><p>Apdex: %i%%</p>'
'<p>Avg duration (s): %.2f</p><p>Max duration (s): %.2f</p>'
%
(
...
...
@@ -225,14 +225,14 @@ class ERP5SiteStats(GenericSiteStats):
self
.
module
=
defaultdict
(
partial
(
defaultdict
,
partial
(
defaultdict
,
partial
(
APDEXStats
,
threshold
))))
def
accumulate
(
self
,
match
,
url_match
,
utc
date
):
def
accumulate
(
self
,
match
,
url_match
,
date
):
prefix
=
self
.
prefix
split
=
url_match
.
group
(
'url'
).
split
(
'?'
,
1
)[
0
].
split
(
'/'
)[
1
+
prefix
:]
if
split
:
module
=
split
[
0
]
if
module
.
endswith
(
'_module'
):
super
(
ERP5SiteStats
,
self
).
accumulate
(
match
,
url_match
,
utc
date
)
self
.
module
[
module
][
utc
date
][
len
(
split
)
>
2
].
accumulate
(
match
)
super
(
ERP5SiteStats
,
self
).
accumulate
(
match
,
url_match
,
date
)
self
.
module
[
module
][
date
][
len
(
split
)
>
2
].
accumulate
(
match
)
def
asHTML
(
self
):
result
=
[]
...
...
@@ -439,13 +439,13 @@ def main():
if
action
is
None
:
skipped_lines
+=
1
continue
utc
date
=
asDate
(
match
.
group
(
'timestamp'
))
hit_per_day
[
utc
date
]
+=
1
date
=
asDate
(
match
.
group
(
'timestamp'
))
hit_per_day
[
date
]
+=
1
try
:
site_data
=
per_site
[
site
]
except
KeyError
:
site_data
=
per_site
[
site
]
=
action
(
threshold
)
site_data
.
accumulate
(
match
,
url_match
,
utc
date
)
site_data
.
accumulate
(
match
,
url_match
,
date
)
all_lines
+=
lineno
end_parsing_time
=
time
.
time
()
os
.
chdir
(
args
.
out
)
...
...
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