Skip to content

Extract events from metric definitions in CI to reduce startup time

What does this MR do and why?

Before these changes, we would read all metric definitions from an initializer. Accessing and parsing thousands of yaml files takes about 1 second on CI.

This MR introduce a precomputed version of the data that was previous extracted at up-start and therefore removes the extra startup time.

You now have to run bin/rake gitlab:internal_events_tracking:generate_event_definitions when you make changes to a metric definition file.

Two precomputed files are created:

  • config/metrics/all_events.yml (Holds information about CE-events)
  • ee/config/metrics/all_events.yml (Holds information about EE-events)

The disadvantage of this change is that we now have to remember to run the rake task after each change to a metric.

We could remedy this issue by running the rake task automatically at up-start in dev. If we check the updated timestamps of the files, we can make sure we only add the startup time when the metric definitions has been changed.

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

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #414653 (closed)

Edited by Jonas Larsen

Merge request reports