code: func newpcpInstanceMetric(vals Instances, indom *PCPInstanceDomain, desc *pcpMetricDesc) (*pcpInstanceMetric, error) {
  	if len(vals) != indom.InstanceCount() {
  		return nil, errors.New("values for all instances in the instance domain only should be passed")
  	}
  
  	mvals := make(map[string]*instanceValue)
  
  	for name := range indom.instances {
  		val, present := vals[name]
  		if !present {
  			return nil, errors.Errorf("Instance %v not initialized", name)
  		}
  
  		if !desc.t.IsCompatible(val) {
  			return nil, errors.Errorf("value %v is incompatible with type %v for Instance %v", val, desc.t, name)
  		}
  
  		val = desc.t.resolve(val)
  		mvals[name] = newinstanceValue(val)
  	}
  
  	return &pcpInstanceMetric{desc, indom, mvals}, nil
  }
docs: // newpcpInstanceMetric creates a new instance of PCPSingletonMetric.