]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph: daemonperf: order metrics to match asok json dump
authorSage Weil <sage@redhat.com>
Tue, 14 Mar 2017 20:12:37 +0000 (16:12 -0400)
committerSage Weil <sage@redhat.com>
Tue, 21 Mar 2017 20:06:44 +0000 (15:06 -0500)
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 <sage@redhat.com>
src/pybind/ceph_daemon.py

index ec81d0cbb4a9780227061ba502e9fcb4f0edfd67..c3293d66f579b2bb10e0a5e40ec82ebdbe1d4a0b 100755 (executable)
@@ -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):