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
Arnaud Fontaine
apachedex
Commits
80244895
Commit
80244895
authored
Apr 08, 2013
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for (canonical) server name matching.
parent
33679833
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
apachedex/__init__.py
apachedex/__init__.py
+17
-0
No files found.
apachedex/__init__.py
View file @
80244895
...
@@ -630,6 +630,11 @@ class ERP5SiteStats(GenericSiteStats):
...
@@ -630,6 +630,11 @@ class ERP5SiteStats(GenericSiteStats):
DURATION_US_FORMAT
=
'%D'
DURATION_US_FORMAT
=
'%D'
DURATION_S_FORMAT
=
'%T'
DURATION_S_FORMAT
=
'%T'
server_name_group_dict
=
{
'%v'
:
lambda
x
:
x
.
group
(
'servername'
)
+
'/'
,
'%V'
:
lambda
x
:
x
.
group
(
'canonical_servername'
)
+
'/'
,
}
logformat_dict
=
{
logformat_dict
=
{
'%h'
:
r'(?P<host>[^ ]*)'
,
'%h'
:
r'(?P<host>[^ ]*)'
,
'%l'
:
r'(?P<ident>[^ ]*)'
,
'%l'
:
r'(?P<ident>[^ ]*)'
,
...
@@ -643,6 +648,8 @@ logformat_dict = {
...
@@ -643,6 +648,8 @@ logformat_dict = {
DURATION_US_FORMAT
:
r'(?P<duration>[0-9]*)'
,
DURATION_US_FORMAT
:
r'(?P<duration>[0-9]*)'
,
DURATION_S_FORMAT
:
r'(?P<duration_s>[0-9]*)'
,
DURATION_S_FORMAT
:
r'(?P<duration_s>[0-9]*)'
,
'%%'
:
r'%'
,
'%%'
:
r'%'
,
'%v'
:
r'(?P<servername>[^ ]*)'
,
'%V'
:
r'(?P<canonical_servername>[^ ]*)'
,
# TODO: add more formats
# TODO: add more formats
}
}
...
@@ -975,6 +982,8 @@ def main():
...
@@ -975,6 +982,8 @@ def main():
group
.
add_argument
(
'--skip-base'
,
dest
=
'path'
,
nargs
=
'+'
,
group
.
add_argument
(
'--skip-base'
,
dest
=
'path'
,
nargs
=
'+'
,
action
=
AggregateSiteUrl
,
action
=
AggregateSiteUrl
,
help
=
'Absolute base url(s) to ignore.'
)
help
=
'Absolute base url(s) to ignore.'
)
group
.
add_argument
(
'--match-servername'
,
choices
=
server_name_group_dict
,
help
=
'Prefix URL with (canonical) server name.'
)
group
=
parser
.
add_argument_group
(
'filtering'
)
group
=
parser
.
add_argument_group
(
'filtering'
)
group
.
add_argument
(
'--skip-user-agent'
,
nargs
=
'+'
,
default
=
[],
group
.
add_argument
(
'--skip-user-agent'
,
nargs
=
'+'
,
default
=
[],
...
@@ -991,6 +1000,13 @@ def main():
...
@@ -991,6 +1000,13 @@ def main():
print
>>
sys
.
stderr
,
'Neither %D nor %T are present in logformat, apdex '
\
print
>>
sys
.
stderr
,
'Neither %D nor %T are present in logformat, apdex '
\
'cannot be computed.'
'cannot be computed.'
sys
.
exit
(
1
)
sys
.
exit
(
1
)
if
args
.
match_servername
is
not
None
and
\
args
.
match_servername
not
in
args
.
logformat
:
print
>>
sys
.
stderr
,
'--match-servername %s requested, but missing '
\
'from logformat.'
%
args
.
match_servername
sys
.
exit
(
1
)
get_url_prefix
=
server_name_group_dict
.
get
(
args
.
match_servername
,
lambda
_
:
''
)
line_regex
=
''
line_regex
=
''
expensive_line_regex
=
''
expensive_line_regex
=
''
try
:
try
:
...
@@ -1125,6 +1141,7 @@ def main():
...
@@ -1125,6 +1141,7 @@ def main():
url
=
url_match
.
group
(
'url'
)
url
=
url_match
.
group
(
'url'
)
if
url
.
startswith
(
'http'
):
if
url
.
startswith
(
'http'
):
url
=
splithost
(
splittype
(
url
)[
1
])[
1
]
url
=
splithost
(
splittype
(
url
)[
1
])[
1
]
url
=
get_url_prefix
(
match
)
+
url
for
site
,
prefix_match
,
action
in
site_list
:
for
site
,
prefix_match
,
action
in
site_list
:
if
prefix_match
(
url
)
is
not
None
:
if
prefix_match
(
url
)
is
not
None
:
break
break
...
...
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