normalizeParts = (part, idx, parts) => {
    if (part === '' && idx + 1 === parts.length) {
      return // if this is the last one, don't iterate
    }
    if (currentTerm.terms.indexOf(part) === -1) {
      if (prev === '*') {
        return
      }
      prev = '*'
      result.push(prev)
    } else {
      prev = part
      result.push(prev)
    }
  }
This normalize method is wicked. The best bet is to read the spec:
https://source.datanerd.us/agents/agent-specs/blob/main/Metric-Name-Rules-PORTED.md

A copy paste of the rules that were followed:
 1. Find the first rule where the prefix key matches the prefix of the
    transaction name. If no matching rules are found, abort.
 2. Strip the prefix from the transaction name.
 3. Split the rest of the transaction name into segments on slashes ('/').
 4. For each segment:
     If the segment appears in the array of strings given under the terms key,
     keep it unchanged. Else, replace it with a placeholder ('*')
 5. Collapse all adjacent placeholder segments into a single '*' segment.
 6. Join together the modified segments with slashes, and re-prepend the prefix.

@param {string} path - The transaction metric path to normalize.
@returns {{ignore: boolean, matched: boolean, value: string}} - The results of normalizing the given path.