Skip to content

Commit fb38625

Browse files
authored
Emiel/add support for enable_aging_subject_filter (#40)
Add support for enable_aging_subject_filter Allow winsorization support for count_distinct metrics
1 parent aff4ef3 commit fb38625

File tree

4 files changed

+146
-34
lines changed

4 files changed

+146
-34
lines changed

eppo_metrics_sync/schema/eppo_metric_schema.json

Lines changed: 140 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@
1818
"type": "array",
1919
"items": {
2020
"additionalProperties": false,
21-
"required": ["name", "sql", "timestamp_column", "entities", "facts"],
21+
"required": [
22+
"name",
23+
"sql",
24+
"timestamp_column",
25+
"entities",
26+
"facts"
27+
],
2228
"properties": {
2329
"name": {
2430
"description": "A name for the fact source",
@@ -42,7 +48,10 @@
4248
"items": {
4349
"type": "object",
4450
"additionalProperties": false,
45-
"required": ["entity_name", "column"],
51+
"required": [
52+
"entity_name",
53+
"column"
54+
],
4655
"properties": {
4756
"entity_name": {
4857
"description": "The name of the entity, must exactly match name specified in Eppo UI",
@@ -60,7 +69,9 @@
6069
"type": "array",
6170
"items": {
6271
"type": "object",
63-
"required": ["name"],
72+
"required": [
73+
"name"
74+
],
6475
"additionalProperties": false,
6576
"properties": {
6677
"name": {
@@ -69,15 +80,21 @@
6980
},
7081
"column": {
7182
"description": "The column that contains this fact (if not specified, will use each record)",
72-
"type": ["string", "null"]
83+
"type": [
84+
"string",
85+
"null"
86+
]
7387
},
7488
"description": {
7589
"description": "User-friendly description of the fact",
7690
"type": "string"
7791
},
7892
"desired_change": {
7993
"description": "Specify whether or not increases in the fact are desired",
80-
"enum": ["increase", "decrease"]
94+
"enum": [
95+
"increase",
96+
"decrease"
97+
]
8198
}
8299
}
83100
}
@@ -88,7 +105,10 @@
88105
"items": {
89106
"type": "object",
90107
"additionalProperties": false,
91-
"required": ["name", "column"],
108+
"required": [
109+
"name",
110+
"column"
111+
],
92112
"properties": {
93113
"name": {
94114
"description": "A user-friendly name for the fact property",
@@ -122,7 +142,10 @@
122142
"items": {
123143
"type": "object",
124144
"additionalProperties": false,
125-
"required": ["name", "entity"],
145+
"required": [
146+
"name",
147+
"entity"
148+
],
126149
"properties": {
127150
"name": {
128151
"description": "A user-friendly name shown in the Eppo UI",
@@ -134,7 +157,11 @@
134157
},
135158
"type": {
136159
"description": "The kind of metric to be calculated",
137-
"enum": ["simple", "ratio", "percentile"]
160+
"enum": [
161+
"simple",
162+
"ratio",
163+
"percentile"
164+
]
138165
},
139166
"entity": {
140167
"description": "Must exactly match entity's name in Eppo UI",
@@ -146,7 +173,10 @@
146173
},
147174
"metric_display_style": {
148175
"description": "Either decimal or percent",
149-
"enum": ["decimal", "percent"]
176+
"enum": [
177+
"decimal",
178+
"percent"
179+
]
150180
},
151181
"minimum_detectable_effect": {
152182
"description": "Default minimum detectable effect used in progress bar",
@@ -158,37 +188,60 @@
158188
},
159189
"guardrail_cutoff": {
160190
"description": "If a metric is expected to increase, this value should be negative, to warn when the metric is decreasing by more than this value.",
161-
"type": ["number", "null"]
191+
"type": [
192+
"number",
193+
"null"
194+
]
162195
},
163196
"numerator": {
164197
"description": "Specify how the numerator of this metric should be aggregated",
165198
"type": "object",
166199
"additionalProperties": false,
167-
"required": ["fact_name", "operation"],
200+
"required": [
201+
"fact_name",
202+
"operation"
203+
],
168204
"properties": {
169205
"fact_name": {
170206
"description": "Must match one of the values in fact_sources.facts.name",
171207
"type": "string"
172208
},
173209
"operation": {
174210
"description": "Which aggregation to apply to the fact",
175-
"enum": ["sum", "count", "distinct_entity", "threshold", "conversion", "retention", "count_distinct", "last_value", "first_value"]
211+
"enum": [
212+
"sum",
213+
"count",
214+
"distinct_entity",
215+
"threshold",
216+
"conversion",
217+
"retention",
218+
"count_distinct",
219+
"last_value",
220+
"first_value"
221+
]
176222
},
177223
"filters": {
178224
"description": "Optional fact property filters to apply",
179225
"type": "array",
180226
"items": {
181227
"type": "object",
182228
"additionalProperties": false,
183-
"required": ["fact_property", "operation", "values"],
229+
"required": [
230+
"fact_property",
231+
"operation",
232+
"values"
233+
],
184234
"properties": {
185235
"fact_property": {
186236
"description": "Must match one of the values in fact_sources.properties.name",
187237
"type": "string"
188238
},
189239
"operation": {
190240
"description": "Either equals or not_equals",
191-
"enum": ["equals", "not_equals"]
241+
"enum": [
242+
"equals",
243+
"not_equals"
244+
]
192245
},
193246
"values": {
194247
"description": "Values to include if operation is 'equals', or exclude if operation is 'not_equals'",
@@ -208,27 +261,46 @@
208261
"description": "Only used if operation = conversion",
209262
"type": "number"
210263
},
264+
"enable_aging_subject_filter": {
265+
"description": "Controls whether subjects (entities) should be filtered out of metric calculations until they have 'aged' for a sufficient period. This is particularly important for metrics that require a certain observation period to be meaningful.",
266+
"type": "boolean"
267+
},
211268
"threshold_metric_settings": {
212269
"description": "Only used if operation = conversion",
213270
"type": "object",
214271
"additionalProperties": false,
215-
"required": ["comparison_operator", "aggregation_type", "breach_value"],
272+
"required": [
273+
"comparison_operator",
274+
"aggregation_type",
275+
"breach_value"
276+
],
216277
"properties": {
217278
"comparison_operator": {
218279
"description": "One of gt or gte",
219-
"enum": ["gt", "gte"]
280+
"enum": [
281+
"gt",
282+
"gte"
283+
]
220284
},
221285
"aggregation_type": {
222286
"description": "One of sum or count",
223-
"enum": ["sum", "count"]
287+
"enum": [
288+
"sum",
289+
"count"
290+
]
224291
},
225292
"breach_value": {
226293
"description": "At what value is the threshold breached?",
227294
"type": "number"
228295
},
229296
"timeframe_unit": {
230297
"description": "What time unit to use: minutes, hours, days, or weeks (optional)",
231-
"enum": ["minutes", "hours", "days", "weeks"]
298+
"enum": [
299+
"minutes",
300+
"hours",
301+
"days",
302+
"weeks"
303+
]
232304
},
233305
"timeframe_value": {
234306
"description": "How many timeframe units since assignment to include (optional)",
@@ -246,7 +318,13 @@
246318
},
247319
"aggregation_timeframe_unit": {
248320
"description": "What time unit to use: minutes, hours, days, or weeks (optional)",
249-
"enum": ["minutes", "hours", "days", "weeks", "calendar_days"]
321+
"enum": [
322+
"minutes",
323+
"hours",
324+
"days",
325+
"weeks",
326+
"calendar_days"
327+
]
250328
},
251329
"winsorization_lower_percentile": {
252330
"description": "Percentile at which to clip aggregated metrics (optional)",
@@ -270,31 +348,48 @@
270348
"description": "For ratio metrics only: specify how the denominator of this metric should be aggregated",
271349
"type": "object",
272350
"additionalProperties": false,
273-
"required": ["fact_name", "operation"],
351+
"required": [
352+
"fact_name",
353+
"operation"
354+
],
274355
"properties": {
275356
"fact_name": {
276357
"description": "Must match one of the values specified in fact_sources.facts.name",
277358
"type": "string"
278359
},
279360
"operation": {
280361
"description": "How to aggregate fact",
281-
"enum": ["sum", "count", "distinct_entity", "count_distinct", "last_value", "first_value"]
362+
"enum": [
363+
"sum",
364+
"count",
365+
"distinct_entity",
366+
"count_distinct",
367+
"last_value",
368+
"first_value"
369+
]
282370
},
283371
"filters": {
284372
"description": "Optional fact property filters to apply",
285373
"type": "array",
286374
"items": {
287375
"type": "object",
288376
"additionalProperties": false,
289-
"required": ["fact_property", "operation", "values"],
377+
"required": [
378+
"fact_property",
379+
"operation",
380+
"values"
381+
],
290382
"properties": {
291383
"fact_property": {
292384
"description": "Must match one of the values in fact_sources.properties.name",
293385
"type": "string"
294386
},
295387
"operation": {
296388
"description": "Either equals or not_equals",
297-
"enum": ["equals", "not_equals"]
389+
"enum": [
390+
"equals",
391+
"not_equals"
392+
]
298393
},
299394
"values": {
300395
"description": "Values to include if operation is 'equals', or exclude if operation is 'not_equals'",
@@ -316,9 +411,15 @@
316411
},
317412
"aggregation_timeframe_unit": {
318413
"description": "What time unit to use: minutes, hours, days, or weeks (optional)",
319-
"enum": ["minutes", "hours", "days", "weeks", "calendar_days"]
414+
"enum": [
415+
"minutes",
416+
"hours",
417+
"days",
418+
"weeks",
419+
"calendar_days"
420+
]
320421
},
321-
"aggregation_enable_aging_subject_filter": {
422+
"enable_aging_subject_filter": {
322423
"description": "Controls whether subjects (entities) should be filtered out of metric calculations until they have 'aged' for a sufficient period. This is particularly important for metrics that require a certain observation period to be meaningful.",
323424
"type": "boolean"
324425
},
@@ -344,7 +445,10 @@
344445
"description": "For percentile metrics only: specify the fact and percentile value",
345446
"type": "object",
346447
"additionalProperties": false,
347-
"required": ["fact_name", "percentile_value"],
448+
"required": [
449+
"fact_name",
450+
"percentile_value"
451+
],
348452
"properties": {
349453
"fact_name": {
350454
"description": "Must match one of the values specified in fact_sources.facts.name",
@@ -362,15 +466,22 @@
362466
"items": {
363467
"type": "object",
364468
"additionalProperties": false,
365-
"required": ["fact_property", "operation", "values"],
469+
"required": [
470+
"fact_property",
471+
"operation",
472+
"values"
473+
],
366474
"properties": {
367475
"fact_property": {
368476
"description": "Must match one of the values in fact_sources.properties.name",
369477
"type": "string"
370478
},
371479
"operation": {
372480
"description": "Either equals or not_equals",
373-
"enum": ["equals", "not_equals"]
481+
"enum": [
482+
"equals",
483+
"not_equals"
484+
]
374485
},
375486
"values": {
376487
"description": "Values to include if operation is 'equals', or exclude if operation is 'not_equals'",
@@ -388,4 +499,4 @@
388499
}
389500
}
390501
}
391-
}
502+
}

0 commit comments

Comments
 (0)