Skip to content

Draft: Add <name>_metric.yml file for usage data metrics definition

What does this MR do?

Add base for having yml metrics files

The metric identifier(the metric key) is based on default_generation and full_path attributes. The key is the default generation full path

#270107 (comment 458923217)

Questions

How to use this yml file?

  • we could have a rake task to build the metrics dictionary from the metrics yml files, where should this file live and what should be the format? How should make this easy visible?

Notes

  • Check complex metrics definitions
  • Consider ee metrics
Example of metrics definitions
[7] pry(main)> Gitlab::UsageData::Metric::Definition.definitions
=> {"database.adapter"=>
  #<Gitlab::UsageData::Metric::Definition:0x00007ffcc8ff6370
   @attributes=
    {:name=>"adapter",
     :description=>"The version of the PostgreSQL database",
     :default_generation=>"generation_1",
     :full_path=>{:generation_1=>"database.adapter"},
     :milestone=>nil,
     :introduced_by_url=>nil,
     :group=>"group::enablement distribution",
     :time_frame=>nil,
     :distribution=>["ee", "ce"],
     :tier=>["free", "starter", "premium", "ultimate", "bronze", "silver", "gold"],
     :type=>"settings",
     :data_source=>nil},
   @path="/Users/alina/Documents/work/gitlab-development-kit/gitlab/lib/gitlab/usage_data/metrics_definitions/settings/database_adapter.yml">,
 "recorded_at"=>
  #<Gitlab::UsageData::Metric::Definition:0x00007ffcc8ff4b38
   @attributes=
    {:name=>"recorded_at",
     :description=>"Time when usage data is recorded",
     :default_generation=>"generation_1",
     :full_path=>{:generation_1=>"recorded_at", :generation_2=>"license.recorded_at"},
     :milestone=>nil,
     :introduced_by_url=>nil,
     :group=>"group::product analytics",
     :time_frame=>nil,
     :distribution=>["ee", "ce"],
     :tier=>["free", "starter", "premium", "ultimate", "bronze", "silver", "gold"],
     :type=>"license",
     :data_source=>nil},
   @path="/Users/alina/Documents/work/gitlab-development-kit/gitlab/lib/gitlab/usage_data/metrics_definitions/license/recorded_at.yml">,
 "counts.deployments"=>
  #<Gitlab::UsageData::Metric::Definition:0x00007ffcba9e3478
   @attributes=
    {:name=>"deployments",

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #270107 (closed)

Edited by Alina Mihaila

Merge request reports