Measure specific parts of diffs_batch.json request
What does this MR do and why?
To be able to understand which part of the diffs_batch.json request takes most of the time, we track specific parts of the request:
- Sorting of diff files
- Querying merge request diff files
- Getting comparison details from Gitaly (only when necessary)
- Unfolding diff lines
- Writing cache (highlight and stats cache)
- Diff file highlighting
- Serialization and rendering
Adds the following metrics:
gitlab_diffs_reorder_*
gitlab_diffs_collection_*
gitlab_diffs_comparison_*
gitlab_diffs_unfoldable_positions_*
gitlab_diffs_unfold_*
gitlab_diffs_write_cache_*
gitlab_diffs_highlight_cache_decorate_*
gitlab_diffs_render_*
This will be helpful to to see if there are improvements that can be done to those parts and track those improvements as well.
How to set up and validate locally
- Modify
config/initializers/zz_metrics.rb
and remove the&& !(Rails.env.development? && defined?(Rails::Generators))
condition. This enables tracking of the metrics on development. - View MR diffs.
- Visit http://localhost:3000/-/metrics and see that the metrics are present.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #381432 (closed)
Edited by Patrick Bajao