From 56e7aaafa1d114fb7ae8e4908108a8da9300518d Mon Sep 17 00:00:00 2001
From: Jonas Larsen <jlarsen@gitlab.com>
Date: Mon, 11 Dec 2023 16:26:08 +0000
Subject: [PATCH] Make events root property prohibited in redis_event metrics

The root property `events` is used by metrics with the `data_source: internal_events`.
Sometimes we forget to update the `data_source` when we migrate a metric from RedisHLL to InternalEvents.

This change makes sure the spec will fail if we add a `events` root property and keep the `redis_hll` `data_source`.
---
 .../counts_28d/20210216180334_g_edit_by_sfe_monthly.yml    | 2 +-
 .../20211126084446_p_analytics_ci_cd_pipelines_monthly.yml | 2 +-
 ...0835_p_analytics_ci_cd_deployment_frequency_monthly.yml | 2 +-
 .../20211126091206_p_analytics_ci_cd_lead_time_monthly.yml | 2 +-
 .../counts_7d/20210216180332_g_edit_by_sfe_weekly.yml      | 2 +-
 .../20211126084441_p_analytics_ci_cd_pipelines_weekly.yml  | 2 +-
 ...90829_p_analytics_ci_cd_deployment_frequency_weekly.yml | 2 +-
 .../20211126091200_p_analytics_ci_cd_lead_time_weekly.yml  | 2 +-
 config/metrics/schema/redis_hll.json                       | 7 ++++++-
 9 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/config/metrics/counts_28d/20210216180334_g_edit_by_sfe_monthly.yml b/config/metrics/counts_28d/20210216180334_g_edit_by_sfe_monthly.yml
index 8d68bd81e2fcf..f4212cf9c279f 100644
--- a/config/metrics/counts_28d/20210216180334_g_edit_by_sfe_monthly.yml
+++ b/config/metrics/counts_28d/20210216180334_g_edit_by_sfe_monthly.yml
@@ -8,7 +8,7 @@ product_group: source_code
 value_type: number
 status: active
 time_frame: 28d
-data_source: redis_hll
+data_source: internal_events
 instrumentation_class: RedisHLLMetric
 options:
   events:
diff --git a/config/metrics/counts_28d/20211126084446_p_analytics_ci_cd_pipelines_monthly.yml b/config/metrics/counts_28d/20211126084446_p_analytics_ci_cd_pipelines_monthly.yml
index f84d9c7483ade..76faa2362476b 100644
--- a/config/metrics/counts_28d/20211126084446_p_analytics_ci_cd_pipelines_monthly.yml
+++ b/config/metrics/counts_28d/20211126084446_p_analytics_ci_cd_pipelines_monthly.yml
@@ -9,7 +9,7 @@ status: active
 milestone: '14.6'
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75187
 time_frame: 28d
-data_source: redis_hll
+data_source: internal_events
 data_category: optional
 instrumentation_class: RedisHLLMetric
 performance_indicator_type: []
diff --git a/config/metrics/counts_28d/20211126090835_p_analytics_ci_cd_deployment_frequency_monthly.yml b/config/metrics/counts_28d/20211126090835_p_analytics_ci_cd_deployment_frequency_monthly.yml
index e151c55c1bcee..12a7b7c15037a 100644
--- a/config/metrics/counts_28d/20211126090835_p_analytics_ci_cd_deployment_frequency_monthly.yml
+++ b/config/metrics/counts_28d/20211126090835_p_analytics_ci_cd_deployment_frequency_monthly.yml
@@ -9,7 +9,7 @@ status: active
 milestone: '14.6'
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75187
 time_frame: 28d
-data_source: redis_hll
+data_source: internal_events
 data_category: operational
 instrumentation_class: RedisHLLMetric
 performance_indicator_type:
