This is an exploratory issue. We need to see the time between when the merge button is hit and the merge actually occurs. We had an issue last week where it took too long to merge: #31692 (closed). I'm trying to understand how much the parallelizing helped our merge times.
Ideally, we have some repeatable process that we can get the last week (and pushed to periscope is the ideal form).
We can provide analysis back to the handbook team for additional feedback.
Can we start from taking a metric about how long MRs actually waited to be merged due to this limit? So we can confirm whether the new limit effectively resolves our problem?
Here is a script to collect the metrics of waiting time per (recently merged) merge request with merge train.
header=trueproject.merge_requests.merged.joins(:metrics).where('merge_request_metrics.merged_at > ?',1.day.ago).eachdo|mr|ifheaderputs"Date: #{Time.now}"puts"Subject: Waiting time per merge request (which merged in the last 24h) with merge train"puts"MR IID, Waited (Min), Initial position"header=falseendstart_at,finished_at,initial_position=nil,nil,nilmr.notes.order(:created_at).eachdo|note|result,position=%r{added this merge request to the merge train at position (\d+)}.match(note.note).to_a.flattenifresult.present?start_at=note.created_atinitial_position=positionendifnote.note=='started a merge train'start_at=note.created_atinitial_position=1endifnote.note=~%r{removed this merge request from the merge train because .*}start_at=nilendifnote.note=='merged'finished_at=note.created_atendendnextunlessfinished_at&&start_atdiff=finished_at-start_atdiff=(diff/60).ceilputs"#{mr.iid}, #{diff}, #{initial_position}"end;:ok
Here is a script to collect the metric of direct merge without merge train.
header=trueproject.merge_requests.merged.joins(:metrics).where('merge_request_metrics.merged_at > ?',1.day.ago).eachdo|mr|ifheaderputs"Date: #{Time.now}"puts"Subject: Directly merged merge requests without merge train (discouraged)"puts"MR IID, Merged by"header=falseendstart_at,finished_at=nil,nilmr.notes.order(:created_at).eachdo|note|result,position=%r{added this merge request to the merge train at position (\d+)}.match(note.note).to_a.flattenifresult.present?start_at=note.created_atinitial_position=positionendifnote.note=='started a merge train'start_at=note.created_atinitial_position=1endifnote.note=~%r{removed this merge request from the merge train because .*}start_at=nilendifnote.note=='merged'finished_at=note.created_atendendunlessfinished_at&&start_atputs"#{mr.iid}, #{mr.metrics.merged_by.name}"nextendend
Please note that this is basically discouraged in general, as it slows down all the MR's merge time.