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
fix: removed the decimal places logic from getYAxisFormattedValue (#9537)
SagarRajput-7d53f9a7e161c
diff --git a/frontend/src/components/Graph/__tests__/yAxisConfig.test.ts b/frontend/src/components/Graph/__tests__/yAxisConfig.test.tsindex b5ddb97b9f..389df13049 100644--- a/frontend/src/components/Graph/__tests__/yAxisConfig.test.ts+++ b/frontend/src/components/Graph/__tests__/yAxisConfig.test.ts@@ -232,7 +232,7 @@ describe('getYAxisFormattedValue - units (full precision legacy assertions)', ()).toBe('1%');expect(testFullPrecisionGetYAxisFormattedValue('1.00555555559595876', 'percent'),- ).toBe('1.005555555595958%');+ ).toBe('1.005555555595959%');});test('ratio', () => {@@ -359,7 +359,7 @@ describe('getYAxisFormattedValue - precision option tests', () => {'s',PrecisionOptionsEnum.FULL,),- ).toBe('26254299141484417000000 µs');+ ).toBe('26.254299141484417 µs');expect(getYAxisFormattedValue('4353.81', 'ms', PrecisionOptionsEnum.FULL),diff --git a/frontend/src/components/Graph/yAxisConfig.ts b/frontend/src/components/Graph/yAxisConfig.tsindex e5d6feafac..6bfdd01920 100644--- a/frontend/src/components/Graph/yAxisConfig.ts+++ b/frontend/src/components/Graph/yAxisConfig.ts@@ -101,19 +101,10 @@ export const getYAxisFormattedValue = (if (numValue === Infinity) return '∞';if (numValue === -Infinity) return '-∞';- const decimalPlaces = value.split('.')[1]?.length || undefined;-- // Use custom formatter for the 'none' format honoring precision- if (format === 'none') {- return formatDecimalWithLeadingZeros(numValue, precision);- }-// For all other standard formats, delegate to grafana/data's built-in formatter.const computeDecimals = (): number | undefined => {if (precision === PrecisionOptionsEnum.FULL) {- return decimalPlaces && decimalPlaces >= DEFAULT_SIGNIFICANT_DIGITS- ? decimalPlaces- : DEFAULT_SIGNIFICANT_DIGITS;+ return DEFAULT_SIGNIFICANT_DIGITS;}return precision;};@@ -130,6 +121,11 @@ export const getYAxisFormattedValue = (};try {+ // Use custom formatter for the 'none' format honoring precision+ if (format === 'none') {+ return formatDecimalWithLeadingZeros(numValue, precision);+ }+const formatter = getValueFormat(format);const formattedValue = formatter(numValue, computeDecimals(), undefined);if (formattedValue.text && formattedValue.text.includes('.')) {