Speed up usage_data_metrics_spec
What does this MR do and why?
This MR adds stubs for an expensive metric aggregation which is not required as the spec checks for the keys/schema of the uncached_data
rather than its individual key's value.
Due to !122840 (merged), there are more metric events to be computed. This increases the spec runtime. Many jobs like https://gitlab.com/gitlab-org/gitlab/-/jobs/4664900896 have timed out.
The feature flag use_metric_definitions_for_events_list
can be disabled to resolve the problem but this is not feasible since it will be removed eventually to use the new logic path.
In the before
flamegraph, bulk of the calls came from lib/gitlab/usage/metrics/instrumentations/aggregated_metric.rb
and lib/gitlab/usage/metrics/instrumentations/redis_hll_metric.rb
.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
- Run
time bin/rspec spec/lib/gitlab/usage_data_metrics_spec.rb
on master branch and this branch.
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.