diff --git a/.changeset/quick-insects-shop.md b/.changeset/quick-insects-shop.md new file mode 100644 index 000000000..e24fe2e77 --- /dev/null +++ b/.changeset/quick-insects-shop.md @@ -0,0 +1,5 @@ +--- +"@hyperdx/app": patch +--- + +fix: Update Request Error Rate config to use MVs diff --git a/packages/app/src/ServicesDashboardPage.tsx b/packages/app/src/ServicesDashboardPage.tsx index a8f74a95c..b3f9b929b 100644 --- a/packages/app/src/ServicesDashboardPage.tsx +++ b/packages/app/src/ServicesDashboardPage.tsx @@ -342,8 +342,21 @@ function HttpTab({ whereLanguage: appliedConfig.whereLanguage || 'sql', displayType: DisplayType.Line, select: [ + // Separate the aggregations from the rate calculation so that AggregatingMergeTree MVs can be used { - valueExpression: `countIf(${expressions.isError}) / count()`, + valueExpression: '', + aggFn: 'count', + alias: 'total_requests', + }, + { + valueExpression: '', + aggFn: 'count', + aggCondition: expressions.isError, + aggConditionLanguage: 'sql', + alias: 'error_requests', + }, + { + valueExpression: `error_requests / total_requests`, alias: 'error_rate', }, ], @@ -502,6 +515,7 @@ function HttpTab({ {source && requestErrorRateConfig && (