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: Chart is not updating on change of variables (#2020)

Chintan Sudani6cc7025e37a3
diff --git a/frontend/src/container/GridGraphLayout/Graph/index.tsx b/frontend/src/container/GridGraphLayout/Graph/index.tsx
index 912b3d9c62..d88bfdc1ad 100644
--- a/frontend/src/container/GridGraphLayout/Graph/index.tsx
+++ b/frontend/src/container/GridGraphLayout/Graph/index.tsx
@@ -21,6 +21,7 @@ import { GlobalTime } from 'types/actions/globalTime';
import { ErrorResponse, SuccessResponse } from 'types/api';
import { Widgets } from 'types/api/dashboard/getAll';
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
+import DashboardReducer from 'types/reducer/dashboards';
import { GlobalReducer } from 'types/reducer/globalTime';
import { LayoutProps } from '..';
@@ -49,13 +50,25 @@ function GridCardGraph({
AppState,
GlobalReducer
>((state) => state.globalTime);
+ const { dashboards } = useSelector<AppState, DashboardReducer>(
+ (state) => state.dashboards,
+ );
+ const [selectedDashboard] = dashboards;
+ const selectedData = selectedDashboard?.data;
+ const { variables } = selectedData;
const response = useQuery<
SuccessResponse<MetricRangePayloadProps> | ErrorResponse
>(
[
`GetMetricsQueryRange-${widget.timePreferance}-${globalSelectedInterval}-${widget.id}`,
- { widget, maxTime, minTime, globalSelectedInterval },
+ {
+ widget,
+ maxTime,
+ minTime,
+ globalSelectedInterval,
+ variables,
+ },
],
() =>
GetMetricQueryRange({