Extend aggregated metrics definition to include database metrics [RUN ALL RSPEC] [RUN AS-IF-FOSS]
requested to merge 299325-extend-aggregated-metrics-definition-to-include-database-metrics into master
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:
- Aggregated Metric YAML config entry was extended with
source
attribute, that allows to define which source would be used to calculate aggregate (database
,redis
) -
Gitlab::Usage::Metrics::Aggregates::Aggregate
class was extended with ability to select different data sources, based on aggregated metric YAML configuration - New family of classes (
PostgresHll
,RedisHll
) was added underGitlab::Usage::Metrics::Aggregates::Sources
namespace. This classes provides unified interface (.calculate_metrics_union
) that abstract source related differences from aggregated metrics feature. - Saving aggregated metric HyperLogLog (
save_aggregated_metrics
) structure was moved fromGitlab::Utils::UsageData
intoGitlab::Usage::Metrics::Aggregates::Sources::PostgresHll
since it is only meant to be used fordatabase
source metrics, and placing it underSources::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
-
Changelog entry -
[ ] Documentation (if required)will be delivered at #299326 (closed) -
Code review guidelines -
Merge request performance guidelines -
Style guides
Edited by 🤖 GitLab Bot 🤖