Add specs ensuring all metric definition key paths are present
Merged
requested to merge 322604-add-a-check-that-the-metric-definitions-are-added-when-new-metrics-are-added-to-usage-ping into master
Compare changes
Add specs ensuring all metric definition key paths are present in Usage Ping structure
Related to #322604 (closed).
This introduces a spec that checks if all key paths from metric definitions in config/metrics/**/*.yml
files are present in actual Usage Ping data structure generated locally by Gitlab::UsageData
and vice versa. It should act as a safeguard when adding and removing metrics and prevent unintended changes that would mutate the Usage Ping structure and are easily missed, like metrics that are dynamically generated from code.
At first, the test was failing, with a number of missing metrics or definitions (see #322604 (comment 553171773)) and after a thorough investigation, I've added metric definitions that, to my best knowledge, are genuinely missing.
Some key paths are omitted on purpose - because they are development fixtures (like mock_ci
), yield data types that are more complex than a numerical value (like histogram
or object
types like topology
metrics, which schema is not finalized yet). Some like user_auth_by_provider_*
require further inspection.
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
@gitlab-com/gl-security/appsec