Commit 2a3edb84 authored by Vincent Pelletier's avatar Vincent Pelletier

apachedex: Implement a duration cap.

parent d743c185
...@@ -1309,6 +1309,12 @@ def main(): ...@@ -1309,6 +1309,12 @@ def main():
'but requires pytz module, fixed UTC offsets can be provided in the ' 'but requires pytz module, fixed UTC offsets can be provided in the '
'+hhmm form (ex: -0700 for UTC-7). This form does not require pytz ' '+hhmm form (ex: -0700 for UTC-7). This form does not require pytz '
'module.') 'module.')
parser.add_argument('--duration-cap', type=float,
help='Duration, in seconda, to set as an upper limit to request '
'durations: anything longer than this will be set to this value. '
'Useful when migrating from one configuration/software package to '
'another while keeping results comparable even if the latter has a '
'much larger (and possibly non-configurable) total request timeout.')
group = parser.add_argument_group('generated content (all formats)') group = parser.add_argument_group('generated content (all formats)')
group.add_argument('-a', '--apdex', default=1.0, type=float, group.add_argument('-a', '--apdex', default=1.0, type=float,
...@@ -1384,6 +1390,16 @@ def main(): ...@@ -1384,6 +1390,16 @@ def main():
else: else:
parser.error('Neither %D nor %T are present in logformat, apdex ' parser.error('Neither %D nor %T are present in logformat, apdex '
'cannot be computed.') 'cannot be computed.')
if args.duration_cap:
def getDuration(
match,
_duration_cap=int(args.duration_cap * US_PER_S),
_getDuration=getDuration,
):
duration = _getDuration(match)
if duration > _duration_cap:
return _duration_cap
return duration
if args.match_servername is not None and \ if args.match_servername is not None and \
args.match_servername not in args.logformat: args.match_servername not in args.logformat:
parser.error('--match-servername %s requested, but missing ' parser.error('--match-servername %s requested, but missing '
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment