db migration error include_optional_metrics_in_service_ping 16.10

Summary

upgrading gitlab-ee docker container from 16.9.2-ee.0 to 16.10.0-ee.0 leads to a db migration error

Steps to reproduce

  1. enable usage statistics image
  2. start gitlab docker container with new version 16.10.0-ee.0
  3. view docker log and see the log entries further down

Example Project

N/A

What is the current bug behavior?

the upgrade cannot be completed, I went back to 16.9.2-ee.0 for now

What is the expected correct behavior?

upgrade to 16.10.0-ee.0 can be completed

Relevant logs and/or screenshots

gitlab[1172245]: Recipe: gitlab::database_migrations
gitlab[1172245]:   * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
gitlab[1172245]:   * rails_migration[gitlab-rails] action run[2024-03-22T12:27:22+00:00] WARN: gitlab-rails does not have a log_group or default logdir mode defined. Setting to 0700.
gitlab[1172245]:
gitlab[1172245]:     * bash_hide_env[migrate gitlab-rails database] action run
gitlab[1172245]:       [execute] rake aborted!
gitlab[1172245]:                 NameError: undefined local variable or method `include_optional_metrics_in_service_ping' for #<ApplicationSetting id: 1,....

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:
Proxy:          no
Current User:   git
Using RVM:      no
Ruby Version:   3.1.4p223
Gem Version:    3.5.5
Bundler Version:2.5.5
Rake Version:   13.0.6
Redis Version:  7.0.15
Sidekiq Version:7.1.6
Go Version:     unknown

GitLab information
Version:        16.9.1-ee
Revision:       cc62007c12d
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     PostgreSQL
DB Version:     13.13
URL:            https://dev.HOST.net
HTTP Clone URL: https://dev.HOST.net/some-group/some-project.git
SSH Clone URL:  ssh://git@dev.HOST.net:2222/some-group/some-project.git
Elasticsearch:  no
Geo:            no
Using LDAP:     yes
Using Omniauth: yes
Omniauth Providers: github

GitLab Shell
Version:        14.33.0
Repository storages:
- default:      unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:              /opt/gitlab/embedded/service/gitlab-shell

Gitaly
- default Address:      unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version:      16.9.1
- default Git Version:  2.43.0

Results of GitLab application Check

Expand for output related to the GitLab application check
Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 14.33.0 ? ... OK (14.33.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Checking Reply by email ...

IMAP server credentials are correct? ... Checking dev@HOST.net yes Mailroom enabled? ... skipped MailRoom running? ... skipped

Checking Reply by email ... Finished

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... Server: ldapmain not verifying SSL hostname of LDAPS server 'account.HOST.net:389' LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) User output sanitized. Found 8 users of 100 limit.

Checking LDAP ... Finished

Checking GitLab App ...

Database config exists? ... yes Tables are truncated? ... skipped All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Cable config exists? ... yes Resque config exists? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet) Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units) Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units) Projects have namespace: ... 1/1 ... yes 1/3 ... yes 1/4 ... yes 1/5 ... yes 5/9 ... yes 5/10 ... yes 5/11 ... yes 2/14 ... yes 11/15 ... yes 2/16 ... yes 8/23 ... yes 14/24 ... yes 8/25 ... yes 2/26 ... yes 2/27 ... yes 2/29 ... yes 2/30 ... yes 2/31 ... yes 2/32 ... yes 2/33 ... yes 8/34 ... yes 161/35 ... yes 8/36 ... yes 8/37 ... yes 8/38 ... yes 8/39 ... yes 8/40 ... yes 8/41 ... yes 8/42 ... yes 8/43 ... yes 8/44 ... yes 8/45 ... yes 1/46 ... yes 8/49 ... yes 8/50 ... yes 8/51 ... yes 8/52 ... yes 8/53 ... yes 8/54 ... yes 8/55 ... yes 10/57 ... yes 2/58 ... yes 2/59 ... yes 2/60 ... yes 2/61 ... yes 2/62 ... yes 2/64 ... yes 2/65 ... yes 2/66 ... yes 2/68 ... yes 8/69 ... yes 8/71 ... yes 2/72 ... yes 3/79 ... yes 3/80 ... yes 3/81 ... yes 3/82 ... yes 8/86 ... yes 8/87 ... yes 2/88 ... yes 15/90 ... yes 3/91 ... yes 2/92 ... yes 2/93 ... yes 5/95 ... yes 2/96 ... yes 16/97 ... yes 16/99 ... yes 16/100 ... yes 16/101 ... yes 5/102 ... yes 16/103 ... yes 8/104 ... yes 2/106 ... yes 3/107 ... yes 8/109 ... yes 2/110 ... yes 5/111 ... yes 2/112 ... yes 8/113 ... yes 8/114 ... yes 2/115 ... yes 8/116 ... yes 8/117 ... yes 8/118 ... yes 5/119 ... yes 2/120 ... yes 8/121 ... yes 8/124 ... yes 5/125 ... yes 18/127 ... yes 18/128 ... yes 8/129 ... yes 162/130 ... yes 18/131 ... yes 8/132 ... yes 14/133 ... yes 5/135 ... yes 161/136 ... yes 161/138 ... yes 5/139 ... yes 2/140 ... yes 8/142 ... yes 18/143 ... yes 2/144 ... yes 161/145 ... yes 2/146 ... yes 2/147 ... yes 8/148 ... yes 8/149 ... yes 2/150 ... yes 1/151 ... yes 8/155 ... yes 14/156 ... yes 8/158 ... yes 5/159 ... yes 2/160 ... yes 162/161 ... yes 8/162 ... yes 2/163 ... yes 5/165 ... yes 2/166 ... yes 2/167 ... yes 8/169 ... yes 2/170 ... yes 18/173 ... yes 2/174 ... yes 8/175 ... yes 8/176 ... yes 8/177 ... yes 2/178 ... yes 2/179 ... yes 2/180 ... yes 2/181 ... yes 2/182 ... yes 5/183 ... yes 2/184 ... yes 2/185 ... yes 2/187 ... yes 8/188 ... yes 8/189 ... yes 14/190 ... yes 8/191 ... yes 2/192 ... yes 18/193 ... yes 2/194 ... yes 2/195 ... yes 2/196 ... yes 5/197 ... yes 2/198 ... yes 2/199 ... yes 2/200 ... yes 8/201 ... yes 5/202 ... yes 14/203 ... yes 2/204 ... yes 5/205 ... yes 5/206 ... yes 2/208 ... yes 5/209 ... yes 2/214 ... yes 2/215 ... yes 8/216 ... yes 2/217 ... yes 8/219 ... yes 8/220 ... yes 2/221 ... yes 8/222 ... yes 5/223 ... yes 2/225 ... yes 8/226 ... yes 2/227 ... yes 2/228 ... yes 8/229 ... yes 8/230 ... yes 8/231 ... yes 5/232 ... yes 14/233 ... yes 8/234 ... yes 2/235 ... yes 255/236 ... yes 3/237 ... yes 2/238 ... yes 8/239 ... yes 8/240 ... yes 8/242 ... yes 8/243 ... yes 2/244 ... yes 8/245 ... yes 8/246 ... yes 8/247 ... yes 2/248 ... yes 10/249 ... yes 8/250 ... yes 2/251 ... yes 5/252 ... yes 10/253 ... yes 15/254 ... yes 14/255 ... yes 5/256 ... yes 8/257 ... yes 8/258 ... yes 8/261 ... yes 8/262 ... yes 8/263 ... yes 8/264 ... yes 8/265 ... yes 8/266 ... yes 8/267 ... yes 8/268 ... yes 8/269 ... yes 8/270 ... yes 8/271 ... yes 8/272 ... yes 14/273 ... yes 305/274 ... yes 305/275 ... yes 305/276 ... yes Redis version >= 6.2.14? ... yes Ruby version >= 3.0.6 ? ... yes (3.1.4) Git user has default SSH configuration? ... yes Active users: ... 10 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 7.x-8.x or OpenSearch version 1.x ... skipped (Advanced Search is disabled) All migrations must be finished before doing a major upgrade ... skipped (Advanced Search is disabled)

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes

workaround:

  1. uncheck Enable Service Ping
  2. update to 16.10

After fixing

see related issue !141540 (merged)

Edited by Niko Belokolodov