You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: alert.go
    path of file: ./repos/clickvisual/api/internal/api/apiv2/alert
    
    the code of the file until where you have to start completion: package alert

import (
	"strconv"
	"strings"

	"github.com/ego-component/egorm"
	"github.com/pkg/errors"
	"github.com/spf13/cast"
	"gopkg.in/yaml.v3"

	"gi
    
func SettingList(c *core.Context) {
	res := make([]*db2.RespAlertSettingListItem, 0)
	instanceList, err := db2.InstanceList(egorm.Conds{})
	if err != nil {
		c.JSONE(core.CodeErr, err.Error(), nil)
		return
	}
	checkHistory := make(map[string]db2.RespAlertSettingListItem)
	for _, instance := range instanceList {
		if !service.InstanceViewIsPermission(c.Uid(), instance.ID) {
			continue
		}
		row := db2.RespAlertSettingListItem{
			InstanceId:         instance.ID,
			InstanceName:       instance.Name,
			RuleStoreType:      instance.RuleStoreType,
			PrometheusTarget:   instance.PrometheusTarget,
			IsAlertManagerOK:   1,
			IsPrometheusOK:     1,
			IsMetricsSamplesOk: 1,
		}
		if tmp, ok := checkHistory[instance.PrometheusTarget]; ok {
			row.IsPrometheusOK = tmp.IsPrometheusOK
			row.CheckPrometheusResult = tmp.CheckPrometheusResult
			row.IsAlertManagerOK = tmp.IsAlertManagerOK
			row.CheckAlertManagerResult = tmp.CheckAlertManagerResult
		} else {
			errAlertManager, errProm := func() (error, error) {
				p, errProm := alertcomponent.NewPrometheus(instance.PrometheusTarget, instance.RuleStoreType)
				if errProm != nil {
					return errProm, errProm
				}
				return p.CheckDependents(), p.Health()
			}()
			if errProm != nil {
				row.IsPrometheusOK = 0
				row.CheckPrometheusResult = errProm.Error()
				if errors.Is(errProm, alertcomponent.ErrCheckNotSupported) {
					row.IsPrometheusOK = 3
				}
			}
			if errAlertManager != nil {
				row.IsAlertManagerOK = 0
				row.CheckAlertManagerResult = errAlertManager.Error()
				if errors.Is(errAlertManager, alertcomponent.ErrCheckNotSupported) {
					row.IsAlertManagerOK = 3
				}
			}
			checkHistory[instance.PrometheusTarget] = row
		}
		// prometheus
		if errMetrics := func() error {
			op, errCh := service.InstanceManager.Load(instance.ID)
			if errCh != nil {
				return err
			}
			return op.GetMetricsSamples()
		}(); errMetrics != nil {
			row.IsMetricsSamplesOk = 0
			row.CheckMetricsSamplesResult = errMetrics.Error()
		}
		// check metrics samples
		res = append(res, &row)
	}
	c.JSONOK(res)
}