Add a separate metrics definition generator for Redis HLL counters
What does this MR do?
Part of #322733 (closed).
This adds a new generator gitlab:usage_metric_definition:redis_hll
that creates two definitions with monthly and weekly timeframes (by running gitlab:usage_metric_definition
twice) in accordance with the existing guidelines for Redis HLL metric definitions.
Skipping validation in Gitlab::Usage::MetricDefinition.definitions
was needed because metrics that are generated with gitlab:usage_metric_definition
are invalid at first (they require filling out some required keys like description
and tier
), and when the generator runs again to create a second file, Gitlab::Usage::MetricDefinition.definitions
call tries to validate all metrics, including the new temporarily invalid one, and raises an exception.
Gitlab::UsageMetricDefinitionGenerator
is called explicitly through the Thor API instead of using the generate
command due to issues with RSpec constant stubbing. This was probably caused by generate
calling the generator with a system call, spawning a new process that reloads the class, circumventing stubbing in the process. This also shows explicit relation (or coupling) to the generator we call.
Does this MR meet the acceptance criteria?
Conformity
-
📋 Does this MR need a changelog?-
I have included a changelog entry. -
I have not included a changelog entry because _____.
-
-
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
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
Related to #322733 (closed)