function customTitleAndKeylabel (titleFn) {
  return function _customTitleAndKeylabel (metricInstances) {
    return metricInstances.map(mi => {
      const newTitleAndKeylabel = titleFn(mi.metric, mi.instance)
      return {
        ...mi,
        title: newTitleAndKeylabel,
        keylabel: newTitleAndKeylabel,
      }
    })
  }
}
Adds a custom title and keylabel to the metric instances, where the title and keylabel is generated by a
user specified function

@param {function} titleFn the fn that will be called to map the metric and instance names to a title
@return {function} a transform function