diff options
Diffstat (limited to 'lib/gitlab/database_importers/self_monitoring/project')
-rw-r--r-- | lib/gitlab/database_importers/self_monitoring/project/create_service.rb | 19 |
1 files changed, 10 insertions, 9 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 d1ada8c723e..57d354eb907 100644 --- a/lib/gitlab/database_importers/self_monitoring/project/create_service.rb +++ b/lib/gitlab/database_importers/self_monitoring/project/create_service.rb @@ -75,13 +75,13 @@ module Gitlab if response # In the add_prometheus_manual_configuration method, the Prometheus - # server_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 + # server_address config is saved as an api_url in the Integrations::Prometheus + # model. There are validates hooks in the Integrations::Prometheus model that + # check if the project associated with the Integrations::Prometheus 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. + # Integrations::Prometheus sees the latest self_monitoring_project_id. Gitlab::CurrentSettings.expire_current_application_settings success(result) else @@ -107,10 +107,10 @@ module Gitlab return success(result) unless prometheus_enabled? return success(result) unless prometheus_server_address.present? - service = result[:project].find_or_initialize_service('prometheus') + prometheus = result[:project].find_or_initialize_integration('prometheus') - unless service.update(prometheus_service_attributes) - log_error('Could not save prometheus manual configuration for self-monitoring project. Errors: %{errors}' % { errors: service.errors.full_messages }) + unless prometheus.update(prometheus_integration_attributes) + log_error('Could not save prometheus manual configuration for self-monitoring project. Errors: %{errors}' % { errors: prometheus.errors.full_messages }) return error(_('Could not save prometheus manual configuration')) end @@ -118,7 +118,8 @@ module Gitlab end def track_event(result) - ::Gitlab::Tracking.event("self_monitoring", "project_created") + project = result[:project] + ::Gitlab::Tracking.event("self_monitoring", "project_created", project: project, namespace: project.namespace) success(result) end @@ -156,7 +157,7 @@ module Gitlab ::Gitlab::Prometheus::Internal.uri end - def prometheus_service_attributes + def prometheus_integration_attributes { api_url: internal_prometheus_server_address_uri, manual_configuration: true, |