summaryrefslogtreecommitdiff
path: root/lib/gitlab/database_importers/self_monitoring/project/create_service.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/database_importers/self_monitoring/project/create_service.rb')
-rw-r--r--lib/gitlab/database_importers/self_monitoring/project/create_service.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/gitlab/database_importers/self_monitoring/project/create_service.rb b/lib/gitlab/database_importers/self_monitoring/project/create_service.rb
index ef2e4055c62..039e85b3f6c 100644
--- a/lib/gitlab/database_importers/self_monitoring/project/create_service.rb
+++ b/lib/gitlab/database_importers/self_monitoring/project/create_service.rb
@@ -74,6 +74,15 @@ module Gitlab
)
if response
+ # In the add_prometheus_manual_configuration method, the Prometheus
+ # listen_address config is saved as an api_url in the PrometheusService
+ # model. There are validates hooks in the PrometheusService model that
+ # check if the project associated with the PrometheusService is the
+ # self_monitoring project. It checks
+ # Gitlab::CurrentSettings.self_monitoring_project_id, which is why the
+ # Gitlab::CurrentSettings cache needs to be expired here, so that
+ # PrometheusService sees the latest self_monitoring_project_id.
+ Gitlab::CurrentSettings.expire_current_application_settings
success(result)
else
log_error("Could not save instance administration project ID, errors: %{errors}" % { errors: application_settings.errors.full_messages })