mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
parent
29e8f37d00
commit
9c5c2396fa
2 changed files with 12 additions and 1 deletions
5
.changeset/forty-mails-deliver.md
Normal file
5
.changeset/forty-mails-deliver.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@hyperdx/common-utils": patch
|
||||
---
|
||||
|
||||
fix: handle 'filters' config (metrics)
|
||||
|
|
@ -799,7 +799,7 @@ async function translateMetricChartConfig(
|
|||
}
|
||||
|
||||
// assumes all the selects are from a single metric type, for now
|
||||
const { select, from, ...restChartConfig } = chartConfig;
|
||||
const { select, from, filters, where, ...restChartConfig } = chartConfig;
|
||||
if (!select || !Array.isArray(select)) {
|
||||
throw new Error('multi select or string select on metrics not supported');
|
||||
}
|
||||
|
|
@ -824,6 +824,7 @@ async function translateMetricChartConfig(
|
|||
tableName: metricTables[MetricsDataType.Gauge],
|
||||
},
|
||||
filters: [
|
||||
...(filters ?? []),
|
||||
{
|
||||
type: 'sql',
|
||||
condition: `MetricName = '${metricName}'`,
|
||||
|
|
@ -874,6 +875,7 @@ async function translateMetricChartConfig(
|
|||
databaseName: '',
|
||||
tableName: 'Bucketed',
|
||||
},
|
||||
where: '', // clear up the condition since the where clause is already applied at the upstream CTE
|
||||
timestampValueExpression: timeBucketCol,
|
||||
};
|
||||
} else if (metricType === MetricsDataType.Sum && metricName) {
|
||||
|
|
@ -899,6 +901,7 @@ async function translateMetricChartConfig(
|
|||
tableName: metricTables[MetricsDataType.Gauge],
|
||||
},
|
||||
filters: [
|
||||
...(filters ?? []),
|
||||
{
|
||||
type: 'sql',
|
||||
condition: `MetricName = '${metricName}'`,
|
||||
|
|
@ -971,6 +974,7 @@ async function translateMetricChartConfig(
|
|||
databaseName: '',
|
||||
tableName: 'Bucketed',
|
||||
},
|
||||
where: '', // clear up the condition since the where clause is already applied at the upstream CTE
|
||||
timestampValueExpression: `\`${timeBucketCol}\``,
|
||||
};
|
||||
} else if (metricType === MetricsDataType.Histogram && metricName) {
|
||||
|
|
@ -995,6 +999,7 @@ async function translateMetricChartConfig(
|
|||
tableName: metricTables[MetricsDataType.Histogram],
|
||||
},
|
||||
filters: [
|
||||
...(filters ?? []),
|
||||
{
|
||||
type: 'sql',
|
||||
condition: `MetricName = '${metricName}'`,
|
||||
|
|
@ -1059,6 +1064,7 @@ async function translateMetricChartConfig(
|
|||
databaseName: '',
|
||||
tableName: 'RawHist',
|
||||
},
|
||||
where: '', // clear up the condition since the where clause is already applied at the upstream CTE
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue