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
Sebastien Robin
apachedex
Commits
b4cd8161
Commit
b4cd8161
authored
Apr 10, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use consistent x range for all graphs on a page.
parent
5e2c3234
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
8 deletions
+35
-8
apachedex/__init__.py
apachedex/__init__.py
+35
-8
No files found.
apachedex/__init__.py
View file @
b4cd8161
...
@@ -85,6 +85,10 @@ ITEMGETTER1 = itemgetter(1)
...
@@ -85,6 +85,10 @@ ITEMGETTER1 = itemgetter(1)
APDEX_TOLERATING_COEF
=
4
APDEX_TOLERATING_COEF
=
4
AUTO_PERIOD_COEF
=
200
AUTO_PERIOD_COEF
=
200
# Larger (x < LARGER_THAN_INTEGER_STR == True) than any string starting with
# a number
LARGER_THAN_INTEGER_STR
=
'A'
def
statusIsError
(
status
):
def
statusIsError
(
status
):
return
status
[
0
]
>
'3'
return
status
[
0
]
>
'3'
...
@@ -106,8 +110,8 @@ def getDataPoints(apdex_dict):
...
@@ -106,8 +110,8 @@ def getDataPoints(apdex_dict):
in
sorted
(
apdex_dict
.
iteritems
(),
key
=
ITEMGETTER0
)]
in
sorted
(
apdex_dict
.
iteritems
(),
key
=
ITEMGETTER0
)]
def
prepareDataForGraph
(
daily_data
,
date_format
,
placeholder_delta
,
def
prepareDataForGraph
(
daily_data
,
date_format
,
placeholder_delta
,
coefficient_callback
):
coefficient_callback
,
x_min
=
None
,
x_max
=
None
):
current_date
=
datetime
.
strptime
(
daily_data
[
0
][
0
],
date_format
)
current_date
=
datetime
.
strptime
(
x_min
or
daily_data
[
0
][
0
],
date_format
)
new_daily_data
=
[]
new_daily_data
=
[]
append
=
new_daily_data
.
append
append
=
new_daily_data
.
append
for
(
measure_date_string
,
apdex
,
hit
)
in
daily_data
:
for
(
measure_date_string
,
apdex
,
hit
)
in
daily_data
:
...
@@ -120,6 +124,10 @@ def prepareDataForGraph(daily_data, date_format, placeholder_delta,
...
@@ -120,6 +124,10 @@ def prepareDataForGraph(daily_data, date_format, placeholder_delta,
append
((
measure_date_string
,
apdex
,
append
((
measure_date_string
,
apdex
,
hit
*
coefficient_callback
(
measure_date
)))
hit
*
coefficient_callback
(
measure_date
)))
current_date
=
measure_date
+
placeholder_delta
current_date
=
measure_date
+
placeholder_delta
if
x_max
is
not
None
and
current_date
<
datetime
.
strptime
(
x_max
,
date_format
):
append
((
current_date
.
strftime
(
date_format
),
100
,
0
))
append
((
x_max
,
100
,
0
))
return
new_daily_data
return
new_daily_data
def
graphPair
(
daily_data
,
date_format
,
graph_period
):
def
graphPair
(
daily_data
,
date_format
,
graph_period
):
...
@@ -320,7 +328,9 @@ class GenericSiteStats(object):
...
@@ -320,7 +328,9 @@ class GenericSiteStats(object):
return
getDataPoints
(
self
.
apdex
)
return
getDataPoints
(
self
.
apdex
)
def
asHTML
(
self
,
date_format
,
placeholder_delta
,
graph_period
,
def
asHTML
(
self
,
date_format
,
placeholder_delta
,
graph_period
,
graph_coefficient
,
encoding
,
stat_filter
=
lambda
x
:
x
):
graph_coefficient
,
encoding
,
stat_filter
=
lambda
x
:
x
,
x_min
=
None
,
x_max
=
None
,
):
result
=
[]
result
=
[]
append
=
result
.
append
append
=
result
.
append
apdex
=
APDEXStats
(
self
.
threshold
,
None
)
apdex
=
APDEXStats
(
self
.
threshold
,
None
)
...
@@ -511,7 +521,8 @@ class ERP5SiteStats(GenericSiteStats):
...
@@ -511,7 +521,8 @@ class ERP5SiteStats(GenericSiteStats):
self
.
no_module
[
value_date
].
accumulate
(
match
)
self
.
no_module
[
value_date
].
accumulate
(
match
)
def
asHTML
(
self
,
date_format
,
placeholder_delta
,
graph_period
,
graph_coefficient
,
def
asHTML
(
self
,
date_format
,
placeholder_delta
,
graph_period
,
graph_coefficient
,
encoding
,
stat_filter
=
lambda
x
:
x
):
encoding
,
stat_filter
=
lambda
x
:
x
,
x_min
=
None
,
x_max
=
None
,
):
result
=
[]
result
=
[]
append
=
result
.
append
append
=
result
.
append
append
(
'<h2>Stats per module</h2><table class="stats stats_erp5"><tr>'
append
(
'<h2>Stats per module</h2><table class="stats stats_erp5"><tr>'
...
@@ -570,6 +581,8 @@ class ERP5SiteStats(GenericSiteStats):
...
@@ -570,6 +581,8 @@ class ERP5SiteStats(GenericSiteStats):
date_format
,
date_format
,
placeholder_delta
,
placeholder_delta
,
graph_coefficient
,
graph_coefficient
,
x_min
=
x_min
,
x_max
=
x_max
,
),
),
date_format
,
date_format
,
graph_period
,
graph_period
,
...
@@ -607,7 +620,9 @@ class ERP5SiteStats(GenericSiteStats):
...
@@ -607,7 +620,9 @@ class ERP5SiteStats(GenericSiteStats):
append
(
'</tr></table>'
)
append
(
'</tr></table>'
)
append
(
super
(
ERP5SiteStats
,
self
).
asHTML
(
date_format
,
append
(
super
(
ERP5SiteStats
,
self
).
asHTML
(
date_format
,
placeholder_delta
,
graph_period
,
graph_coefficient
,
encoding
,
placeholder_delta
,
graph_period
,
graph_coefficient
,
encoding
,
stat_filter
=
stat_filter
))
stat_filter
=
stat_filter
,
x_min
=
x_min
,
x_max
=
x_max
,
))
return
'
\
n
'
.
join
(
result
)
return
'
\
n
'
.
join
(
result
)
@
classmethod
@
classmethod
...
@@ -918,9 +933,17 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict,
...
@@ -918,9 +933,17 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict,
out
.
write
(
'</table><h2>Hits per period</h2><table class="stats">'
out
.
write
(
'</table><h2>Hits per period</h2><table class="stats">'
'<tr><th>date</th><th>hits</th></tr>'
)
'<tr><th>date</th><th>hits</th></tr>'
)
hit_per_day
=
defaultdict
(
int
)
hit_per_day
=
defaultdict
(
int
)
x_min
=
LARGER_THAN_INTEGER_STR
x_max
=
None
for
site_data
in
per_site
.
itervalues
():
for
site_data
in
per_site
.
itervalues
():
for
hit_date
,
_
,
hit
in
site_data
.
getApdexData
():
apdex_data_list
=
site_data
.
getApdexData
()
hit_per_day
[
decimator
(
hit_date
)]
+=
hit
if
apdex_data_list
:
x_min
=
min
(
x_min
,
apdex_data_list
[
0
][
0
])
x_max
=
max
(
x_max
,
apdex_data_list
[
-
1
][
0
])
for
hit_date
,
_
,
hit
in
apdex_data_list
:
hit_per_day
[
decimator
(
hit_date
)]
+=
hit
if
x_min
==
LARGER_THAN_INTEGER_STR
:
x_min
=
None
for
hit_date
,
hit
in
sorted
(
hit_per_day
.
iteritems
(),
key
=
ITEMGETTER0
):
for
hit_date
,
hit
in
sorted
(
hit_per_day
.
iteritems
(),
key
=
ITEMGETTER0
):
out
.
write
(
'<tr><td>%s</td><td>%s</td></tr>'
%
(
hit_date
,
hit
))
out
.
write
(
'<tr><td>%s</td><td>%s</td></tr>'
%
(
hit_date
,
hit
))
out
.
write
(
'</table>'
)
out
.
write
(
'</table>'
)
...
@@ -936,13 +959,17 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict,
...
@@ -936,13 +959,17 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict,
date_format
,
date_format
,
placeholder_delta
,
placeholder_delta
,
graph_coefficient
,
graph_coefficient
,
x_min
=
x_min
,
x_max
=
x_max
,
),
),
date_format
,
date_format
,
graph_period
,
graph_period
,
)
)
)
)
out
.
write
(
data
.
asHTML
(
date_format
,
placeholder_delta
,
graph_period
,
out
.
write
(
data
.
asHTML
(
date_format
,
placeholder_delta
,
graph_period
,
graph_coefficient
,
encoding
,
decimator
))
graph_coefficient
,
encoding
,
decimator
,
x_min
=
x_min
,
x_max
=
x_max
,
))
end_stat_time
=
time
.
time
()
end_stat_time
=
time
.
time
()
if
args
.
stats
:
if
args
.
stats
:
out
.
write
(
'<h1>Parsing stats</h1><table class="stats">'
)
out
.
write
(
'<h1>Parsing stats</h1><table class="stats">'
)
...
...
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