Skip to content

Build usage data queries and usage data non sql metrics using instrumentation classes

What does this MR do?

  • Merge data generated with instrumentation classes to UsageDataQueries.uncached_data
  • Merge data generated with instrumentation classes to UsageDataNonSqlMetrics.uncached_data
  • Move logic to build payload in Gitlab::Usage::Metric class. This would be the object around which we build Service ping payload.
  • For this 2 cases we compute 2 times the metrics which are having instrumentation classes. This is ok in this 2 cases, and this will be fixed when we work on merging the instrumentation classes to Service ping, in usage_data.rb.

We override the uncached_method and merge the data generated using the instrumentation classes.

With this change, we are one step further to do the some with the usage_data.rb and this way we won't need to manually add metrics in usage_data.rb anymore.

The goal is to have implemented an instrumentation class and from there, service ping will be computed and generated.

Screenshots or Screencasts (strongly suggested)

How to setup and validate locally (strongly suggested)

In rails console

# Check the generated Service ping using only instrumentation classes
Gitlab::UsageDataMetrics.uncached_data

# Check the generated queries using merged instrumentation classes
# This should be a complete Service ping payload with values and generated queries for database metrics
Gitlab::UsageDataQueries.uncached_data

# Check the generated queries using merged instrumentation classes
# This should be a complete Service ping payload with values and generated queries for the database metrics
Gitlab::UsageDataNonSqlMetrics.uncached_data

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • 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 #332954 (closed)

Edited by Alina Mihaila

Merge request reports