From: Sage Weil Date: Tue, 14 Mar 2017 20:12:37 +0000 (-0400) Subject: ceph: daemonperf: order metrics to match asok json dump X-Git-Tag: v12.0.2~310^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5a8686ae95e96efd9364f075680cb5549c33e750;p=ceph.git ceph: daemonperf: order metrics to match asok json dump The daemons report this in a particular order; match that in the daemonperf output. This corresponds to the numeric value of the l_* enum. Signed-off-by: Sage Weil --- diff --git a/src/pybind/ceph_daemon.py b/src/pybind/ceph_daemon.py index ec81d0cbb4a9..c3293d66f579 100755 --- a/src/pybind/ceph_daemon.py +++ b/src/pybind/ceph_daemon.py @@ -15,7 +15,7 @@ import json import socket import struct import time -from collections import defaultdict +from collections import defaultdict, OrderedDict from ceph_argparse import parse_json_funcsigs, validate_command @@ -238,14 +238,18 @@ class DaemonWatcher(object): Populate our instance-local copy of the daemon's performance counter schema, and work out which stats we will display. """ - self._schema = json.loads(admin_socket(self.asok_path, ["perf", "schema"]).decode('utf-8')) + self._schema = json.loads( + admin_socket(self.asok_path, ["perf", "schema"]).decode('utf-8'), + object_pairs_hook=OrderedDict) # Build list of which stats we will display, based on which # stats have a nickname - self._stats = defaultdict(dict) + self._stats = OrderedDict() for section_name, section_stats in self._schema.items(): for name, schema_data in section_stats.items(): if schema_data.get('nick'): + if section_name not in self._stats: + self._stats[section_name] = OrderedDict() self._stats[section_name][name] = schema_data['nick'] def run(self, interval, count=None, ostr=sys.stdout):