Do not add removed metrics when generating Service ping using instrumentation classes
Follow-up issue from !67820 (comment 649871333)
Summary
We should not add to service ping metrics that are marked as removed in their YAML definition.
Filter the metric definition to not select removed
metrics.
Details
We compute Service ping using metrics instrumentation classes in Gitlab::UsageDataMetrics.uncached_data
Usage metric Gtilab::Usage::Metric
is the class responsible to build the hash we add to the service ping payload.
Here we should not select all metrics, we should select only metrics that should be computed and added in service ping payload.
Requirements
- Service ping payload should not include metrics marked as
removed
Proposal
-
Select metric definitions where
defintion.status != removed
https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/usage/metric.rb#L13 -
Select only metrics with status
active
data_available
implemented
-
Filter definitions in
Gitlab::Usage::MetricDefinition
https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/usage/metric_definition.rb
Note
Please follow https://gitlab.com/gitlab-org/gitlab/-/issues/338029 it could be covered there