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
2c0837f3
Commit
2c0837f3
authored
Apr 07, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compute hits per day from site data.
Speeds up parsing a bit, and makes future extensions easier.
parent
4e9ac582
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
apachedex/__init__.py
apachedex/__init__.py
+17
-2
No files found.
apachedex/__init__.py
View file @
2c0837f3
...
...
@@ -392,6 +392,19 @@ class ERP5SiteStats(GenericSiteStats):
else
:
self
.
no_module
[
date
].
accumulate
(
match
)
def
getApdexData
(
self
):
asDict
=
lambda
apdex_data
:
dict
((
x
,
(
y
,
z
))
for
(
x
,
y
,
z
)
in
apdex_data
)
date_dict
=
asDict
(
super
(
ERP5SiteStats
,
self
).
getApdexData
())
for
date
,
(
apdex
,
hit
)
in
asDict
(
getDataPoints
(
self
.
no_module
)
).
iteritems
():
super_apdex
,
super_hit
=
date_dict
.
get
(
date
,
(
0
,
100
))
new_hit
=
hit
+
super_hit
if
super_hit
:
new_apdex
=
super_apdex
*
new_hit
/
super_hit
+
apdex
*
new_hit
/
hit
date_dict
[
date
]
=
(
new_apdex
,
new_hit
)
return
sorted
(((
date
,
apdex
,
hit
)
for
date
,
(
apdex
,
hit
)
in
date_dict
.
iteritems
()),
key
=
ITEMGETTER0
)
def
asHTML
(
self
,
date_format
,
placeholder_delta
,
graph_period
,
stat_filter
=
lambda
x
:
x
):
result
=
[]
...
...
@@ -695,7 +708,6 @@ def main():
error_detail
=
args
.
error_detail
file_count
=
len
(
infile_list
)
per_site
=
{}
hit_per_day
=
defaultdict
(
int
)
skip_user_agent
=
list
(
itertools
.
chain
(
*
args
.
skip_user_agent
))
malformed_lines
=
0
skipped_lines
=
0
...
...
@@ -745,7 +757,6 @@ def main():
skipped_lines
+=
1
continue
date
=
asDate
(
match
.
group
(
'timestamp'
))
hit_per_day
[
decimator
(
date
)]
+=
1
try
:
site_data
=
per_site
[
site
]
except
KeyError
:
...
...
@@ -788,6 +799,10 @@ def main():
caption
,
value
))
out
.
write
(
'</table><h2>Hits per period</h2><table class="stats">'
'<tr><th>date</th><th>hits</th></tr>'
)
hit_per_day
=
defaultdict
(
int
)
for
site_data
in
per_site
.
itervalues
():
for
date
,
_
,
hit
in
site_data
.
getApdexData
():
hit_per_day
[
decimator
(
date
)]
+=
hit
for
date
,
hit
in
sorted
(
hit_per_day
.
iteritems
(),
key
=
ITEMGETTER0
):
out
.
write
(
'<tr><td>%s</td><td>%s</td></tr>'
%
(
date
,
hit
))
out
.
write
(
'</table>'
)
...
...
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