def collect_metrics(self, instance):
        """
        Calls asynchronously _collect_metrics_async on all MORs, as the
        job queue is processed the Aggregator will receive the metrics.
        """
        i_key = self._instance_key(instance)
        if not self.mor_cache.contains(i_key):
            self.log.debug("Not collecting metrics for instance '{}', nothing to do yet.".format(i_key))
            return

        vm_count = 0
        custom_tags = instance.get('tags', [])
        tags = ["vcenter_server:{}".format(ensure_unicode(instance.get('name')))] + custom_tags

        n_mors = self.mor_cache.instance_size(i_key)
        if not n_mors:
            self.gauge('vsphere.vm.count', vm_count, tags=tags)
            self.log.debug("No Mor objects to process for instance '{}', skip...".format(i_key))
            return

        self.log.debug("Collecting metrics for {} mors".format(ensure_unicode(n_mors)))

        # Request metrics for several objects at once. We can limit the number of objects with batch_size
        # If batch_size is 0, process everything at once
        batch_size = self.batch_morlist_size or n_mors
        for batch in self.mor_cache.mors_batch(i_key, batch_size):
            query_specs = []
            for _, mor in iteritems(batch):
                if mor['mor_type'] == 'vm':
                    vm_count += 1
                if mor['mor_type'] not in REALTIME_RESOURCES and ('metrics' not in mor or not mor['metrics']):
                    continue

                query_spec = vim.PerformanceManager.QuerySpec()
                query_spec.entity = mor["mor"]
                query_spec.intervalId = mor["interval"]
                query_spec.maxSample = 1
                if mor['mor_type'] in REALTIME_RESOURCES:
                    query_spec.metricId = self.metadata_cache.get_metric_ids(i_key)
                else:
                    query_spec.metricId = mor["metrics"]
                query_specs.append(query_spec)

            if query_specs:
                self.pool.apply_async(self._collect_metrics_async, args=(instance, query_specs))

        self.gauge('vsphere.vm.count', vm_count, tags=tags)
Calls asynchronously _collect_metrics_async on all MORs, as the
        job queue is processed the Aggregator will receive the metrics.