docs: public static String parseWithMetricAndFilters(final String metric, 
        final List<TagVFilter> filters) {
      if (metric == null || metric.isEmpty()) {
        throw new IllegalArgumentException("Metric cannot be null or empty");
      }
      if (filters == null) {
        throw new IllegalArgumentException("Filters cannot be null");
      }
      final int curly = metric.indexOf('{');
      if (curly < 0) {
        return metric;
      }
      final int len = metric.length();
      if (metric.charAt(len - 1) != '}') {  // "foo{"
        throw new IllegalArgumentException("Missing '}' at the end of: " + metric);
      } else if (curly == len - 2) {  // "foo{}"
        return metric.substring(0, len - 2);
      }
      final int close = metric.indexOf('}');
      final HashMap<String, String> filter_map = new HashMap<String, String>();
      if (close != metric.length() - 1) { // "foo{...}{tagk=filter}" 
        final int filter_bracket = metric.lastIndexOf('{');
        for (final String filter : splitString(metric.substring(filter_bracket + 1, 
            metric.length() - 1), ',')) {
          if (filter.isEmpty()) {
            break;
          }
          filter_map.clear();
          try {
            parse(filter_map, filter);
            TagVFilter.mapToFilters(filter_map, filters, false);
          } catch (IllegalArgumentException e) {
            throw new IllegalArgumentException("When parsing filter '" + filter
                + "': " + e.getMessage(), e);
          }
        }
      }
      
      // substring the tags out of "foo{a=b,...,x=y}" and parse them.
      for (final String tag : splitString(metric.substring(curly + 1, close), ',')) {
        try {
          if (tag.isEmpty() && close != metric.length() - 1){
            break;
          }
          filter_map.clear();
          parse(filter_map, tag);
          TagVFilter.tagsToFilters(filter_map, filters);
        } catch (IllegalArgumentException e) {
          throw new IllegalArgumentException("When parsing tag '" + tag
                                             + "': " + e.getMessage(), e);
        }
      }
      // Return the "foo" part of "foo{a=b,...,x=y}"
      return metric.substring(0, curly);
    }