Skip to content

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.

fix: do not format for non aggregation columns (#9492)

Srikanth Chekuribd63633be7f4
diff --git a/frontend/src/container/GridTableComponent/index.tsx b/frontend/src/container/GridTableComponent/index.tsx
index ac7e2c9931..f9ba1f21f2 100644
--- a/frontend/src/container/GridTableComponent/index.tsx
+++ b/frontend/src/container/GridTableComponent/index.tsx
@@ -88,17 +88,13 @@ function GridTableComponent({
const newValue = { ...val };
Object.keys(val).forEach((k) => {
const unit = getColumnUnit(k, columnUnits);
- // Apply formatting if:
- // 1. Column has a unit defined, OR
- // 2. decimalPrecision is specified (format all values)
- const shouldFormat = unit || decimalPrecision !== undefined;
- if (shouldFormat) {
+ if (unit) {
// the check below takes care of not adding units for rows that have n/a or null values
if (val[k] !== 'n/a' && val[k] !== null) {
newValue[k] = getYAxisFormattedValue(
String(val[k]),
- unit || 'none',
+ unit,
decimalPrecision,
);
} else if (val[k] === null) {
diff --git a/frontend/src/container/PanelWrapper/__tests__/tablePanelWrapperHelper.ts b/frontend/src/container/PanelWrapper/__tests__/tablePanelWrapperHelper.ts
index ca44be8268..ef3ade654f 100644
--- a/frontend/src/container/PanelWrapper/__tests__/tablePanelWrapperHelper.ts
+++ b/frontend/src/container/PanelWrapper/__tests__/tablePanelWrapperHelper.ts
@@ -121,6 +121,7 @@ export const tablePanelWidgetQuery = {
stackedBarChart: false,
bucketWidth: 0,
mergeAllActiveQueries: false,
+ decimalPrecision: 2,
};
export const tablePanelQueryResponse = {
diff --git a/frontend/src/lib/query/createTableColumnsFromQuery.ts b/frontend/src/lib/query/createTableColumnsFromQuery.ts
index 6c9609e406..53d71cf628 100644
--- a/frontend/src/lib/query/createTableColumnsFromQuery.ts
+++ b/frontend/src/lib/query/createTableColumnsFromQuery.ts
@@ -662,21 +662,23 @@ const generateTableColumns = (
*
* @param columnKey - The column identifier (could be queryName.expression or queryName)
* @param columnUnits - The column units mapping
- * @returns The unit string or undefined if not found
+ * @returns The unit string (none if the unit is set to empty string) or undefined if not found
*/
export const getColumnUnit = (
columnKey: string,
columnUnits: Record<string, string>,
): string | undefined => {
// First try the exact match (new syntax: queryName.expression)
- if (columnUnits[columnKey]) {
- return columnUnits[columnKey];
+ if (columnUnits[columnKey] !== undefined) {
+ return columnUnits[columnKey] || 'none';
}
// Fallback to old syntax: extract queryName from queryName.expression
if (columnKey.includes('.')) {
const queryName = columnKey.split('.')[0];
- return columnUnits[queryName];
+ if (columnUnits[queryName] !== undefined) {
+ return columnUnits[queryName] || 'none';
+ }
}
return undefined;