Skip to content

Commit fe7cfa6

Browse files
committed
Avoid including bad service names in perf.json
Some of the API services are not properly mounted under /$service/ in the apache proxy. This patch tries to avoid recording data for "services" like "v2.0" (in the case of neutron) by only adding names if they're all letters. A single warning is emitted for any services excluded by this check. For the moment this will mean we don't collect data for those services, but when their devstack API config is fixed, they'll start to show up. Change-Id: I41cc300e89a4f97a008a8ba97c91f0980f9b9c3f
1 parent eacaa99 commit fe7cfa6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tools/get-stats.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def get_http_stats_for_log(logfile):
111111
apache_fields = ('host', 'a', 'b', 'date', 'tz', 'request', 'status',
112112
'length', 'c', 'agent')
113113
ignore_agents = ('curl', 'uwsgi', 'nova-status')
114+
ignored_services = set()
114115
for line in csv.reader(open(logfile), delimiter=' '):
115116
fields = dict(zip(apache_fields, line))
116117
if len(fields) != len(apache_fields):
@@ -146,6 +147,10 @@ def get_http_stats_for_log(logfile):
146147
service = url.strip('/')
147148
rest = ''
148149

150+
if not service.isalpha():
151+
ignored_services.add(service)
152+
continue
153+
149154
method_key = '%s-%s' % (agent, method)
150155
try:
151156
length = int(fields['length'])
@@ -159,6 +164,10 @@ def get_http_stats_for_log(logfile):
159164
stats[service]['largest'] = max(stats[service]['largest'],
160165
length)
161166

167+
if ignored_services:
168+
LOG.warning('Ignored services: %s' % ','.join(
169+
sorted(ignored_services)))
170+
162171
# Flatten this for ES
163172
return [{'service': service, 'log': os.path.basename(logfile),
164173
**vals}

0 commit comments

Comments
 (0)