Skip to content

Add regex pattern to product_group field and convert all metrics definitions

What does this MR do and why?

Related to #359102 (closed).

This MR:

  • Adds a regex pattern to product_group field in metric definitions
  • Removes all group:: prefixes from the values
  • Replaces whitespaces between words with underscores

This is a large MR (in the sense of a massive number of files modified), but all these files have the exact same change and it wouldn't make sense to divide this into smaller parts. The changes were generated by a bunch of sed one-liners:

sed -i -- 's/product_group: group::/product_group: /g' config/metrics/**/*.yml ee/config/metrics/**/*.yml
sed -i -- 's/product_group: group:/product_group: /g' config/metrics/**/*.yml ee/config/metrics/**/*.yml
sed -i -E -- 's/product_group: ([a-z"]+) ([a-z"]+)/product_group: \1_\2/g' config/metrics/**/*.yml ee/config/metrics/**/*.yml

Keep the following in mind to ease reviewing:

  1. All files changed in this MR have exactly one line changed (product_group key value)
  2. The only exception to 1. is config/metrics/schema.json file, which has a regex pattern added to the JSON schema, and spec fixtures in spec/lib/gitlab/usage/*.rb, which got group:: prefixes removed from attributes.
  3. All metric definition file changes are metadata-only and do not cause any side effects to the rest of the codebase

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

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.

Edited by Piotr Skorupa

Merge request reports