func()

in pkg/config/metric_types.go [47:62]


func (mt *MetricTypes) UnmarshalYAML(value *yaml.Node) error {
	if value == nil {
		return nil
	}
	if value.Kind != yaml.SequenceNode {
		return fmt.Errorf("unable to unmarshal metric type: %+v", value)
	}

	for _, t := range value.Content {
		if t.Value != string(CustomMetricType) && t.Value != string(ExternalMetricType) {
			return fmt.Errorf("unknown metric type: %s", t.Value)
		}
		*mt = append(*mt, MetricType(t.Value))
	}
	return nil
}