static final String hostKey()

in zuul-core/src/main/java/com/netflix/zuul/stats/StatsManager.java [101:126]


    static final String hostKey(String host) {
        try {
            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);
        }
        return String.format("host_%s", host);
    }