Commit d0727132 authored by Stan Hu's avatar Stan Hu

Merge branch 'feature/gb/instrument-overwrite-project-service' into 'master'

Track execution of project overwrite service

See merge request gitlab-org/gitlab!66372
parents 4d7298af 453528dd
......@@ -5,6 +5,8 @@ module Projects
def execute(source_project)
return unless source_project && source_project.namespace == @project.namespace
start_time = ::Gitlab::Metrics::System.monotonic_time
Project.transaction do
move_before_destroy_relationships(source_project)
# Reset is required in order to get the proper
......@@ -25,10 +27,25 @@ module Projects
else
raise
end
ensure
track_service(start_time, source_project, e)
end
private
def track_service(start_time, source_project, exception)
return if ::Feature.disabled?(:project_overwrite_service_tracking, source_project, default_enabled: :yaml)
duration = ::Gitlab::Metrics::System.monotonic_time - start_time
Gitlab::AppJsonLogger.info(class: self.class.name,
namespace_id: source_project.namespace.id,
project_id: source_project.id,
duration_s: duration.to_f,
error: exception.class.name)
end
def move_before_destroy_relationships(source_project)
options = { remove_remaining_elements: false }
......
---
name: project_overwrite_service_tracking
introduced_by_url:
rollout_issue_url:
milestone: '14.1'
type: development
group: group::pipeline execution
default_enabled: false
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment