Skip to content

Add unique to Generator for Internal Events

What does this MR do and why?

The generator is currently outputting incomplete metric definitions.

This MR adds the missing parts so that the definitions can be used without modification.

Specifically the new events section with the unique key is added which is needed for Internal Events Tracking.

Screenshots or screen recordings

Before After

How to set up and validate locally

Run the generator like below and answer the questions. (You can use gibberish descriptions if you want to).

bin/rails g gitlab:analytics:internal_events \
  --time_frames=7d 28d\
  --group=project_management \
  --stage=plan --section=dev \
  --event=project_created \
  --unique=user.id \
  --mr=https://gitlab.com/gitlab-org/gitlab/-/merge_requests/121544

Verify that the generated metric definitions (config/metrics/counts_28d/count_distinct_user_id_from_project_created_28d.yml and config/metrics/counts_7d/count_distinct_user_id_from_project_created_7d.yml) includes the following section:

options:
  events:
    - project_created
events:
  - name: project_created
    unique: user.id

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 #409992 (closed)

Edited by Jonas Larsen

Merge request reports