code: def _register_psutil_metrics(self, stats, names_to_metric_types, tags=None):
          
          if tags is None:
              tags = []
          base_metric = 'datadog.agent.collector.{0}.{1}'
          # TODO: May have to call self.normalize(metric_name) to get a compliant name
          for k, v in stats.iteritems():
              metric_type = names_to_metric_types[k]
              if isinstance(v, dict):
                  for _k, _v in v.iteritems():
                      full_metric_name = base_metric.format(k, _k)
                      self._send_single_metric(full_metric_name, _v, metric_type, tags)
              else:
                  full_metric_name = 'datadog.agent.collector.{0}'.format(k)
                  self._send_single_metric(full_metric_name, v, metric_type, tags)
docs: Saves sample metrics from psutil
  
          :param stats: a dictionary that looks like:
          {
           'memory_info': OrderedDict([('rss', 24395776), ('vms', 144666624)]),
           'io_counters': OrderedDict([('read_count', 4536),
                                      ('write_count', 100),
                                      ('read_bytes', 0),
                                      ('write_bytes', 61440)])
           ...
           }
  
           This creates a metric like `datadog.agent.collector.{key_1}.{key_2}` where key_1 is a top-level
           key in `stats`, and key_2 is a nested key.
           E.g. datadog.agent.collector.memory_info.rss