From a6dc1a9da6caf5ea12e794c76972d6ac1eb08f3a Mon Sep 17 00:00:00 2001
From: Niko Belokolodov <nbelokolodov@gitlab.com>
Date: Thu, 30 Jan 2025 08:32:36 +0000
Subject: [PATCH] Remove distribution from metric and event schema

---
 config/events/schema.json                           |  6 ------
 config/metrics/schema/base.json                     | 13 -------------
 .../tracking/event_definition_validator_spec.rb     |  3 ---
 spec/lib/gitlab/usage/metric_definition_spec.rb     | 12 ------------
 4 files changed, 34 deletions(-)

diff --git a/config/events/schema.json b/config/events/schema.json
index db926d7b88a84..b79904641c00a 100644
--- a/config/events/schema.json
+++ b/config/events/schema.json
@@ -10,12 +10,6 @@
   ],
   "additionalProperties": false,
   "properties": {
-    "distributions": {
-      "type": [
-        "array",
-        "null"
-      ]
-    },
     "description": {
       "type": "string"
     },
diff --git a/config/metrics/schema/base.json b/config/metrics/schema/base.json
index 6fe8e6a52a12d..465bf5f629e45 100644
--- a/config/metrics/schema/base.json
+++ b/config/metrics/schema/base.json
@@ -109,19 +109,6 @@
       "type": "string",
       "pattern": "^(([A-Z][a-z]+)+::)*(([A-Z]+[a-z]+)+)$"
     },
-    "distribution": {
-      "type": [
-        "array",
-        "null"
-      ],
-      "items": {
-        "type": "string",
-        "enum": [
-          "ee",
-          "ce"
-        ]
-      }
-    },
     "performance_indicator_type": {
       "type": "array",
       "items": {
diff --git a/spec/lib/gitlab/tracking/event_definition_validator_spec.rb b/spec/lib/gitlab/tracking/event_definition_validator_spec.rb
index 8c91d70a3268e..738a1bddb0d4f 100644
--- a/spec/lib/gitlab/tracking/event_definition_validator_spec.rb
+++ b/spec/lib/gitlab/tracking/event_definition_validator_spec.rb
@@ -13,7 +13,6 @@
       value_description: 'ID of the issue',
       extra_properties: { confidential: false },
       product_group: 'group::product analytics',
-      distributions: %w[ee ce],
       tiers: %w[free premium ultimate],
       introduced_by_url: "https://gitlab.com/example/-/merge_requests/123",
       milestone: '1.6'
@@ -35,7 +34,6 @@
       :value_description    | 1
       :extra_properties     | 'smth'
       :product_group        | nil
-      :distributions        | %(be eb)
       :tiers                | %(pro)
       :product_categories     | 'bad_category'
       :product_categories     | ['bad_category']
@@ -60,7 +58,6 @@
           internal_events: true,
           product_group: 'activation',
           introduced_by_url: "https://gitlab.com/example/-/merge_requests/123",
-          distributions: %w[ce],
           milestone: "1.0",
           tiers: %w[free],
           additional_properties: {}
diff --git a/spec/lib/gitlab/usage/metric_definition_spec.rb b/spec/lib/gitlab/usage/metric_definition_spec.rb
index 5cd76e3b8ed47..52c26f7bb4575 100644
--- a/spec/lib/gitlab/usage/metric_definition_spec.rb
+++ b/spec/lib/gitlab/usage/metric_definition_spec.rb
@@ -198,7 +198,6 @@ def write_metric(metric, path, content)
       :time_frame         | '29d'
       :data_source        | 'other'
       :data_source        | nil
-      :distribution       | 'test'
       :tiers              | %w[test ee]
       :repair_issue_url   | nil
       :removed_by_url     | 1
@@ -375,17 +374,6 @@ def write_metric(metric, path, content)
           end
         end
       end
-
-      # ToDo: Remove once https://gitlab.com/gitlab-org/gitlab/-/issues/469514 is closed
-      context 'when metric has no distribution' do
-        before do
-          attributes[:distribution] = nil
-        end
-
-        it 'has no validation errors' do
-          expect_no_validation_errors
-        end
-      end
     end
   end
 
-- 
GitLab