class MetricImporterUtils {

    public static void resolveExtraTagsFromURI(String baseURIPath, String requestURI,
                                               Map<String, String> map) {
        Preconditions.checkNotNull(baseURIPath);
        Preconditions.checkNotNull(requestURI);
        // /*/metrics/{key1}/{value1}/{key2}/{value2}/...
        String subPath = requestURI.substring(baseURIPath.length());
        // 去掉末尾的/
        if (subPath.endsWith("/")) {
            subPath = subPath.substring(0, subPath.length() - 1);
        }

        String[] ss = StringUtils.split(subPath, '/');
        if (ss.length % 2 != 0) {
            throw new IllegalArgumentException("子路径必须有偶数个节");
        }
        for (int i = 0; i < ss.length; i += 2) {
            map.put(ss[i], ss[i + 1]);
        }
    }

    private  MetricImporterUtils();

}