:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(metrics): add min and max aggregations (#89791)
Daniel Visca42bd0f294011
diff --git a/products/metrics/backend/facade/api.py b/products/metrics/backend/facade/api.pyindex be6759760f31..00c5e731e715 100644--- a/products/metrics/backend/facade/api.py+++ b/products/metrics/backend/facade/api.py@@ -49,6 +49,8 @@ _RUNNER_AGGREGATIONS: dict[MetricAggregation, str] = {MetricAggregation.SUM: "sum",MetricAggregation.AVG: "avg",MetricAggregation.COUNT: "count",+ MetricAggregation.MIN: "min",+ MetricAggregation.MAX: "max",MetricAggregation.RATE: "rate",MetricAggregation.INCREASE: "increase",}diff --git a/products/metrics/backend/facade/enums.py b/products/metrics/backend/facade/enums.pyindex e94775f6ac66..39ec8c0e0ec7 100644--- a/products/metrics/backend/facade/enums.py+++ b/products/metrics/backend/facade/enums.py@@ -60,10 +60,9 @@ class MetricAggregation(StrEnum):Instant aggregations take each series' last sample in the bucket andcombine those: SUM is the total across series, AVG and QUANTILE arecomputed over series, COUNT is how many series reported, and MIN and MAX- are the smallest and largest last sample across series. MIN and MAX still- need the per-series step once they are implemented, because taken over raw- samples they would report a stale within-bucket extreme rather than the- current cross-series one.+ are the smallest and largest last sample across series. The per-series step+ matters most for MIN and MAX: taken over raw samples they would report a+ stale within-bucket extreme rather than the current cross-series one.Counter functions operate on the change across the bucket (cumulativecounters get reset-corrected; deltas are summed): RATE, INCREASE.diff --git a/products/metrics/backend/metric_query_runner.py b/products/metrics/backend/metric_query_runner.pyindex ea81e0b3b2d6..08ae5c919658 100644--- a/products/metrics/backend/metric_query_runner.py+++ b/products/metrics/backend/metric_query_runner.py@@ -173,6 +173,10 @@ def _aggregation_expr(name: str, value: ast.Expr) -> ast.Expr:return ast.Call(name="avg", args=[value])if name == "count":return ast.Call(name="count", args=[])+ if name == "min":+ return ast.Call(name="min", args=[value])+ if name == "max":+ return ast.Call(name="max", args=[value])if name == "p95":return ast.Call(name="quantile", params=[ast.Constant(value=0.95)], args=[value])raise ValueError(f"Unsupported aggregation: {name!r}")@@ -189,7 +193,7 @@ def _finite_or_none(value: float | None) -> float | None:_ALLOWED_AGGREGATIONS: frozenset[str] = frozenset(- {"sum", "avg", "count", "p95", "rate", "increase", "histogram_quantile"}+ {"sum", "avg", "count", "min", "max", "p95", "rate", "increase", "histogram_quantile"})# Derived from the contract enum (whose values match what the ingest writes,diff --git a/products/metrics/backend/presentation/api.py b/products/metrics/backend/presentation/api.pyindex 1975df6f0b13..48f2a46661dc 100644--- a/products/metrics/backend/presentation/api.py+++ b/products/metrics/backend/presentation/api.py@@ -115,7 +115,7 @@ class _MetricClauseSerializer(serializers.Serializer):help_text="Constrain the query to one metric type. A name can exist as several types (e.g. a counter and a gauge); without this, rows of every type sharing the name are blended into one aggregate. Get the type from 'metric-names-list'.",)aggregation = serializers.ChoiceField(- choices=["sum", "avg", "count", "p95", "rate", "increase", "histogram_quantile"],+ choices=["sum", "avg", "count", "min", "max", "p95", "rate", "increase", "histogram_quantile"],default="sum",help_text="Aggregation applied per time bucket; same semantics as the top-level aggregation.",)@@ -164,9 +164,9 @@ class _MetricQueryBodySerializer(serializers.Serializer):help_text="Constrain the query to one metric type. A name can exist as several types (e.g. a counter and a gauge); without this, rows of every type sharing the name are blended into one aggregate. Get the type from 'metric-names-list'.",)aggregation = serializers.ChoiceField(- choices=["sum", "avg", "count", "p95", "rate", "increase", "histogram_quantile"],+ choices=["sum", "avg", "count", "min", "max", "p95", "rate", "increase", "histogram_quantile"],default="sum",- help_text="Aggregation applied per time bucket, always across series rather than across raw samples. 'sum', 'avg' and 'p95' reduce each series to its last sample in the bucket and then combine those, so the result does not scale with the scrape rate; 'count' is the number of series that reported. 'rate' (per-second) and 'increase' are counter-aware: per-series deltas with Prometheus counter-reset handling, temporality-aware (delta-temporality samples count as-is). 'histogram_quantile' interpolates from OTel histogram buckets and requires 'quantile'.",+ help_text="Aggregation applied per time bucket, always across series rather than across raw samples. 'sum', 'avg', 'min', 'max' and 'p95' reduce each series to its last sample in the bucket and then combine those, so the result does not scale with the scrape rate; 'count' is the number of series that reported. 'rate' (per-second) and 'increase' are counter-aware: per-series deltas with Prometheus counter-reset handling, temporality-aware (delta-temporality samples count as-is). 'histogram_quantile' interpolates from OTel histogram buckets and requires 'quantile'.",)quantile = serializers.FloatField(required=False,@@ -316,7 +316,7 @@ class _MetricAnomalyBodySerializer(serializers.Serializer):help_text="End of the healthy comparison window. Defaults to anomalyFrom. Must not extend past anomalyFrom.",)aggregation = serializers.ChoiceField(- choices=["sum", "avg", "count", "p95", "rate", "increase", "histogram_quantile"],+ choices=["sum", "avg", "count", "min", "max", "p95", "rate", "increase", "histogram_quantile"],required=False,allow_null=True,help_text="Aggregation to characterize. Omit to auto-pick from the metric's OTel type (counter -> rate, gauge -> avg, histogram -> histogram_quantile 0.95).",@@ -703,7 +703,7 @@ class _MetricExplainBodySerializer(serializers.Serializer):help_text="Constrain the bucket to one metric type. A name can exist as several types; without this, rows of every type sharing the name are decomposed together.",)aggregation = serializers.ChoiceField(- choices=["sum", "avg", "count", "p95", "rate", "increase", "histogram_quantile"],+ choices=["sum", "avg", "count", "min", "max", "p95", "rate", "increase", "histogram_quantile"],default="sum",help_text="The aggregation whose result should be explained. 'histogram_quantile' is rejected: it reduces bucket-count arrays rather than scalar samples, so there is no per-series value to lay out.",)diff --git a/products/metrics/backend/tests/test_metric_query_runner.py b/products/metrics/backend/tests/test_metric_query_runner.pyindex 5b7c2bf2d207..ce25b731d36a 100644--- a/products/metrics/backend/tests/test_metric_query_runner.py+++ b/products/metrics/backend/tests/test_metric_query_runner.py@@ -223,6 +223,10 @@ class TestMetricQueryRunner(ClickhouseTestMixin, APIBaseTest):("avg", 16.5),# Counting raw samples would give 6.("count", 2.0),+ # The discriminating case for min: over raw samples this is 1.0, series a's+ # stale first sample, rather than the smallest current reading across series.+ ("min", 3.0),+ ("max", 30.0),])def test_aggregations_run_across_series_not_samples(self, aggregation: str, expected: float):@@ -607,8 +611,14 @@ class TestRunMetricQueryFacade(ClickhouseTestMixin, APIBaseTest):@parameterized.expand([(- "unsupported_aggregation",- {"clauses": (MetricQueryClause(name="a", metric_name="m1", aggregation=MetricAggregation.MIN),)},+ "quantile_other_than_p95",+ {+ "clauses": (+ MetricQueryClause(+ name="a", metric_name="m1", aggregation=MetricAggregation.QUANTILE, quantile=0.5+ ),+ )+ },),])diff --git a/products/metrics/frontend/components/MetricsFundamentals.tsx b/products/metrics/frontend/components/MetricsFundamentals.tsxindex 77cccd415d5c..c80326c6fe29 100644--- a/products/metrics/frontend/components/MetricsFundamentals.tsx+++ b/products/metrics/frontend/components/MetricsFundamentals.tsx@@ -76,6 +76,8 @@ const AGGREGATION_OPTIONS: { value: MetricAggregation; label: string }[] = [{ value: 'sum', label: 'Sum' },{ value: 'avg', label: 'Average' },{ value: 'count', label: 'Count' },+ { value: 'min', label: 'Min' },+ { value: 'max', label: 'Max' },{ value: 'p95', label: 'p95' },{ value: 'rate', label: 'Rate (/s)' },{ value: 'increase', label: 'Increase' },diff --git a/products/metrics/frontend/components/MetricsViewer.tsx b/products/metrics/frontend/components/MetricsViewer.tsxindex 94ff2a9dd5ff..01836539309b 100644--- a/products/metrics/frontend/components/MetricsViewer.tsx+++ b/products/metrics/frontend/components/MetricsViewer.tsx@@ -76,6 +76,8 @@ const AGGREGATION_OPTIONS: { value: MetricAggregation; label: string }[] = [{ value: 'sum', label: 'Sum' },{ value: 'avg', label: 'Average' },{ value: 'count', label: 'Series count' },+ { value: 'min', label: 'Min' },+ { value: 'max', label: 'Max' },{ value: 'p95', label: 'p95' },{ value: 'rate', label: 'Rate (/s)' },{ value: 'increase', label: 'Increase' },diff --git a/products/metrics/frontend/components/metricsViewerLogic.tsx b/products/metrics/frontend/components/metricsViewerLogic.tsxindex 75162ead0182..f6b9aa749b21 100644--- a/products/metrics/frontend/components/metricsViewerLogic.tsx+++ b/products/metrics/frontend/components/metricsViewerLogic.tsx@@ -57,8 +57,8 @@ import type { MetricsChartSeries } from './metricsSeries'// A derived type ((typeof METRIC_AGGREGATIONS)[number]) would keep these in sync, but// kea-typegen inlines derived unions into every consumer's generated block — keep the// named alias so those blocks stay stable.-export type MetricAggregation = 'sum' | 'avg' | 'count' | 'p95' | 'rate' | 'increase'-export const METRIC_AGGREGATIONS: MetricAggregation[] = ['sum', 'avg', 'count', 'p95', 'rate', 'increase']+export type MetricAggregation = 'sum' | 'avg' | 'count' | 'min' | 'max' | 'p95' | 'rate' | 'increase'+export const METRIC_AGGREGATIONS: MetricAggregation[] = ['sum', 'avg', 'count', 'min', 'max', 'p95', 'rate', 'increase']/** Narrows an untrusted value (a URL param, a saved link) to an aggregation the backend accepts. */export const isMetricAggregation = (value: unknown): value is MetricAggregation =>diff --git a/products/metrics/frontend/generated/api.schemas.ts b/products/metrics/frontend/generated/api.schemas.tsindex d9efaa176203..e09a6dc01cd6 100644--- a/products/metrics/frontend/generated/api.schemas.ts+++ b/products/metrics/frontend/generated/api.schemas.ts@@ -53,6 +53,8 @@ export interface _MetricAttributeKeysResponseApi {* * `sum` - sum* * `avg` - avg* * `count` - count+ * * `min` - min+ * * `max` - max* * `p95` - p95* * `rate` - rate* * `increase` - increase@@ -64,6 +66,8 @@ export const AggregationEnumApi = {Sum: 'sum',Avg: 'avg',Count: 'count',+ Min: 'min',+ Max: 'max',P95: 'p95',Rate: 'rate',Increase: 'increase',@@ -143,6 +147,8 @@ export interface _MetricAnomalyBodyApi {* * `sum` - sum* * `avg` - avg* * `count` - count+ * * `min` - min+ * * `max` - max* * `p95` - p95* * `rate` - rate* * `increase` - increase@@ -346,6 +352,8 @@ export interface _MetricExplainBodyApi {* * `sum` - sum* * `avg` - avg* * `count` - count+ * * `min` - min+ * * `max` - max* * `p95` - p95* * `rate` - rate* * `increase` - increase@@ -588,6 +596,8 @@ export interface _MetricClauseApi {* * `sum` - sum* * `avg` - avg* * `count` - count+ * * `min` - min+ * * `max` - max* * `p95` - p95* * `rate` - rate* * `increase` - increase@@ -620,11 +630,13 @@ export interface _MetricQueryBodyApi {* * `exponential_histogram` - exponential_histogram* * `summary` - summary */metricType?: OtelMetricTypeEnumApi | null- /** Aggregation applied per time bucket, always across series rather than across raw samples. 'sum', 'avg' and 'p95' reduce each series to its last sample in the bucket and then combine those, so the result does not scale with the scrape rate; 'count' is the number of series that reported. 'rate' (per-second) and 'increase' are counter-aware: per-series deltas with Prometheus counter-reset handling, temporality-aware (delta-temporality samples count as-is). 'histogram_quantile' interpolates from OTel histogram buckets and requires 'quantile'.+ /** Aggregation applied per time bucket, always across series rather than across raw samples. 'sum', 'avg', 'min', 'max' and 'p95' reduce each series to its last sample in the bucket and then combine those, so the result does not scale with the scrape rate; 'count' is the number of series that reported. 'rate' (per-second) and 'increase' are counter-aware: per-series deltas with Prometheus counter-reset handling, temporality-aware (delta-temporality samples count as-is). 'histogram_quantile' interpolates from OTel histogram buckets and requires 'quantile'.** * `sum` - sum* * `avg` - avg* * `count` - count+ * * `min` - min+ * * `max` - max* * `p95` - p95* * `rate` - rate* * `increase` - increasediff --git a/products/metrics/frontend/generated/api.zod.ts b/products/metrics/frontend/generated/api.zod.tsindex 9ad64f679519..570d1f5e949a 100644--- a/products/metrics/frontend/generated/api.zod.ts+++ b/products/metrics/frontend/generated/api.zod.ts@@ -57,15 +57,15 @@ export const MetricsCharacterizeCreateBody = /* @__PURE__ */ zod.object({aggregation: zod.union([zod- .enum(['sum', 'avg', 'count', 'p95', 'rate', 'increase', 'histogram_quantile'])+ .enum(['sum', 'avg', 'count', 'min', 'max', 'p95', 'rate', 'increase', 'histogram_quantile']).describe(- '\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile'+ '\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `min` - min\n\* `max` - max\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile'),zod.null(),]).optional().describe(- "Aggregation to characterize. Omit to auto-pick from the metric's OTel type (counter -> rate, gauge -> avg, histogram -> histogram_quantile 0.95).\n\n\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile"+ "Aggregation to characterize. Omit to auto-pick from the metric's OTel type (counter -> rate, gauge -> avg, histogram -> histogram_quantile 0.95).\n\n\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `min` - min\n\* `max` - max\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile"),quantile: zod.number()@@ -153,13 +153,13 @@ export const MetricsExplainCreateBody = /* @__PURE__ */ zod.object({'Constrain the bucket to one metric type. A name can exist as several types; without this, rows of every type sharing the name are decomposed together.\n\n\* `gauge` - gauge\n\* `sum` - sum\n\* `histogram` - histogram\n\* `exponential_histogram` - exponential_histogram\n\* `summary` - summary'),aggregation: zod- .enum(['sum', 'avg', 'count', 'p95', 'rate', 'increase', 'histogram_quantile'])+ .enum(['sum', 'avg', 'count', 'min', 'max', 'p95', 'rate', 'increase', 'histogram_quantile']).describe(- '\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile'+ '\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `min` - min\n\* `max` - max\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile').default(metricsExplainCreateBodyQueryOneAggregationDefault).describe(- "The aggregation whose result should be explained. 'histogram_quantile' is rejected: it reduces bucket-count arrays rather than scalar samples, so there is no per-series value to lay out.\n\n\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile"+ "The aggregation whose result should be explained. 'histogram_quantile' is rejected: it reduces bucket-count arrays rather than scalar samples, so there is no per-series value to lay out.\n\n\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `min` - min\n\* `max` - max\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile"),quantile: zod.number()@@ -271,13 +271,13 @@ export const MetricsQueryCreateBody = /* @__PURE__ */ zod.object({"Constrain the query to one metric type. A name can exist as several types (e.g. a counter and a gauge); without this, rows of every type sharing the name are blended into one aggregate. Get the type from 'metric-names-list'.\n\n\* `gauge` - gauge\n\* `sum` - sum\n\* `histogram` - histogram\n\* `exponential_histogram` - exponential_histogram\n\* `summary` - summary"),aggregation: zod- .enum(['sum', 'avg', 'count', 'p95', 'rate', 'increase', 'histogram_quantile'])+ .enum(['sum', 'avg', 'count', 'min', 'max', 'p95', 'rate', 'increase', 'histogram_quantile']).describe(- '\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile'+ '\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `min` - min\n\* `max` - max\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile').default(metricsQueryCreateBodyQueryOneAggregationDefault).describe(- "Aggregation applied per time bucket, always across series rather than across raw samples. 'sum', 'avg' and 'p95' reduce each series to its last sample in the bucket and then combine those, so the result does not scale with the scrape rate; 'count' is the number of series that reported. 'rate' (per-second) and 'increase' are counter-aware: per-series deltas with Prometheus counter-reset handling, temporality-aware (delta-temporality samples count as-is). 'histogram_quantile' interpolates from OTel histogram buckets and requires 'quantile'.\n\n\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile"+ "Aggregation applied per time bucket, always across series rather than across raw samples. 'sum', 'avg', 'min', 'max' and 'p95' reduce each series to its last sample in the bucket and then combine those, so the result does not scale with the scrape rate; 'count' is the number of series that reported. 'rate' (per-second) and 'increase' are counter-aware: per-series deltas with Prometheus counter-reset handling, temporality-aware (delta-temporality samples count as-is). 'histogram_quantile' interpolates from OTel histogram buckets and requires 'quantile'.\n\n\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `min` - min\n\* `max` - max\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile"),quantile: zod.number()@@ -374,13 +374,23 @@ export const MetricsQueryCreateBody = /* @__PURE__ */ zod.object({"Constrain the query to one metric type. A name can exist as several types (e.g. a counter and a gauge); without this, rows of every type sharing the name are blended into one aggregate. Get the type from 'metric-names-list'.\n\n\* `gauge` - gauge\n\* `sum` - sum\n\* `histogram` - histogram\n\* `exponential_histogram` - exponential_histogram\n\* `summary` - summary"),aggregation: zod- .enum(['sum', 'avg', 'count', 'p95', 'rate', 'increase', 'histogram_quantile'])+ .enum([+ 'sum',+ 'avg',+ 'count',+ 'min',+ 'max',+ 'p95',+ 'rate',+ 'increase',+ 'histogram_quantile',+ ]).describe(- '\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile'+ '\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `min` - min\n\* `max` - max\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile').default(metricsQueryCreateBodyQueryOneClausesItemAggregationDefault).describe(- 'Aggregation applied per time bucket; same semantics as the top-level aggregation.\n\n\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile'+ 'Aggregation applied per time bucket; same semantics as the top-level aggregation.\n\n\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `min` - min\n\* `max` - max\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile'),quantile: zod.number()diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 008a6cf7f8af..f696da2d9978 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -9329,6 +9329,8 @@ export namespace Schemas {* * `sum` - sum* * `avg` - avg* * `count` - count+ * * `min` - min+ * * `max` - max* * `p95` - p95* * `rate` - rate* * `increase` - increase@@ -9341,6 +9343,8 @@ export namespace Schemas {Sum: 'sum',Avg: 'avg',Count: 'count',+ Min: 'min',+ Max: 'max',P95: 'p95',Rate: 'rate',Increase: 'increase',@@ -88811,6 +88815,8 @@ export namespace Schemas {* * `sum` - sum* * `avg` - avg* * `count` - count+ * * `min` - min+ * * `max` - max* * `p95` - p95* * `rate` - rate* * `increase` - increase@@ -89083,6 +89089,8 @@ export namespace Schemas {* * `sum` - sum* * `avg` - avg* * `count` - count+ * * `min` - min+ * * `max` - max* * `p95` - p95* * `rate` - rate* * `increase` - increase@@ -89176,6 +89184,8 @@ export namespace Schemas {* * `sum` - sum* * `avg` - avg* * `count` - count+ * * `min` - min+ * * `max` - max* * `p95` - p95* * `rate` - rate* * `increase` - increase@@ -89241,11 +89251,13 @@ export namespace Schemas {* * `exponential_histogram` - exponential_histogram* * `summary` - summary */metricType?: OtelMetricTypeEnum | null;- /** Aggregation applied per time bucket, always across series rather than across raw samples. 'sum', 'avg' and 'p95' reduce each series to its last sample in the bucket and then combine those, so the result does not scale with the scrape rate; 'count' is the number of series that reported. 'rate' (per-second) and 'increase' are counter-aware: per-series deltas with Prometheus counter-reset handling, temporality-aware (delta-temporality samples count as-is). 'histogram_quantile' interpolates from OTel histogram buckets and requires 'quantile'.+ /** Aggregation applied per time bucket, always across series rather than across raw samples. 'sum', 'avg', 'min', 'max' and 'p95' reduce each series to its last sample in the bucket and then combine those, so the result does not scale with the scrape rate; 'count' is the number of series that reported. 'rate' (per-second) and 'increase' are counter-aware: per-series deltas with Prometheus counter-reset handling, temporality-aware (delta-temporality samples count as-is). 'histogram_quantile' interpolates from OTel histogram buckets and requires 'quantile'.** * `sum` - sum* * `avg` - avg* * `count` - count+ * * `min` - min+ * * `max` - max* * `p95` - p95* * `rate` - rate* * `increase` - increasediff --git a/services/mcp/src/generated/metrics/api.ts b/services/mcp/src/generated/metrics/api.tsindex 9398360d2453..b802a35979e0 100644--- a/services/mcp/src/generated/metrics/api.ts+++ b/services/mcp/src/generated/metrics/api.ts@@ -64,15 +64,15 @@ export const MetricsCharacterizeCreateBody = () => zod.object({aggregation: zod.union([zod- .enum(['sum', 'avg', 'count', 'p95', 'rate', 'increase', 'histogram_quantile'])+ .enum(['sum', 'avg', 'count', 'min', 'max', 'p95', 'rate', 'increase', 'histogram_quantile']).describe(- '\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile'+ '\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `min` - min\n\* `max` - max\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile'),zod.null(),]).optional().describe(- "Aggregation to characterize. Omit to auto-pick from the metric's OTel type (counter -> rate, gauge -> avg, histogram -> histogram_quantile 0.95).\n\n\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile"+ "Aggregation to characterize. Omit to auto-pick from the metric's OTel type (counter -> rate, gauge -> avg, histogram -> histogram_quantile 0.95).\n\n\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `min` - min\n\* `max` - max\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile"),quantile: zod.number()@@ -187,13 +187,13 @@ export const MetricsQueryCreateBody = () => zod.object({"Constrain the query to one metric type. A name can exist as several types (e.g. a counter and a gauge); without this, rows of every type sharing the name are blended into one aggregate. Get the type from 'metric-names-list'.\n\n\* `gauge` - gauge\n\* `sum` - sum\n\* `histogram` - histogram\n\* `exponential_histogram` - exponential_histogram\n\* `summary` - summary"),aggregation: zod- .enum(['sum', 'avg', 'count', 'p95', 'rate', 'increase', 'histogram_quantile'])+ .enum(['sum', 'avg', 'count', 'min', 'max', 'p95', 'rate', 'increase', 'histogram_quantile']).describe(- '\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile'+ '\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `min` - min\n\* `max` - max\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile').default(metricsQueryCreateBodyQueryOneAggregationDefault).describe(- "Aggregation applied per time bucket, always across series rather than across raw samples. 'sum', 'avg' and 'p95' reduce each series to its last sample in the bucket and then combine those, so the result does not scale with the scrape rate; 'count' is the number of series that reported. 'rate' (per-second) and 'increase' are counter-aware: per-series deltas with Prometheus counter-reset handling, temporality-aware (delta-temporality samples count as-is). 'histogram_quantile' interpolates from OTel histogram buckets and requires 'quantile'.\n\n\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile"+ "Aggregation applied per time bucket, always across series rather than across raw samples. 'sum', 'avg', 'min', 'max' and 'p95' reduce each series to its last sample in the bucket and then combine those, so the result does not scale with the scrape rate; 'count' is the number of series that reported. 'rate' (per-second) and 'increase' are counter-aware: per-series deltas with Prometheus counter-reset handling, temporality-aware (delta-temporality samples count as-is). 'histogram_quantile' interpolates from OTel histogram buckets and requires 'quantile'.\n\n\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `min` - min\n\* `max` - max\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile"),quantile: zod.number()@@ -290,13 +290,23 @@ export const MetricsQueryCreateBody = () => zod.object({"Constrain the query to one metric type. A name can exist as several types (e.g. a counter and a gauge); without this, rows of every type sharing the name are blended into one aggregate. Get the type from 'metric-names-list'.\n\n\* `gauge` - gauge\n\* `sum` - sum\n\* `histogram` - histogram\n\* `exponential_histogram` - exponential_histogram\n\* `summary` - summary"),aggregation: zod- .enum(['sum', 'avg', 'count', 'p95', 'rate', 'increase', 'histogram_quantile'])+ .enum([+ 'sum',+ 'avg',+ 'count',+ 'min',+ 'max',+ 'p95',+ 'rate',+ 'increase',+ 'histogram_quantile',+ ]).describe(- '\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile'+ '\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `min` - min\n\* `max` - max\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile').default(metricsQueryCreateBodyQueryOneClausesItemAggregationDefault).describe(- 'Aggregation applied per time bucket; same semantics as the top-level aggregation.\n\n\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile'+ 'Aggregation applied per time bucket; same semantics as the top-level aggregation.\n\n\* `sum` - sum\n\* `avg` - avg\n\* `count` - count\n\* `min` - min\n\* `max` - max\n\* `p95` - p95\n\* `rate` - rate\n\* `increase` - increase\n\* `histogram_quantile` - histogram_quantile'),quantile: zod.number()