You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(features): add Custom Expression toggle to meter creation
Adds a "+ Custom Expression" button alongside the existing aggregation
options that swaps the "Aggregation Field" input for a "Custom Expression"
(CEL formula) input. Mutually exclusive at the UI level — toggling clears
the inactive side's value so the request body never carries both. Only
shown for SUM, AVG, MAX, LATEST (matches the backend's SupportsExpression
classifier).
Help text under the Custom Expression input lists the available math
functions (max, min, abs, ceil, floor, round, pow, sqrt, log) and four
example formulas. EN + AR locales updated.
Copy file name to clipboardExpand all lines: src/i18n/locales/ar/catalog.json
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -732,6 +732,11 @@
732
732
"aggregationFieldPh": "tokens",
733
733
"aggregationFieldHelp": "حدد الخاصية في بيانات الحدث التي ستُجمَّع، مثل tokens وmessages_sent وstorage_used.",
734
734
"aggregationMultiplier": "مضاعف التجميع*",
735
+
"customExpressionButton": "تعبير مخصص",
736
+
"aggregationFieldButton": "حقل التجميع",
737
+
"customExpression": "تعبير مخصص*",
738
+
"customExpressionPh": "ceil(duration_ms / 1000)",
739
+
"customExpressionHelp": "اكتب صيغة CEL تُحسب لكل حدث لحساب الكمية. المتغيرات هي أسماء الخصائص ذات المستوى الأعلى في الأحداث (مثل duration_ms وtokens). الدوال المتاحة: max(a, b)، min(a, b)، abs(x)، ceil(x)، floor(x)، round(x)، pow(x, y)، sqrt(x)، log(x). أمثلة: \"input_tokens + output_tokens\"، \"ceil(duration_ms / 1000)\"، \"min(usage, quota)\". متاح فقط لـ SUM وAVG وMAX وLATEST.",
735
740
"aggregationMultiplierPh": "1",
736
741
"aggregationMultiplierHelp": "حدد المضاعف للتجميع، مثل 1.5 أو 0.25 أو 1000.",
Copy file name to clipboardExpand all lines: src/i18n/locales/en/catalog.json
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -731,6 +731,11 @@
731
731
"aggregationField": "Aggregation Field*",
732
732
"aggregationFieldPh": "tokens",
733
733
"aggregationFieldHelp": "Specify the property in the event data that will be aggregated. e.g. tokens, messages_sent, storage_used.",
734
+
"customExpressionButton": "Custom expression",
735
+
"aggregationFieldButton": "Aggregation field",
736
+
"customExpression": "Custom Expression*",
737
+
"customExpressionPh": "ceil(duration_ms / 1000)",
738
+
"customExpressionHelp": "Write a CEL formula evaluated per event to compute the quantity. Variables are top-level property names on your events (e.g. duration_ms, tokens). Available functions: max(a, b), min(a, b), abs(x), ceil(x), floor(x), round(x), pow(x, y), sqrt(x), log(x). Examples: \"input_tokens + output_tokens\", \"ceil(duration_ms / 1000)\", \"min(usage, quota)\", \"max(cores * hours * rate, 0.01)\". Only available for SUM, AVG, MAX and LATEST.",
0 commit comments