Skip to content

Migrate project imports total metric to instrumentation class

What does this MR do and why?

Related to #351486 (closed). Follow-up to !84521 (merged).

This MR migrates usage_activity_by_stage.manage.project_imports.total and usage_activity_by_stage_monthly.manage.project_imports.total metrics to an instrumentation class and optimizes the SQL query to have a where clause over multiple import_types.

The class doesn't follow the usual conventions and overrides the behavior of class methods like .relation and .operation in #value and manually constructs a corresponding SQL query, because add operation is not implemented yet (to be in #332713 (closed)) and therefore adding multiple counts is not supported yet.

This is a stop-gap measure to unblock automated Service Ping efforts, which depend on this change of the metric SQL query (see https://gitlab.com/gitlab-data/analytics/-/issues/10163).

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Piotr Skorupa

Merge request reports