diff --git a/config/metrics/schema/internal_events.json b/config/metrics/schema/internal_events.json
index d925b8af1eb9838fe7564e6a7747b427bf90683a..75378db054d84d698fc68e82554d62677969b199 100644
--- a/config/metrics/schema/internal_events.json
+++ b/config/metrics/schema/internal_events.json
@@ -63,9 +63,41 @@
         "properties": {
           "instrumentation_class": {
             "const": "TotalCountMetric"
+          },
+          "options": {
+            "type": "object",
+            "properties": {
+              "events": {
+                "type": "array",
+                "items": {
+                  "type": "string"
+                }
+              }
+            },
+            "required": [
+              "events"
+            ],
+            "additionalProperties": false
+          },
+          "events": {
+            "type": "array",
+            "items": {
+              "type": "object",
+              "required": [
+                "name"
+              ],
+              "properties": {
+                "name": {
+                  "type": "string"
+                }
+              },
+              "additionalProperties": false
+            }
           }
         },
         "required": [
+          "events",
+          "options",
           "instrumentation_class"
         ]
       }
diff --git a/config/metrics/schema/redis_hll.json b/config/metrics/schema/redis_hll.json
index 31de5d27e400aa6860a008203a6f04673a9b7ae0..35d520a5833e28321bccc50a670e069102bcaa37 100644
--- a/config/metrics/schema/redis_hll.json
+++ b/config/metrics/schema/redis_hll.json
@@ -38,10 +38,46 @@
         "properties": {
           "instrumentation_class": {
             "const": "AggregatedMetric"
+          },
+          "options": {
+            "type": "object",
+            "properties": {
+              "aggregate": {
+                "type": "object",
+                "properties": {
+                  "operator": {
+                    "enum": [
+                      "OR",
+                      "AND"
+                    ]
+                  },
+                  "attribute": {
+                    "type": "string"
+                  }
+                },
+                "required": [
+                  "operator",
+                  "attribute"
+                ],
+                "additionalProperties": false
+              },
+              "events": {
+                "type": "array",
+                "items": {
+                  "type": "string"
+                }
+              }
+            },
+            "required": [
+              "aggregate",
+              "events"
+            ],
+            "additionalProperties": false
           }
         },
         "required": [
-          "instrumentation_class"
+          "instrumentation_class",
+          "options"
         ]
       },
       {
diff --git a/spec/lib/gitlab/usage/metric_definition_spec.rb b/spec/lib/gitlab/usage/metric_definition_spec.rb
index 871891d864a56c30b83ff3237d67aee1efee2ba6..08adc0316313b90a4f619a0d3de42889962d1e63 100644
--- a/spec/lib/gitlab/usage/metric_definition_spec.rb
+++ b/spec/lib/gitlab/usage/metric_definition_spec.rb
@@ -223,19 +223,26 @@ def write_metric(metric, path, content)
         end
 
         where(:instrumentation_class, :options, :events, :is_valid) do
-          'TotalCountMetric' | {} | [] | true
-          'AnotherClass'   | { events: ['a'] } | [{ name: 'a', unique: 'user.id' }] | false
-          nil              | { events: ['a'] } | [{ name: 'a', unique: 'user.id' }] | false
-          'RedisHLLMetric' | { events: ['a'] } | [{ name: 'a', unique: 'user.id' }] | true
-          'RedisHLLMetric' | { events: ['a'] } | nil | false
-          'RedisHLLMetric' | nil               | [{ name: 'a', unique: 'user.id' }] | false
-          'RedisHLLMetric' | { events: ['a'] } | [{ name: 'a', unique: 'a' }] | false
-          'RedisHLLMetric' | { events: 'a' } | [{ name: 'a', unique: 'user.id' }] | false
-          'RedisHLLMetric' | { events: [2] } | [{ name: 'a', unique: 'user.id' }] | false
-          'RedisHLLMetric' | { events: ['a'], a: 'b' } | [{ name: 'a', unique: 'user.id' }] | false
-          'RedisHLLMetric' | { events: ['a'] } | [{ name: 'a', unique: 'user.id', b: 'c' }] | false
-          'RedisHLLMetric' | { events: ['a'] } | [{ name: 'a' }] | false
-          'RedisHLLMetric' | { events: ['a'] } | [{ unique: 'user.id' }] | false
+          'AnotherClass'     | { events: ['a'] } | [{ name: 'a', unique: 'user.id' }] | false
+          nil                | { events: ['a'] } | [{ name: 'a', unique: 'user.id' }] | false
+          'RedisHLLMetric'   | { events: ['a'] } | [{ name: 'a', unique: 'user.id' }] | true
+          'RedisHLLMetric'   | { events: ['a'] } | nil | false
+          'RedisHLLMetric'   | nil               | [{ name: 'a', unique: 'user.id' }] | false
+          'RedisHLLMetric'   | { events: ['a'] } | [{ name: 'a', unique: 'a' }] | false
+          'RedisHLLMetric'   | { events: 'a' }   | [{ name: 'a', unique: 'user.id' }] | false
+          'RedisHLLMetric'   | { events: [2] }   | [{ name: 'a', unique: 'user.id' }] | false
+          'RedisHLLMetric'   | { events: ['a'], a: 'b' } | [{ name: 'a', unique: 'user.id' }] | false
+          'RedisHLLMetric'   | { events: ['a'] } | [{ name: 'a', unique: 'user.id', b: 'c' }] | false
+          'RedisHLLMetric'   | { events: ['a'] } | [{ name: 'a' }] | false
+          'RedisHLLMetric'   | { events: ['a'] } | [{ unique: 'user.id' }] | false
+          'TotalCountMetric' | { events: ['a'] } | [{ name: 'a' }] | true
+          'TotalCountMetric' | { events: ['a'] } | [{ name: 'a', unique: 'user.id' }] | false
+          'TotalCountMetric' | { events: ['a'] } | nil | false
+          'TotalCountMetric' | nil               | [{ name: 'a' }] | false
+          'TotalCountMetric' | { events: [2] }   | [{ name: 'a' }] | false
+          'TotalCountMetric' | { events: ['a'] } | [{}] | false
+          'TotalCountMetric' | 'a'               | [{ name: 'a' }] | false
+          'TotalCountMetric' | { events: ['a'], a: 'b' } | [{ name: 'a' }] | false
         end
 
         with_them do
@@ -300,11 +307,26 @@ def write_metric(metric, path, content)
         where(:instrumentation_class, :options, :is_valid) do
           'AnotherClass'     | { events: ['a'] } | false
           'RedisHLLMetric'   | { events: ['a'] } | true
+          'RedisHLLMetric'   | nil | false
+          'RedisHLLMetric'   | {} | false
           'RedisHLLMetric'   | { events: ['a'], b: 'c' } | false
           'RedisHLLMetric'   | { events: [2] } | false
           'RedisHLLMetric'   | { events: 'a' } | false
           'RedisHLLMetric'   | { event: ['a'] } | false
-          'AggregatedMetric' | {} | true
+          'AggregatedMetric' | { aggregate: { operator: 'OR', attribute: 'user_id' }, events: ['a'] } | true
+          'AggregatedMetric' | { aggregate: { operator: 'AND', attribute: 'project_id' }, events: %w[b c] } | true
+          'AggregatedMetric' | nil | false
+          'AggregatedMetric' | {} | false
+          'AggregatedMetric' | { aggregate: { operator: 'OR', attribute: 'user_id' }, events: ['a'], event: 'a' } | false
+          'AggregatedMetric' | { aggregate: { operator: 'OR', attribute: 'user_id' } } | false
+          'AggregatedMetric' | { events: ['a'] } | false
+          'AggregatedMetric' | { aggregate: { operator: 'OR', attribute: 'user_id' }, events: 'a' } | false
+          'AggregatedMetric' | { aggregate: 'a', events: ['a'] } | false
+          'AggregatedMetric' | { aggregate: { operator: 'OR' }, events: ['a'] } | false
+          'AggregatedMetric' | { aggregate: { attribute: 'user_id' }, events: ['a'] } | false
+          'AggregatedMetric' | { aggregate: { operator: 'OR', attribute: 'user_id', a: 'b' }, events: ['a'] } | false
+          'AggregatedMetric' | { aggregate: { operator: '???', attribute: 'user_id' }, events: ['a'] } | false
+          'AggregatedMetric' | { aggregate: { operator: 'OR', attribute: ['user_id'] }, events: ['a'] } | false
         end
 
         with_them do