Store Instance Statistics measurements periodically
What does this MR do?
This MR periodically stores object counts in the database using the BatchCount
class. The counts will be stored in InstanceStatistics::Measurement
model and the data will be exposed via GraphQL (!40871 (merged)) on the admin interface.
We plan to run the counting jobs every day around 23:50 UTC.
The collection of the data is behind feature flag (store_instance_statistics_measurements
) for now, so by default we're not counting anything. After verifying the change on GL.com for a few days I'll enable the feature flag by default. (no changelog in this MR)
Execution flow:
- Store the current timestamp (
recorded_at
) - For each identifier we want to count (
IDENTIFIER_QUERY_MAPPING
), determine the minimum and maximum database ids. - Build argument list for the counter worker job.
- Invoke N (number of identifiers) jobs async.
- Invoke
BatchCount
and store the count in the database.
Does this MR meet the acceptance criteria?
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
Related to #233853 (closed)