docs: private void validateRule() {
      if (type == null) {
        throw new IllegalArgumentException(
          "Missing rule type");
      }
      
      switch (type) {
        case METRIC:
          // nothing to validate
          break;
        case METRIC_CUSTOM:
        case TAGK_CUSTOM:
        case TAGV_CUSTOM:
          if (field == null || field.isEmpty()) {
            throw new IllegalArgumentException(
                "Missing field name required for " + type + " rule");
          }
          if (custom_field == null || custom_field.isEmpty()) {
            throw new IllegalArgumentException(
                "Missing custom field name required for " + type + " rule");
          }
          break;
        case TAGK:
          if (field == null || field.isEmpty()) {
            throw new IllegalArgumentException(
                "Missing field name required for " + type + " rule");
          }
          break;
        default:
          throw new IllegalArgumentException("Invalid rule type");
      }
      
      if ((regex != null || !regex.isEmpty()) && regex_group_idx < 0) {
        throw new IllegalArgumentException(
            "Invalid regex group index. Cannot be less than 0");
      }
    }