Add Basic Redis HLL class
What does this MR do?
Add a base class for tracking purpose Gitlab::UsageData::BaseHLL
-
Here have the the expiry values 6 weeks
-
Add some other common parts
-
Add a base key format, with a weekly key(I'm not 100% sure about weekly keys, as this myght couse us to miss some data if the weeks are not full when we build the usage ping, unless we explicit get the count for last 4 full weeks)
-
Add HLLRedisCounter -
Add custom KEY_EXPIRY_LENGTH -
Allow Array of events -
Implement feature per event, per actor, user https://docs.gitlab.com/ee/development/feature_flags/development.html#feature-actorsMove this in a separate issue #235954 (closed) -
Add more tests
Example of usage
Add a class for expand_vulnerabilities event
Keep in mind to add a feature flag per event with user actor for percentage rollout
class ExpandVulnerabilitiesCounts < UsageDataCounters::HLLRedisCounter
# This can take multiple events
KNOWN_EVENTS = %(expand_vulnerabilities).freeze
Later
# controller
ExpandVulnerabilitiesCounts.new.track_event("entity_id", "expand_vulnerabilities")
# usage_data
ExpandVulnerabilitiesCounts.new.unique_events("entity_id", weeks: 4)
Conformity
-
Changelog entry -
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
Closes #235697 (closed)