feat: fixed reduceTo not working

This commit is contained in:
SagarRajput-7 2025-07-15 14:08:45 +05:30
parent 3a623fef8f
commit 6ed78e8a4d
2 changed files with 8 additions and 4 deletions

View File

@ -163,6 +163,7 @@ export function parseAggregations(
export function createAggregation(
queryData: any,
panelType?: PANEL_TYPES,
): TraceAggregation[] | LogAggregation[] | MetricAggregation[] {
if (!queryData) {
return [];
@ -170,9 +171,10 @@ export function createAggregation(
const haveReduceTo =
queryData.dataSource === DataSource.METRICS &&
(queryData.panelType === PANEL_TYPES.TABLE ||
queryData.panelType === PANEL_TYPES.PIE ||
queryData.panelType === PANEL_TYPES.VALUE);
panelType &&
(panelType === PANEL_TYPES.TABLE ||
panelType === PANEL_TYPES.PIE ||
panelType === PANEL_TYPES.VALUE);
if (queryData.dataSource === DataSource.METRICS) {
return [
@ -219,7 +221,7 @@ function convertBuilderQueriesToV5(
const baseSpec = createBaseSpec(queryData, requestType, panelType);
let spec: QueryEnvelope['spec'];
const aggregations = createAggregation(queryData);
const aggregations = createAggregation(queryData, panelType);
switch (signal) {
case 'traces':

View File

@ -1,6 +1,7 @@
/* eslint-disable sonarjs/cognitive-complexity */
import { ColumnsType, ColumnType } from 'antd/es/table';
import { createAggregation } from 'api/v5/queryRange/prepareQueryRangePayloadV5';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { convertUnit } from 'container/NewWidget/RightContainer/dataFormatCategories';
import { ThresholdProps } from 'container/NewWidget/RightContainer/Threshold/types';
import { QUERY_TABLE_CONFIG } from 'container/QueryTable/config';
@ -191,6 +192,7 @@ export function createColumnsAndDataSource(
(query) => query.queryName === item.queryName,
)
: undefined,
PANEL_TYPES.TABLE,
)?.length > 1;
const column: ColumnType<RowData> = {