Commit 453528dd authored by Grzegorz Bizon's avatar Grzegorz Bizon

Track execution of project overwrite service

parent cef05ad0
......@@ -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