summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2017-11-20 15:08:50 +0000
committerSean McGivern <sean@mcgivern.me.uk>2017-11-20 15:08:50 +0000
commit190ea021cd1fd89d20c9548a72034a7b941413ca (patch)
tree1e5102907c5df27faf1b27466ae140d4124d6f4b
parentbd026b6a28ac410ad455b7b915cafc9782296b6b (diff)
parentfad11dec23425ca1f83ff7ef745cc933ea6d2aa2 (diff)
downloadgitlab-ce-190ea021cd1fd89d20c9548a72034a7b941413ca.tar.gz
Merge branch 'osw-merge-process-logs' into 'master'
Add logs for monitoring the merge process See merge request gitlab-org/gitlab-ce!15425
-rw-r--r--app/services/merge_requests/merge_service.rb12
-rw-r--r--changelogs/unreleased/osw-merge-process-logs.yml5
2 files changed, 17 insertions, 0 deletions
diff --git a/app/services/merge_requests/merge_service.rb b/app/services/merge_requests/merge_service.rb
index 1da4dbd9e96..cedfcb50e09 100644
--- a/app/services/merge_requests/merge_service.rb
+++ b/app/services/merge_requests/merge_service.rb
@@ -10,6 +10,8 @@ module MergeRequests
attr_reader :merge_request, :source
+ delegate :merge_jid, :state, to: :@merge_request
+
def execute(merge_request)
if project.merge_requests_ff_only_enabled && !self.is_a?(FfMergeService)
FfMergeService.new(project, current_user, params).execute(merge_request)
@@ -27,6 +29,7 @@ module MergeRequests
success
end
end
+ log_info("Merge process finished on JID #{merge_jid} with state #{state}")
rescue MergeError => e
handle_merge_error(log_message: e.message, save_message_on_model: true)
end
@@ -49,7 +52,9 @@ module MergeRequests
def commit
message = params[:commit_message] || merge_request.merge_commit_message
+ log_info("Git merge started on JID #{merge_jid}")
commit_id = repository.merge(current_user, source, merge_request, message)
+ log_info("Git merge finished on JID #{merge_jid} commit #{commit_id}")
raise MergeError, 'Conflicts detected during merge' unless commit_id
@@ -63,7 +68,9 @@ module MergeRequests
end
def after_merge
+ log_info("Post merge started on JID #{merge_jid} with state #{state}")
MergeRequests::PostMergeService.new(project, current_user).execute(merge_request)
+ log_info("Post merge finished on JID #{merge_jid} with state #{state}")
if delete_source_branch?
DeleteBranchService.new(@merge_request.source_project, branch_deletion_user)
@@ -92,6 +99,11 @@ module MergeRequests
@merge_request.update(merge_error: log_message) if save_message_on_model
end
+ def log_info(message)
+ @logger ||= Rails.logger
+ @logger.info("#{merge_request_info} - #{message}")
+ end
+
def merge_request_info
merge_request.to_reference(full: true)
end
diff --git a/changelogs/unreleased/osw-merge-process-logs.yml b/changelogs/unreleased/osw-merge-process-logs.yml
new file mode 100644
index 00000000000..d2bb0e09834
--- /dev/null
+++ b/changelogs/unreleased/osw-merge-process-logs.yml
@@ -0,0 +1,5 @@
+---
+title: Add logs for monitoring the merge process
+merge_request:
+author:
+type: other