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
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,
return
new_daily_data
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
)
for
x
in
daily_data
]
timeformat
=
'%Y/<br/>%m/%d<br/> %H:%M'
...
...
@@ -154,6 +154,7 @@ def graphPair(daily_data, date_format, graph_period, apdex_y_min=None,
'max'
:
100
,
'axisLabel'
:
'apdex (%)'
,
'labelWidth'
:
yLabelWidth
,
'transform'
:
apdex_y_scale
,
},
'lines'
:
{
'show'
:
True
},
'grid'
:
{
...
...
@@ -335,6 +336,7 @@ class GenericSiteStats(object):
graph_coefficient
,
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_scale
=
None
,
):
result
=
[]
append
=
result
.
append
...
...
@@ -528,6 +530,7 @@ class ERP5SiteStats(GenericSiteStats):
def
asHTML
(
self
,
date_format
,
placeholder_delta
,
graph_period
,
graph_coefficient
,
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_scale
=
None
,
):
result
=
[]
append
=
result
.
append
...
...
@@ -595,6 +598,7 @@ class ERP5SiteStats(GenericSiteStats):
apdex_y_min
=
apdex_y_min
,
hit_y_min
=
hit_y_min
,
hit_y_max
=
hit_y_max
,
apdex_y_scale
=
apdex_y_scale
,
))
append
(
'</div></div>'
)
append
(
'</td>'
)
...
...
@@ -632,6 +636,7 @@ class ERP5SiteStats(GenericSiteStats):
stat_filter
=
stat_filter
,
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_scale
=
apdex_y_scale
,
))
return
'
\
n
'
.
join
(
result
)
...
...
@@ -932,6 +937,7 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict,
else
:
out
.
write
(
'<script type="text/javascript" src="%s/%s"></script>'
%
(
js_path
,
script
))
apdex_y_scale
=
apdex_y_scale_dict
[
args
.
apdex_yscale
]
out
.
write
(
'</head><body><h1>Overall</h1>'
)
site_list
=
list
(
enumerate
(
sorted
(
per_site
.
iteritems
(),
key
=
lambda
x
:
site_caption_dict
[
x
[
0
]])))
...
...
@@ -989,12 +995,14 @@ def asHTML(out, encoding, per_site, args, default_site, period_parameter_dict,
apdex_y_min
=
apdex_y_min
,
hit_y_min
=
hit_y_min
,
hit_y_max
=
hit_y_max
,
apdex_y_scale
=
apdex_y_scale
,
)
)
out
.
write
(
data
.
asHTML
(
date_format
,
placeholder_delta
,
graph_period
,
graph_coefficient
,
encoding
,
decimator
,
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_scale
=
apdex_y_scale
,
))
end_stat_time
=
time
.
time
()
if
args
.
stats
:
...
...
@@ -1101,6 +1109,9 @@ def main():
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 '
'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 '
'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) {
}
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
)
{
var
container
=
$
(
container
);
var
previousIndex
=
null
;
var
tooltip
=
container
.
next
(
"
.tooltip
"
);
var
options
=
$
.
parseJSON
(
container
.
attr
(
"
data-options
"
));
updateAxisTransform
(
options
.
xaxis
);
updateAxisTransform
(
options
.
yaxis
);
var
plot
=
$
.
plot
(
container
,
$
.
parseJSON
(
container
.
attr
(
"
data-points
"
)),
$
.
parseJSON
(
container
.
attr
(
"
data-options
"
))
options
);
tooltip
.
detach
();
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