]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
Merge pull request #25371 from trociny/wip-osd-query-subkey-types
authorJason Dillaman <dillaman@redhat.com>
Wed, 5 Dec 2018 18:24:23 +0000 (13:24 -0500)
committerGitHub <noreply@github.com>
Wed, 5 Dec 2018 18:24:23 +0000 (13:24 -0500)
 osd: support more dynamic perf query subkey types

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
1  2 
src/mgr/BaseMgrModule.cc
src/mgr/OSDPerfMetricTypes.cc
src/mgr/OSDPerfMetricTypes.h
src/osd/DynamicPerfStats.h
src/pybind/mgr/mgr_module.py
src/pybind/mgr/osd_perf_query/module.py

index 8f209a8f30e30561180bf619775696a6621d695a,fd5f2f53ecf20fe776a8c0b0279828867db786d6..7a86298c45ec58933721d2c0936d822cc8c75b4b
@@@ -683,24 -681,23 +683,29 @@@ ceph_add_osd_perf_query(BaseMgrModule *
    static const std::string NAME_KEY_DESCRIPTOR = "key_descriptor";
    static const std::string NAME_COUNTERS_DESCRIPTORS =
        "performance_counter_descriptors";
 +  static const std::string NAME_LIMIT = "limit";
    static const std::string NAME_SUB_KEY_TYPE = "type";
    static const std::string NAME_SUB_KEY_REGEX = "regex";
 +  static const std::string NAME_LIMIT_ORDER_BY = "order_by";
 +  static const std::string NAME_LIMIT_MAX_COUNT = "max_count";
    static const std::map<std::string, OSDPerfMetricSubKeyType> sub_key_types = {
      {"client_id", OSDPerfMetricSubKeyType::CLIENT_ID},
+     {"client_address", OSDPerfMetricSubKeyType::CLIENT_ADDRESS},
      {"pool_id", OSDPerfMetricSubKeyType::POOL_ID},
+     {"namespace", OSDPerfMetricSubKeyType::NAMESPACE},
+     {"osd_id", OSDPerfMetricSubKeyType::OSD_ID},
+     {"pg_id", OSDPerfMetricSubKeyType::PG_ID},
      {"object_name", OSDPerfMetricSubKeyType::OBJECT_NAME},
+     {"snap_id", OSDPerfMetricSubKeyType::SNAP_ID},
    };
    static const std::map<std::string, PerformanceCounterType> counter_types = {
 +    {"ops", PerformanceCounterType::OPS},
      {"write_ops", PerformanceCounterType::WRITE_OPS},
      {"read_ops", PerformanceCounterType::READ_OPS},
 +    {"bytes", PerformanceCounterType::BYTES},
      {"write_bytes", PerformanceCounterType::WRITE_BYTES},
      {"read_bytes", PerformanceCounterType::READ_BYTES},
 +    {"latency", PerformanceCounterType::LATENCY},
      {"write_latency", PerformanceCounterType::WRITE_LATENCY},
      {"read_latency", PerformanceCounterType::READ_LATENCY},
    };
Simple merge
Simple merge
Simple merge
index f66ba6183469516b5236408fc543f4994e6443b3,c170e7ba0851183c9c224dc69cfeee4baab29240..040833a6064f0fe304ab4b70a78a3b94b734f8f4
@@@ -967,13 -967,14 +967,15 @@@ class MgrModule(ceph_module.BaseMgrModu
               'performance_counter_descriptors': [
                 list, of, descriptor, types
               ],
 +             'limit': {'order_by': performance_counter_type, 'max_count': n},
             }
  
-         Valid subkey types: 'client_id', 'pool_id', 'object_name'
+         Valid subkey types:
+            'client_id', 'client_address', 'pool_id', 'namespace', 'osd_id',
+            'pg_id', 'object_name', 'snap_id'
          Valid performance counter types:
 -           'write_ops', 'read_ops', 'write_bytes', 'read_bytes',
 -           'write_latency', 'read_latency'
 +           'ops', 'write_ops', 'read_ops', 'bytes', 'write_bytes', 'read_bytes',
 +           'latency', 'write_latency', 'read_latency'
  
          :param object query: query
          :rtype: int (query id)
index 4e293b4e1a32952e045dccb2b68c916a9ac78a57,44f8e1192dd353fd34dd11091a4a7b767a1b8b8d..12660139dacd6c0488f793dd2d31dae34622ffb9
@@@ -58,12 -58,27 +59,28 @@@ class OSDPerfQuery(MgrModule)
              {'type': 'object_name', 'regex': '^rbd_data\.([^.]+)\.'},
          ],
          'performance_counter_descriptors': [
 -            'write_ops', 'read_ops', 'write_bytes', 'read_bytes',
 +            'bytes', 'write_ops', 'read_ops', 'write_bytes', 'read_bytes',
              'write_latency', 'read_latency',
          ],
 +        'limit': {'order_by': 'bytes', 'max_count': 10},
      }
  
+     ALL_SUBKEYS_QUERY = {
+         'key_descriptor': [
+             {'type': 'client_id', 'regex': '^.*$'},
+             {'type': 'client_address', 'regex': '^.*$'},
+             {'type': 'pool_id', 'regex': '^.*$'},
+             {'type': 'namespace', 'regex': '^.*$'},
+             {'type': 'osd_id', 'regex': '^.*$'},
+             {'type': 'pg_id', 'regex': '^.*$'},
+             {'type': 'object_name', 'regex': '^.*$'},
+             {'type': 'snap_id', 'regex': '^.*$'},
+         ],
+         'performance_counter_descriptors': [
+             'write_ops', 'read_ops',
+         ],
+     }
      queries = {}
  
      def handle_command(self, inbuf, cmd):
              if query == self.RBD_IMAGE_ID_QUERY:
                  column_names = ["pool_id", "rbd image_id"]
              else:
-                 column_names = ["client_id"]
+                 column_names = [sk['type'] for sk in query['key_descriptor']]
              for d in descriptors:
                  desc = d
 -                if d in ['write_bytes', 'read_bytes']:
 +                if d in ['bytes']:
 +                    continue
 +                elif d in ['write_bytes', 'read_bytes']:
                      desc += '/sec'
                  elif d in ['write_latency', 'read_latency']:
                      desc += '(msec)'
                  if query == self.RBD_IMAGE_ID_QUERY:
                      row = [c['k'][0][0], c['k'][1][1]]
                  else:
-                     row = [c['k'][0][0]]
+                     row = [sk[0] for sk in c['k']]
                  counters = c['c']
                  for i in range(len(descriptors)):
 -                    if descriptors[i] in ['write_bytes', 'read_bytes']:
 +                    if descriptors[i] in ['bytes']:
 +                        continue
 +                    elif descriptors[i] in ['write_bytes', 'read_bytes']:
                          bps = counters[i][0] / (now - last_update)
                          row.append(get_human_readable(bps))
                      elif descriptors[i] in ['write_latency', 'read_latency']: