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: resolve the unneccessary refetching of graphs on service details page

amlannandy8d2666004b65
diff --git a/frontend/src/container/MetricsApplication/Tabs/Overview.tsx b/frontend/src/container/MetricsApplication/Tabs/Overview.tsx
index 77bf86b80f..6decf72b39 100644
--- a/frontend/src/container/MetricsApplication/Tabs/Overview.tsx
+++ b/frontend/src/container/MetricsApplication/Tabs/Overview.tsx
@@ -145,41 +145,49 @@ function Application(): JSX.Element {
[servicename, topLevelOperations],
);
- const operationPerSecWidget = getWidgetQueryBuilder({
- query: {
- queryType: EQueryType.QUERY_BUILDER,
- promql: [],
- builder: operationPerSec({
- servicename,
- tagFilterItems,
- topLevelOperations: topLevelOperationsRoute,
+ const operationPerSecWidget = useMemo(
+ () =>
+ getWidgetQueryBuilder({
+ query: {
+ queryType: EQueryType.QUERY_BUILDER,
+ promql: [],
+ builder: operationPerSec({
+ servicename,
+ tagFilterItems,
+ topLevelOperations: topLevelOperationsRoute,
+ }),
+ clickhouse_sql: [],
+ id: uuid(),
+ },
+ title: GraphTitle.RATE_PER_OPS,
+ panelTypes: PANEL_TYPES.TIME_SERIES,
+ yAxisUnit: 'ops',
+ id: SERVICE_CHART_ID.rps,
}),
- clickhouse_sql: [],
- id: uuid(),
- },
- title: GraphTitle.RATE_PER_OPS,
- panelTypes: PANEL_TYPES.TIME_SERIES,
- yAxisUnit: 'ops',
- id: SERVICE_CHART_ID.rps,
- });
+ [servicename, tagFilterItems, topLevelOperationsRoute],
+ );
- const errorPercentageWidget = getWidgetQueryBuilder({
- query: {
- queryType: EQueryType.QUERY_BUILDER,
- promql: [],
- builder: errorPercentage({
- servicename,
- tagFilterItems,
- topLevelOperations: topLevelOperationsRoute,
+ const errorPercentageWidget = useMemo(
+ () =>
+ getWidgetQueryBuilder({
+ query: {
+ queryType: EQueryType.QUERY_BUILDER,
+ promql: [],
+ builder: errorPercentage({
+ servicename,
+ tagFilterItems,
+ topLevelOperations: topLevelOperationsRoute,
+ }),
+ clickhouse_sql: [],
+ id: uuid(),
+ },
+ title: GraphTitle.ERROR_PERCENTAGE,
+ panelTypes: PANEL_TYPES.TIME_SERIES,
+ yAxisUnit: '%',
+ id: SERVICE_CHART_ID.errorPercentage,
}),
- clickhouse_sql: [],
- id: uuid(),
- },
- title: GraphTitle.ERROR_PERCENTAGE,
- panelTypes: PANEL_TYPES.TIME_SERIES,
- yAxisUnit: '%',
- id: SERVICE_CHART_ID.errorPercentage,
- });
+ [servicename, tagFilterItems, topLevelOperationsRoute],
+ );
const stepInterval = useMemo(
() =>
diff --git a/frontend/src/container/MetricsApplication/Tabs/Overview/ServiceOverview.tsx b/frontend/src/container/MetricsApplication/Tabs/Overview/ServiceOverview.tsx
index 24e2233244..42f54c1448 100644
--- a/frontend/src/container/MetricsApplication/Tabs/Overview/ServiceOverview.tsx
+++ b/frontend/src/container/MetricsApplication/Tabs/Overview/ServiceOverview.tsx
@@ -53,24 +53,28 @@ function ServiceOverview({
[isSpanMetricEnable, queries],
);
- const latencyWidget = getWidgetQueryBuilder({
- query: {
- queryType: EQueryType.QUERY_BUILDER,
- promql: [],
- builder: latency({
- servicename,
- tagFilterItems,
- isSpanMetricEnable,
- topLevelOperationsRoute,
+ const latencyWidget = useMemo(
+ () =>
+ getWidgetQueryBuilder({
+ query: {
+ queryType: EQueryType.QUERY_BUILDER,
+ promql: [],
+ builder: latency({
+ servicename,
+ tagFilterItems,
+ isSpanMetricEnable,
+ topLevelOperationsRoute,
+ }),
+ clickhouse_sql: [],
+ id: uuid(),
+ },
+ title: GraphTitle.LATENCY,
+ panelTypes: PANEL_TYPES.TIME_SERIES,
+ yAxisUnit: 'ns',
+ id: SERVICE_CHART_ID.latency,
}),
- clickhouse_sql: [],
- id: uuid(),
- },
- title: GraphTitle.LATENCY,
- panelTypes: PANEL_TYPES.TIME_SERIES,
- yAxisUnit: 'ns',
- id: SERVICE_CHART_ID.latency,
- });
+ [isSpanMetricEnable, servicename, tagFilterItems, topLevelOperationsRoute],
+ );
const isQueryEnabled =
!topLevelOperationsIsLoading && topLevelOperationsRoute.length > 0;