Skip to content

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:

  1. Store the current timestamp (recorded_at)
  2. For each identifier we want to count (IDENTIFIER_QUERY_MAPPING), determine the minimum and maximum database ids.
  3. Build argument list for the counter worker job.
  4. Invoke N (number of identifiers) jobs async.
  5. Invoke BatchCount and store the count in the database.

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

Related to #233853 (closed)

Edited by Adam Hegyi

Merge request reports