diff options
author | Vratko Polak <vrpolak@cisco.com> | 2021-05-12 10:56:45 +0200 |
---|---|---|
committer | Vratko Polak <vrpolak@cisco.com> | 2021-05-12 10:56:45 +0200 |
commit | bd5eec0c49d4db896eab08ab3feb467f5d14ccc8 (patch) | |
tree | a6ecfa993afe1a422b8646448a1a42e8864aefd1 /resources/tools | |
parent | 78a8427cc50c137e5d59ad3448ae128fdda369b2 (diff) |
PAPI stats: Use single dump
There is only one call site (VppCounters.vpp_show_runtime)
which uses a single path ("^/sys/node"),
so we do not need to split the replies anymore.
This simplifies investigating bugs related to VPP stats.
Change-Id: Idfc029c795cd78cf6d41c2f461f7844aed53410d
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/tools')
-rwxr-xr-x | resources/tools/papi/vpp_papi_provider.py | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/resources/tools/papi/vpp_papi_provider.py b/resources/tools/papi/vpp_papi_provider.py index c9a43447f9..ff52de501b 100755 --- a/resources/tools/papi/vpp_papi_provider.py +++ b/resources/tools/papi/vpp_papi_provider.py @@ -209,6 +209,8 @@ def process_json_request(args): def process_stats(args): """Process the VPP Stats. + The reply contains single item covering all paths. + :param args: Command line arguments passed to VPP PAPI Provider. :type args: ArgumentParser :returns: JSON formatted string. @@ -221,19 +223,9 @@ def process_stats(args): except Exception as err: raise RuntimeError(f"PAPI init failed:\n{err!r}") - json_data = json.loads(args.data) - - reply = list() - - for path in json_data: - # The ls method can match multiple patterns, - # but we feed it one path at a time anyway, because the caller - # expect results in a list, one item per path. - # Most VPP versions understand a string is a single pattern, - # but some blindly iterate (as if it was a list of chars). - directory = stats.ls([path]) - data = stats.dump(directory) - reply.append(data) + paths = json.loads(args.data) + directory = stats.ls(paths) + reply = [stats.dump(directory)] try: return json.dumps(reply) |