@VisibleForTesting
    static final String hostKey(String host) {
        try {
            final Matcher m = HOST_PATTERN.matcher(host);

            // I know which type of host matched by the number of the group that is non-null
            // I use a different replacement string per host type to make the Epic stats more clear
            if (m.matches()) {
                if (m.group(1) != null) {
                    host = host.replace(m.group(1), "EC2");
                } else if (m.group(2) != null) {
                    host = host.replace(m.group(2), "IP");
                } else if (m.group(3) != null) {
                    host = host.replace(m.group(3), "IP");
                } else if (m.group(4) != null) {
                    host = host.replace(m.group(4), "CDN");
                } else if (m.group(5) != null) {
                    host = host.replace(m.group(5), "CDN");
                } else if (m.group(6) != null) {
                    host = host.replace(m.group(6), "CDN");
                }
            }
        } catch (Exception e) {
            LOG.error(e.getMessage(), e);
        } finally {
            return String.format("host_%s", host);
        }
    }
@Test
    void createsNormalizedHostKey() {
        assertEquals("host_EC2.amazonaws.com", StatsManager.hostKey("ec2-174-129-179-89.compute-1.amazonaws.com"));
        assertEquals("host_IP", StatsManager.hostKey("12.345.6.789"));
        assertEquals("host_IP", StatsManager.hostKey("ip-10-86-83-168"));
        assertEquals("host_CDN.nflxvideo.net", StatsManager.hostKey("002.ie.llnw.nflxvideo.net"));
        assertEquals("host_CDN.llnwd.net", StatsManager.hostKey("netflix-635.vo.llnwd.net"));
        assertEquals("host_CDN.nflximg.com", StatsManager.hostKey("cdn-0.nflximg.com"));
    }