code: func (m *UnpartitionedMemoryIdx) indexTags(def *schema.MetricDefinition) {
  	tags, ok := m.tags[def.OrgId]
  	if !ok {
  		tags = make(TagIndex)
  		m.tags[def.OrgId] = tags
  	}
  
  	for _, tag := range def.Tags {
  		tagSplits := strings.SplitN(tag, "=", 2)
  		if len(tagSplits) < 2 {
  			// should never happen because every tag in the index
  			// must have a valid format
  			invalidTag.Inc()
  			log.Errorf("memory-idx: Tag %q of id %q has an invalid format", tag, def.Id)
  			continue
  		}
  
  		tagName := tagSplits[0]
  		tagValue := tagSplits[1]
  		tags.addTagId(tagName, tagValue, def.Id)
  	}
  	tags.addTagId("name", def.Name, def.Id)
  
  	m.defByTagSet.add(def)
  }
docs: // indexTags reads the tags of a given metric definition and creates the
  // corresponding tag index entries to refer to it. It assumes a lock is
  // already held.