def _make_metric_list_to_collect(self, instance, custom_metrics):
        """
        Store the list of metrics to collect by instance_key.
        Will also create and cache cursors to query the db.
        """
        metrics_to_collect = []
        for name, counter_name, instance_name in self.METRICS:
            try:
                sql_type, base_name = self.get_sql_type(instance, counter_name)
                cfg = {}
                cfg['name'] = name
                cfg['counter_name'] = counter_name
                cfg['instance_name'] = instance_name

                metrics_to_collect.append(
                    self.typed_metric(instance, cfg, DEFAULT_PERFORMANCE_TABLE, base_name, None, sql_type, None)
                )
            except SQLConnectionError:
                raise
            except Exception:
                self.log.warning("Can't load the metric {}, ignoring".format(name), exc_info=True)
                continue

        # Load any custom metrics from conf.d/sqlserver.yaml
        for row in custom_metrics:
            db_table = row.get('table', DEFAULT_PERFORMANCE_TABLE)
            if db_table not in self.valid_tables:
                self.log.error('{} has an invalid table name: {}'.format(row['name'], db_table))
                continue

            if db_table == DEFAULT_PERFORMANCE_TABLE:
                user_type = row.get('type')
                if user_type is not None and user_type not in VALID_METRIC_TYPES:
                    self.log.error('{} has an invalid metric type: {}'.format(row['name'], user_type))
                sql_type = None
                try:
                    if user_type is None:
                        sql_type, base_name = self.get_sql_type(instance, row['counter_name'])
                except Exception:
                    self.log.warning("Can't load the metric {}, ignoring".format(row['name']), exc_info=True)
                    continue

                metrics_to_collect.append(
                    self.typed_metric(instance, row, db_table, base_name, user_type, sql_type, None)
                )

            else:
                for column in row['columns']:
                    metrics_to_collect.append(
                        self.typed_metric(instance, row, db_table, base_name, None, sql_type, column)
                    )

        instance_key = self._conn_key(instance, self.DEFAULT_DB_KEY)
        self.instances_metrics[instance_key] = metrics_to_collect
        simple_metrics = []
        fraction_metrics = []
        wait_stat_metrics = []
        vfs_metrics = []
        clerk_metrics = []
        self.log.debug("metrics to collect {}".format(str(metrics_to_collect)))
        for m in metrics_to_collect:
            if type(m) is SqlSimpleMetric:
                self.log.debug("Adding simple metric %s", m.sql_name)
                simple_metrics.append(m.sql_name)
            elif type(m) is SqlFractionMetric or type(m) is SqlIncrFractionMetric:
                self.log.debug("Adding fraction metric %s", m.sql_name)
                fraction_metrics.append(m.sql_name)
                fraction_metrics.append(m.base_name)
            elif type(m) is SqlOsWaitStat:
                self.log.debug("Adding SqlOsWaitStat metric {}".format(m.sql_name))
                wait_stat_metrics.append(m.sql_name)
            elif type(m) is SqlIoVirtualFileStat:
                self.log.debug("Adding SqlIoVirtualFileStat metric {}".format(m.sql_name))
                vfs_metrics.append(m.sql_name)
            elif type(m) is SqlOsMemoryClerksStat:
                self.log.debug("Adding SqlOsMemoryClerksStat metric {}".format(m.sql_name))
                clerk_metrics.append(m.sql_name)

        self.instances_per_type_metrics[instance_key]["SqlSimpleMetric"] = simple_metrics
        self.instances_per_type_metrics[instance_key]["SqlFractionMetric"] = fraction_metrics
        self.instances_per_type_metrics[instance_key]["SqlOsWaitStat"] = wait_stat_metrics
        self.instances_per_type_metrics[instance_key]["SqlIoVirtualFileStat"] = vfs_metrics
        self.instances_per_type_metrics[instance_key]["SqlOsMemoryClerksStat"] = clerk_metrics