Skip to content

Implement aggregation of usage data for Container Registry AMAU

What does this MR do and why?

Closes #404728 (closed).

This MR adds two metric definitions on the aggregation of the existing metrics for write operations on the Container Registry that were added in !107918 (merged).

  • i_container_registry_push_tag_user
  • i_container_registry_delete_tag_user
  • i_container_registry_delete_repository_user
  • i_container_registry_create_repository_user
  • i_container_registry_push_repository_user

References

Reference Code:

Aggregated metrics: https://docs.gitlab.com/ee/development/service_ping/metrics_instrumentation.html#aggregated-metrics

Validation

  1. In the command prompt, you can validate that the definition is properly read:
curl http://gdk.test:3000/api/v4/usage_data/metric_definitions | grep  -C 5 'i_container_registry_writes_user'
  1. In the rails console, you can also check that the new metrics are part of the usage data:

Open the rails console:

bundle exec rails c

And then query the following:

usage = GitlabServicePingWorker.new.usage_data;nil
usage.dig('redis_hll_counters', 'user_container_registry').keys.include?("i_container_registry_writes_user_weekly")
# => true
usage.dig('redis_hll_counters', 'user_container_registry').keys.include?("i_container_registry_writes_user_monthly")
# => true

MR acceptance checklist

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

Related to #404728 (closed)

Edited by Adie (she/her)

Merge request reports