Merge "Avoid including bad service names in perf.json"
This commit is contained in:
commit
9ddae9b388
|
@ -111,6 +111,7 @@ def get_http_stats_for_log(logfile):
|
||||||
apache_fields = ('host', 'a', 'b', 'date', 'tz', 'request', 'status',
|
apache_fields = ('host', 'a', 'b', 'date', 'tz', 'request', 'status',
|
||||||
'length', 'c', 'agent')
|
'length', 'c', 'agent')
|
||||||
ignore_agents = ('curl', 'uwsgi', 'nova-status')
|
ignore_agents = ('curl', 'uwsgi', 'nova-status')
|
||||||
|
ignored_services = set()
|
||||||
for line in csv.reader(open(logfile), delimiter=' '):
|
for line in csv.reader(open(logfile), delimiter=' '):
|
||||||
fields = dict(zip(apache_fields, line))
|
fields = dict(zip(apache_fields, line))
|
||||||
if len(fields) != len(apache_fields):
|
if len(fields) != len(apache_fields):
|
||||||
|
@ -146,6 +147,10 @@ def get_http_stats_for_log(logfile):
|
||||||
service = url.strip('/')
|
service = url.strip('/')
|
||||||
rest = ''
|
rest = ''
|
||||||
|
|
||||||
|
if not service.isalpha():
|
||||||
|
ignored_services.add(service)
|
||||||
|
continue
|
||||||
|
|
||||||
method_key = '%s-%s' % (agent, method)
|
method_key = '%s-%s' % (agent, method)
|
||||||
try:
|
try:
|
||||||
length = int(fields['length'])
|
length = int(fields['length'])
|
||||||
|
@ -159,6 +164,10 @@ def get_http_stats_for_log(logfile):
|
||||||
stats[service]['largest'] = max(stats[service]['largest'],
|
stats[service]['largest'] = max(stats[service]['largest'],
|
||||||
length)
|
length)
|
||||||
|
|
||||||
|
if ignored_services:
|
||||||
|
LOG.warning('Ignored services: %s' % ','.join(
|
||||||
|
sorted(ignored_services)))
|
||||||
|
|
||||||
# Flatten this for ES
|
# Flatten this for ES
|
||||||
return [{'service': service, 'log': os.path.basename(logfile),
|
return [{'service': service, 'log': os.path.basename(logfile),
|
||||||
**vals}
|
**vals}
|
||||||
|
|
Loading…
Reference in New Issue