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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
apachedex
Commits
b9989e83
Commit
b9989e83
authored
Apr 07, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add forgotten support for loading multiple states.
parent
1deaa1a0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
1 deletion
+31
-1
apachedex/__init__.py
apachedex/__init__.py
+31
-1
No files found.
apachedex/__init__.py
View file @
b9989e83
...
...
@@ -407,6 +407,19 @@ class GenericSiteStats(object):
'apdex'
:
_APDEXDateDictAsJSONState
(
self
.
apdex
),
}
def
accumulateFrom
(
self
,
other
):
# XXX: ignoring: threshold, getDuration, suffix, error_detail.
# Assuming they are consistently set.
if
self
.
error_detail
:
for
status
,
other_url_dict
in
other
.
error_url_count
.
iteritems
():
url_dict
=
self
.
error_url_count
[
status
]
for
url
,
referer_list
in
other_url_dict
.
iteritems
():
url_dict
[
url
].
extend
(
referer_list
)
for
attribute_id
in
(
'url_apdex'
,
'apdex'
):
self_attribute
=
getattr
(
self
,
attribute_id
)
for
key
,
apdex_data
in
getattr
(
other
,
attribute_id
).
iteritems
():
self_attribute
[
key
].
accumulateFrom
(
apdex_data
)
class
ERP5SiteStats
(
GenericSiteStats
):
"""
Heuristic used:
...
...
@@ -558,6 +571,19 @@ class ERP5SiteStats(GenericSiteStats):
result
[
'no_module'
]
=
_APDEXDateDictAsJSONState
(
self
.
no_module
)
return
result
def
accumulateFrom
(
self
,
other
):
super
(
ERP5SiteStats
,
self
).
accumulateFrom
(
other
)
module
=
self
.
module
for
module_id
,
other_module_dict
in
other
.
module
.
iteritems
():
module_dict
=
module
[
module_id
]
for
is_document
,
other_date_dict
in
other_module_dict
.
iteritems
():
date_dict
=
module_dict
[
is_document
]
for
date
,
apdex
in
other_date_dict
.
iteritems
():
date_dict
[
date
].
accumulateFrom
(
apdex
)
no_module
=
self
.
no_module
for
date
,
apdex
in
other
.
no_module
.
iteritems
():
no_module
[
date
].
accumulateFrom
(
apdex
)
DURATION_US_FORMAT
=
'%D'
DURATION_S_FORMAT
=
'%T'
...
...
@@ -966,8 +992,12 @@ def main():
if
action
is
None
:
print
>>
sys
.
stderr
,
'Info: no prefix match %r, stats skipped'
%
url
continue
per_site
[
site
]
=
action
.
func
.
fromJSONState
(
site_state
,
site_stats
=
action
.
func
.
fromJSONState
(
site_state
,
getDuration
,
action
.
keywords
[
'suffix'
])
if
site
in
per_site
:
per_site
[
site
].
accumulateFrom
(
site_stats
)
else
:
per_site
[
site
]
=
site_stats
print
>>
sys
.
stderr
,
'done (%s)'
%
timedelta
(
seconds
=
time
.
time
()
-
load_start
)
skip_user_agent
=
list
(
itertools
.
chain
(
*
args
.
skip_user_agent
))
...
...
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