fix: Update Services Dashboard count() queries to correctly use MVs (#1473)

Closes HDX-3057

This PR updates the Request Error Rate query config so that it can correctly leverage materialized views.
This commit is contained in:
Drew Davis 2025-12-15 09:32:43 -05:00 committed by GitHub
parent 96f0539e7a
commit 19b710fb68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
"@hyperdx/app": patch
---
fix: Update Request Error Rate config to use MVs

View file

@ -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 && (
<DBTimeChart
sourceId={source.id}
hiddenSeries={['total_requests', 'error_requests']}
config={requestErrorRateConfig}
showDisplaySwitcher={false}
disableQueryChunking
@ -1278,7 +1292,8 @@ function ErrorsTab({
displayType: DisplayType.StackedBar,
select: [
{
valueExpression: `count()`,
valueExpression: '',
aggFn: 'count',
},
],
numberFormat: INTEGER_NUMBER_FORMAT,