code: function targetDecode(stat) {
    let host;
    let key;
    let namespace;
  
    const parts = stat.split('.');
  
    if (
      (stat.startsWith('logstash.') || stat.startsWith('kamon.'))
      && parts.length === 3
    ) {
      [namespace, host, key] = parts;
  
      // Modify target based on namespace
      if (namespace === 'logstash') {
        host = host.replace(/_/g, '.');
        key = key.replace(/_/g, '.');
      } else if (namespace === 'kamon') {
        host = host.replace(/_/g, '.');
      }
    } else if (stat.startsWith('statsd.')) {
      host = hostname;
      key = stat;
    } else {
      // Split parts by default separator
      [host, key] = stat.split('_');
    }
  
    if (!host || !key) {
      throw new Error(`failed to decode stat: ${stat}`);
    }
  
    return {
      host,
      key,
    };
  }
docs: Decode {host, key} from a stat.
  @param {string} stat Metric name to decode.
  @returns {Object} Object with {host, key} properties.