code: func (r *PCPRegistry) AddMetric(m Metric) error {
  	if r.mapped {
  		return errors.New("cannot add a metric when a mapping is active")
  	}
  
  	if r.HasMetric(m.Name()) {
  		return errors.New("metric is already defined for the current registry")
  	}
  
  	pcpm := m.(PCPMetric)
  
  	// if it is an indom metric
  	if pcpm.Indom() != nil && !r.HasInstanceDomain(pcpm.Indom().Name()) {
  		err := r.AddInstanceDomain(pcpm.Indom())
  		if err != nil {
  			return err
  		}
  	}
  
  	r.metricslock.Lock()
  	defer r.metricslock.Unlock()
  
  	r.addMetric(pcpm)
  	return nil
  }
docs: // AddMetric will add a new metric to the current registry