Skip to content

Extend aggregated metrics definition to include database metrics [RUN ALL RSPEC] [RUN AS-IF-FOSS]

What does this MR do?

It implements #299325 (closed) by extending aggregated metrics feature to metrics sourced from database.

In order to achieve it, following modifications were made:

  1. Aggregated Metric YAML config entry was extended with source attribute, that allows to define which source would be used to calculate aggregate (database, redis)
  2. Gitlab::Usage::Metrics::Aggregates::Aggregate class was extended with ability to select different data sources, based on aggregated metric YAML configuration
  3. New family of classes (PostgresHll, RedisHll) was added under Gitlab::Usage::Metrics::Aggregates::Sources namespace. This classes provides unified interface (.calculate_metrics_union) that abstract source related differences from aggregated metrics feature.
  4. Saving aggregated metric HyperLogLog (save_aggregated_metrics) structure was moved from Gitlab::Utils::UsageData into Gitlab::Usage::Metrics::Aggregates::Sources::PostgresHll since it is only meant to be used for database source metrics, and placing it under Sources::PostgresHll better express that purpose

Aggregated metrics for the config entries with source: database are hidden behind database_sourced_aggregated_metrics feature flag

Does this MR meet the acceptance criteria?

Conformity

Edited by 🤖 GitLab Bot 🤖

Merge request reports