Skip to content

Add specs ensuring all metric definition key paths are present

What does this MR do?

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.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

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:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Alper Akgun

Merge request reports