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
feat: unit selection for value graph on dashboard (#898)
Pranshu Chittora8a883f1b5e85
diff --git a/frontend/src/container/GridGraphComponent/index.tsx b/frontend/src/container/GridGraphComponent/index.tsxindex 7c1572fae1..3ca7f4f544 100644--- a/frontend/src/container/GridGraphComponent/index.tsx+++ b/frontend/src/container/GridGraphComponent/index.tsx@@ -1,6 +1,7 @@import { Typography } from 'antd';import { ChartData } from 'chart.js';import Graph, { graphOnClickHandler } from 'components/Graph';+import { getYAxisFormattedValue } from 'components/Graph/yAxisConfig';import ValueGraph from 'components/ValueGraph';import { GRAPH_TYPES } from 'container/NewDashboard/ComponentsSlider';import history from 'lib/history';@@ -57,7 +58,11 @@ function GridGraphComponent({<Typography>{title}</Typography></TitleContainer><ValueContainer isDashboardPage={isDashboardPage}>- <ValueGraph value={value.toString()} />+ <ValueGraph+ value={+ yAxisUnit ? getYAxisFormattedValue(value, yAxisUnit) : value.toString()+ }+ /></ValueContainer></>);diff --git a/frontend/src/container/NewWidget/RightContainer/YAxisUnitSelector.tsx b/frontend/src/container/NewWidget/RightContainer/YAxisUnitSelector.tsxindex d8202d6fdb..1af32aff45 100644--- a/frontend/src/container/NewWidget/RightContainer/YAxisUnitSelector.tsx+++ b/frontend/src/container/NewWidget/RightContainer/YAxisUnitSelector.tsx@@ -9,7 +9,7 @@ const findCategoryById = (searchValue) =>const findCategoryByName = (searchValue) =>find(flattenedCategories, (option) => option.name == searchValue);-function YAxisUnitSelector({ defaultValue, onSelect }): JSX.Element {+function YAxisUnitSelector({ defaultValue, onSelect, fieldLabel }): JSX.Element {const onSelectHandler = (selectedValue: string): void => {onSelect(findCategoryByName(selectedValue)?.id);};@@ -19,7 +19,7 @@ function YAxisUnitSelector({ defaultValue, onSelect }): JSX.Element {return (<Col style={{ marginTop: '1rem' }}><div style={{ margin: '0.5rem 0' }}>- <Typography.Text>Y Axis Unit</Typography.Text>+ <Typography.Text>{fieldLabel}</Typography.Text></div><AutoCompletestyle={{ width: '100%' }}diff --git a/frontend/src/container/NewWidget/RightContainer/index.tsx b/frontend/src/container/NewWidget/RightContainer/index.tsxindex 660451b439..dc9f79f0c5 100644--- a/frontend/src/container/NewWidget/RightContainer/index.tsx+++ b/frontend/src/container/NewWidget/RightContainer/index.tsx@@ -148,7 +148,11 @@ function RightContainer({setSelectedTime,}}/>- <YAxisUnitSelector defaultValue={yAxisUnit} onSelect={setYAxisUnit} />+ <YAxisUnitSelector+ defaultValue={yAxisUnit}+ onSelect={setYAxisUnit}+ fieldLabel={selectedGraphType === 'Value' ? 'Unit' : 'Y Axis Unit'}+ /></Container>);}