Harden Usage Ping | Redis Counters
What does this MR do?
With this Mr we bring the Redis counters hardening in place.
There can be 2 types of Redis counters according to the current implementation and therefor we see it used in 2 different ways
Proposed solution
Implementation consistent with alt_data_usage
, count
and count_distinct
Fallback in -1 value.
Handles ::Redis::CommandError
, Gitlab::UsageDataCounters::BaseCounter::UnknownEvent
errors
Method: redis_usage_data(counter = nil, fallback: -1, &block)
Arguments:
-
counter
: A redis counter on which we expect to have methodtotals
for counter results andfallback_totals
for the same hash keys and having values -1, the fallback -
fallback
: by default -1 -
block
: the code block that could be evaluated to a single value
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 #212402 (closed)
Edited by Alina Mihaila