function mapInstanceDomains (name) {
  let tagName = name || 'instance'
  return function _mapInstanceDomains (metricInstances, { instanceDomainMappings }) {
    return metricInstances.map(mi => ({
      ...mi,
      [tagName]: (instanceDomainMappings[mi.metric] && instanceDomainMappings[mi.metric][mi.instance]) || mi.instance
    }))
  }
}
Maps PCP instance domains to metric instances
Used to map pcp instance ids (such as 0, 1, 2, ...) to strings such as ('xvda', 'xvdb', etc)

@param {string} the instance name to map as, 'instance' if not provided
@return {function} a transform function