From fe7cfa6b8c7573d643d66d3684de03e4183651bb Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 23 Jun 2022 09:25:22 -0700 Subject: [PATCH] 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 --- tools/get-stats.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/get-stats.py b/tools/get-stats.py index a3ed7f2625..b958af61b2 100755 --- a/tools/get-stats.py +++ b/tools/get-stats.py @@ -111,6 +111,7 @@ def get_http_stats_for_log(logfile): apache_fields = ('host', 'a', 'b', 'date', 'tz', 'request', 'status', 'length', 'c', 'agent') ignore_agents = ('curl', 'uwsgi', 'nova-status') + ignored_services = set() for line in csv.reader(open(logfile), delimiter=' '): fields = dict(zip(apache_fields, line)) if len(fields) != len(apache_fields): @@ -146,6 +147,10 @@ def get_http_stats_for_log(logfile): service = url.strip('/') rest = '' + if not service.isalpha(): + ignored_services.add(service) + continue + method_key = '%s-%s' % (agent, method) try: length = int(fields['length']) @@ -159,6 +164,10 @@ def get_http_stats_for_log(logfile): stats[service]['largest'] = max(stats[service]['largest'], length) + if ignored_services: + LOG.warning('Ignored services: %s' % ','.join( + sorted(ignored_services))) + # Flatten this for ES return [{'service': service, 'log': os.path.basename(logfile), **vals}