diff --git a/config/metrics/counts_28d/20211126091206_p_analytics_ci_cd_lead_time_monthly.yml b/config/metrics/counts_28d/20211126091206_p_analytics_ci_cd_lead_time_monthly.yml
index f5a4882aca599..ee6a2d7205835 100644
--- a/config/metrics/counts_28d/20211126091206_p_analytics_ci_cd_lead_time_monthly.yml
+++ b/config/metrics/counts_28d/20211126091206_p_analytics_ci_cd_lead_time_monthly.yml
@@ -9,7 +9,7 @@ status: active
 milestone: '14.6'
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75187
 time_frame: 28d
-data_source: redis_hll
+data_source: internal_events
 data_category: operational
 instrumentation_class: RedisHLLMetric
 performance_indicator_type:
diff --git a/config/metrics/counts_7d/20210216180332_g_edit_by_sfe_weekly.yml b/config/metrics/counts_7d/20210216180332_g_edit_by_sfe_weekly.yml
index a174cfc458857..18d2f77b2a415 100644
--- a/config/metrics/counts_7d/20210216180332_g_edit_by_sfe_weekly.yml
+++ b/config/metrics/counts_7d/20210216180332_g_edit_by_sfe_weekly.yml
@@ -8,7 +8,7 @@ product_group: source_code
 value_type: number
 status: active
 time_frame: 7d
-data_source: redis_hll
+data_source: internal_events
 instrumentation_class: RedisHLLMetric
 options:
   events:
diff --git a/config/metrics/counts_7d/20211126084441_p_analytics_ci_cd_pipelines_weekly.yml b/config/metrics/counts_7d/20211126084441_p_analytics_ci_cd_pipelines_weekly.yml
index e86741aedb280..bb0e42314e6de 100644
--- a/config/metrics/counts_7d/20211126084441_p_analytics_ci_cd_pipelines_weekly.yml
+++ b/config/metrics/counts_7d/20211126084441_p_analytics_ci_cd_pipelines_weekly.yml
@@ -9,7 +9,7 @@ status: active
 milestone: '14.6'
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75187
 time_frame: 7d
-data_source: redis_hll
+data_source: internal_events
 data_category: optional
 instrumentation_class: RedisHLLMetric
 performance_indicator_type: []
diff --git a/config/metrics/counts_7d/20211126090829_p_analytics_ci_cd_deployment_frequency_weekly.yml b/config/metrics/counts_7d/20211126090829_p_analytics_ci_cd_deployment_frequency_weekly.yml
index f0bbdcbda6205..6f89676da0cb5 100644
--- a/config/metrics/counts_7d/20211126090829_p_analytics_ci_cd_deployment_frequency_weekly.yml
+++ b/config/metrics/counts_7d/20211126090829_p_analytics_ci_cd_deployment_frequency_weekly.yml
@@ -9,7 +9,7 @@ status: active
 milestone: '14.6'
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75187
 time_frame: 7d
-data_source: redis_hll
+data_source: internal_events
 data_category: optional
 instrumentation_class: RedisHLLMetric
 performance_indicator_type: []
diff --git a/config/metrics/counts_7d/20211126091200_p_analytics_ci_cd_lead_time_weekly.yml b/config/metrics/counts_7d/20211126091200_p_analytics_ci_cd_lead_time_weekly.yml
index d95376e277ad6..1fa1a07d7bb2d 100644
--- a/config/metrics/counts_7d/20211126091200_p_analytics_ci_cd_lead_time_weekly.yml
+++ b/config/metrics/counts_7d/20211126091200_p_analytics_ci_cd_lead_time_weekly.yml
@@ -9,7 +9,7 @@ status: active
 milestone: '14.6'
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75187
 time_frame: 7d
-data_source: redis_hll
+data_source: internal_events
 data_category: optional
 instrumentation_class: RedisHLLMetric
 performance_indicator_type: []
diff --git a/config/metrics/schema/redis_hll.json b/config/metrics/schema/redis_hll.json
index 35d520a5833e2..255a4f89b9008 100644
--- a/config/metrics/schema/redis_hll.json
+++ b/config/metrics/schema/redis_hll.json
@@ -32,7 +32,12 @@
         "required": [
           "instrumentation_class",
           "options"
-        ]
+        ],
+        "not": {
+          "required": [
+            "events"
+          ]
+        }
       },
       {
         "properties": {
-- 
GitLab