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
dd384035
Commit
dd384035
authored
Apr 10, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for non-linear scales.
parent
0b5086cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
apachedex/__init__.py
apachedex/__init__.py
+12
-1
apachedex/apachedex.js
apachedex/apachedex.js
+23
-1
No files found.
apachedex/__init__.py
View file @
dd384035
...
@@ -131,7 +131,7 @@ def prepareDataForGraph(daily_data, date_format, placeholder_delta,
...
@@ -131,7 +131,7 @@ def prepareDataForGraph(daily_data, date_format, placeholder_delta,
return
new_daily_data
return
new_daily_data
def
graphPair
(
daily_data
,
date_format
,
graph_period
,
apdex_y_min
=
None
,
def
graphPair
(
daily_data
,
date_format
,
graph_period
,
apdex_y_min
=
None
,
hit_y_min
=
None
,
hit_y_max
=
None
):
hit_y_min
=
None
,
hit_y_max
=
None
,
apdex_y_scale
=
None
):
date_list
=
[
int
(
calendar
.
timegm
(
time
.
strptime
(
x
[
0
],
date_format
))
*
1000
)
date_list
=
[
int
(
calendar
.
timegm
(
time
.
strptime
(
x
[
0
],
date_format
))
*
1000
)
for
x
in
daily_data
]
for
x
in
daily_data
]
timeformat
=
'%Y/<br/>%m/%d<br/> %H:%M'
timeformat
=
'%Y/<br/>%m/%d<br/> %H:%M'
...
@@ -154,6 +154,7 @@ def graphPair(daily_data, date_format, graph_period, apdex_y_min=None,
...
@@ -154,6 +154,7 @@ def graphPair(daily_data, date_format, graph_period, apdex_y_min=None,
'max'
:
100
,
'max'
:
100
,
'axisLabel'
:
'apdex (%)'
,
'axisLabel'
:
'apdex (%)'
,
'labelWidth'
:
yLabelWidth
,
'labelWidth'
:
yLabelWidth
,
'transform'
:
apdex_y_scale
,
},
},
'lines'
:
{
'show'
:
True
},
'lines'
:
{
'show'
:
True
},
'grid'
:
{
'grid'
:
{
...
@@ -335,6 +336,7 @@ class GenericSiteStats(object):
...
@@ -335,6 +336,7 @@ class GenericSiteStats(object):
graph_coefficient
,
encoding
,
stat_filter
=
lambda
x
:
x
,
graph_coefficient
,
encoding
,
stat_filter
=
lambda
x
:
x
,
x_min
=
None
,
x_max
=
None
,
x_min
=
None
,
x_max
=
None
,
apdex_y_min
=
None
,
hit_y_min
=
None
,
hit_y_max
=
None
,
apdex_y_min
=
None
,
hit_y_min
=
None
,
hit_y_max
=
None
,
apdex_y_scale
=
None
,
):
):
result
=
[]
result
=
[]
append
=
result
.
append
append
=
result
.
append
...
@@ -528,6 +530,7 @@ class ERP5SiteStats(GenericSiteStats):
...
@@ -528,6 +530,7 @@ class ERP5SiteStats(GenericSiteStats):
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
,
x_min
=
None
,
x_max
=
None
,
encoding
,
stat_filter
=
lambda
x
:
x
,
x_min
=
None
,
x_max
=
None
,
apdex_y_min
=
None
,
hit_y_min
=
None
,
hit_y_max
=
None
,
apdex_y_min
=
None
,
hit_y_min
=
None
,
hit_y_max
=
None
,
apdex_y_scale
=
None
,
):
):
result
=
[]
result
=
[]
append
=
result
.
append
append
=
result
.
append
...
@@ -595,6 +598,7 @@ class ERP5SiteStats(GenericSiteStats):
...
@@ -595,6 +598,7 @@ class ERP5SiteStats(GenericSiteStats):
apdex_y_min
=
apdex_y_min
,
apdex_y_min
=
apdex_y_min
,
hit_y_min
=
hit_y_min
,
hit_y_min
=
hit_y_min
,
hit_y_max
=
hit_y_max
,
hit_y_max
=
hit_y_max
,
apdex_y_scale
=
apdex_y_scale
,
))
))
append
(
'</div></div>'
)
append
(
'</div></div>'
)
append
(
'</td>'
)
append
(
'</td>'
)
...
@@ -632,6 +636,7 @@ class ERP5SiteStats(GenericSiteStats):
...
@@ -632,6 +636,7 @@ class ERP5SiteStats(GenericSiteStats):
stat_filter
=
stat_filter
,
stat_filter
=
stat_filter
,
x_min
=
x_min
,
x_max
=
x_max
,
x_min
=
x_min
,
x_max
=
x_max
,
apdex_y_min
=
apdex_y_min
,
hit_y_min
=
hit_y_min
,
hit_y_max
=
hit_y_max
,
apdex_y_min
=
apdex_y_min
,
hit_y_min
=
hit_y_min
,
hit_y_max
=
hit_y_max
,
apdex_y_scale
=
apdex_y_scale
,
))
))
return
'
\
n
'
.
join
(
result
)
return
'
\
n
'
.
join
(
result
)
...
@@ -932,6 +937,7 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict,
...
@@ -932,6 +937,7 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict,
else
:
else
:
out
.
write
(
'<script type="text/javascript" src="%s/%s"></script>'
%
(
out
.
write
(
'<script type="text/javascript" src="%s/%s"></script>'
%
(
js_path
,
script
))
js_path
,
script
))
apdex_y_scale
=
apdex_y_scale_dict
[
args
.
apdex_yscale
]
out
.
write
(
'</head><body><h1>Overall</h1>'
)
out
.
write
(
'</head><body><h1>Overall</h1>'
)
site_list
=
list
(
enumerate
(
sorted
(
per_site
.
iteritems
(),
site_list
=
list
(
enumerate
(
sorted
(
per_site
.
iteritems
(),
key
=
lambda
x
:
site_caption_dict
[
x
[
0
]])))
key
=
lambda
x
:
site_caption_dict
[
x
[
0
]])))
...
@@ -989,12 +995,14 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict,
...
@@ -989,12 +995,14 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict,
apdex_y_min
=
apdex_y_min
,
apdex_y_min
=
apdex_y_min
,
hit_y_min
=
hit_y_min
,
hit_y_min
=
hit_y_min
,
hit_y_max
=
hit_y_max
,
hit_y_max
=
hit_y_max
,
apdex_y_scale
=
apdex_y_scale
,
)
)
)
)
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
,
x_min
=
x_min
,
x_max
=
x_max
,
apdex_y_min
=
apdex_y_min
,
hit_y_min
=
hit_y_min
,
hit_y_max
=
hit_y_max
,
apdex_y_min
=
apdex_y_min
,
hit_y_min
=
hit_y_min
,
hit_y_max
=
hit_y_max
,
apdex_y_scale
=
apdex_y_scale
,
))
))
end_stat_time
=
time
.
time
()
end_stat_time
=
time
.
time
()
if
args
.
stats
:
if
args
.
stats
:
...
@@ -1101,6 +1109,9 @@ def main():
...
@@ -1101,6 +1109,9 @@ def main():
help
=
'Fix graph vertical range: 0-100%% for apdex, 0-value for hits. '
help
=
'Fix graph vertical range: 0-100%% for apdex, 0-value for hits. '
'Negative value means hit max is adapted to data (used when this '
'Negative value means hit max is adapted to data (used when this '
'argument is provided without value).'
)
'argument is provided without value).'
)
group
.
add_argument
(
'--apdex-yscale'
,
default
=
'linear'
,
choices
=
apdex_y_scale_dict
,
help
=
'apdex graph ordinate scale. Default: %(default)s'
)
group
=
parser
.
add_argument_group
(
'site matching'
,
'Earlier arguments take '
group
=
parser
.
add_argument_group
(
'site matching'
,
'Earlier arguments take '
'precedence. For example: --skip-base "/foo/bar(/|$|
\
\
?)" '
'precedence. For example: --skip-base "/foo/bar(/|$|
\
\
?)" '
...
...
apachedex/apachedex.js
View file @
dd384035
...
@@ -23,14 +23,36 @@ function updateGraphTooltip(event, pos, item, previousIndex, tooltip, plot) {
...
@@ -23,14 +23,36 @@ function updateGraphTooltip(event, pos, item, previousIndex, tooltip, plot) {
}
}
return
previousIndex
;
return
previousIndex
;
}
}
scale_map
=
{
log100To0
:
[
function
(
v
)
{
return
-
Math
.
log
(
101
-
v
);
},
function
(
v
)
{
return
101
-
Math
.
exp
(
-
v
);
}
]
}
function
updateAxisTransform
(
axis
)
{
if
(
axis
!=
undefined
)
{
transform_list
=
scale_map
[
axis
.
transform
];
if
(
transform_list
==
undefined
)
{
return
;
}
axis
.
transform
=
transform_list
[
0
];
axis
.
inverseTransform
=
transform_list
[
1
];
}
}
function
renderGraph
(
container
)
{
function
renderGraph
(
container
)
{
var
container
=
$
(
container
);
var
container
=
$
(
container
);
var
previousIndex
=
null
;
var
previousIndex
=
null
;
var
tooltip
=
container
.
next
(
"
.tooltip
"
);
var
tooltip
=
container
.
next
(
"
.tooltip
"
);
var
options
=
$
.
parseJSON
(
container
.
attr
(
"
data-options
"
));
updateAxisTransform
(
options
.
xaxis
);
updateAxisTransform
(
options
.
yaxis
);
var
plot
=
$
.
plot
(
var
plot
=
$
.
plot
(
container
,
container
,
$
.
parseJSON
(
container
.
attr
(
"
data-points
"
)),
$
.
parseJSON
(
container
.
attr
(
"
data-points
"
)),
$
.
parseJSON
(
container
.
attr
(
"
data-options
"
))
options
);
);
tooltip
.
detach
();
tooltip
.
detach
();
container
.
append
(
tooltip
);
container
.
append
(
tooltip
);
...
...
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