docs: @Nonnull
      public static List<Map.Entry<String, String>> parseMetricName(@Nonnull String metricName) {
          if (metricName.charAt(0) != '[' || metricName.charAt(metricName.length() - 1) != ']') {
              throw new IllegalArgumentException("key not enclosed in []: " + metricName);
          }
  
          StringBuilder sb = new StringBuilder();
          List<Map.Entry<String, String>> result = new ArrayList<Map.Entry<String, String>>();
          int l = metricName.length() - 1;
          String tag = null;
          boolean inTag = true;
          for (int i = 1; i < l; i++) {
              char ch = metricName.charAt(i);
              switch (ch) {
                  case '=':
                      tag = handleEqualsSign(metricName, sb, inTag);
                      inTag = false;
                      continue;
  
                  case ',':
                      handleComma(metricName, sb, result, tag, inTag);
                      inTag = true;
                      tag = null;
                      continue;
  
                  default:
                      if (ch == '\\') {
                          // the next character will be treated literally
                          ch = metricName.charAt(++i);
                      }
                      if (i == l) {
                          throw new IllegalArgumentException("backslash at the end: " + metricName);
                      }
                      sb.append(ch);
              }
          }
          // final entry
          if (tag != null) {
              result.add(new SimpleImmutableEntry<String, String>(tag, sb.toString()));
          } else if (sb.length() > 0) {
              throw new IllegalArgumentException("unfinished tag at the end: " + metricName);
          }
          return result;
      }