SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
chore: fix legends representation in non-metric non-qb queries (#9351)
Amlan Kumar Nandyb8cf0a304107
diff --git a/frontend/src/container/PanelWrapper/__tests__/legendScroll.test.ts b/frontend/src/container/PanelWrapper/__tests__/legendScroll.test.tsindex d0ea1f40e6..3b1cbef81e 100644--- a/frontend/src/container/PanelWrapper/__tests__/legendScroll.test.ts+++ b/frontend/src/container/PanelWrapper/__tests__/legendScroll.test.ts@@ -1,4 +1,5 @@/* eslint-disable sonarjs/no-duplicate-string */+import { initialQueriesMap } from 'constants/queryBuilder';import { getUPlotChartOptions } from 'lib/uPlotLib/getUplotChartOptions';import { LegendPosition } from 'types/api/dashboard/getAll';@@ -62,6 +63,7 @@ const baseOptions = {legendPosition: LegendPosition.BOTTOM,softMin: null,softMax: null,+ query: initialQueriesMap.metrics,};describe('Legend Scroll Position Preservation', () => {diff --git a/frontend/src/lib/dashboard/getQueryResults.ts b/frontend/src/lib/dashboard/getQueryResults.tsindex 517bd38f9f..49d2abc3d2 100644--- a/frontend/src/lib/dashboard/getQueryResults.ts+++ b/frontend/src/lib/dashboard/getQueryResults.ts@@ -28,6 +28,7 @@ import { prepareQueryRangePayload } from './prepareQueryRangePayload';import { QueryData } from 'types/api/widgets/getQuery';import { createAggregation } from 'api/v5/queryRange/prepareQueryRangePayloadV5';import { IDashboardVariable } from 'types/api/dashboard/getAll';+import { EQueryType } from 'types/common/dashboard';/*** Validates if metric name is available for METRICS data source@@ -142,6 +143,11 @@ export const getLegend = (payloadQuery: Query,labelName: string,) => {+ // For non-query builder queries, return the label name directly+ if (payloadQuery.queryType !== EQueryType.QUERY_BUILDER) {+ return labelName;+ }+const aggregationPerQuery = payloadQuery?.builder?.queryData.reduce((acc, query) => {if (query.queryName === queryData.queryName) {diff --git a/frontend/src/lib/uPlotLib/utils/tests/__mocks__/uplotChartOptionsData.ts b/frontend/src/lib/uPlotLib/utils/tests/__mocks__/uplotChartOptionsData.tsindex e9757d371b..0d3dace746 100644--- a/frontend/src/lib/uPlotLib/utils/tests/__mocks__/uplotChartOptionsData.ts+++ b/frontend/src/lib/uPlotLib/utils/tests/__mocks__/uplotChartOptionsData.ts@@ -1,4 +1,4 @@-import { PANEL_TYPES } from 'constants/queryBuilder';+import { initialQueriesMap, PANEL_TYPES } from 'constants/queryBuilder';import { GetUPlotChartOptions } from 'lib/uPlotLib/getUplotChartOptions';export const inputPropsTimeSeries = {@@ -204,6 +204,7 @@ export const inputPropsTimeSeries = {softMax: null,softMin: null,panelType: PANEL_TYPES.TIME_SERIES,+ query: initialQueriesMap.metrics,} as GetUPlotChartOptions;export const inputPropsBar = {