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: block alert creation if query_range API fails (#5441)
Shaheer Kochai46e6c34e5158
diff --git a/frontend/src/container/FormAlertRules/ChartPreview/index.tsx b/frontend/src/container/FormAlertRules/ChartPreview/index.tsxindex 331a5a0fc7..03db8a362e 100644--- a/frontend/src/container/FormAlertRules/ChartPreview/index.tsx+++ b/frontend/src/container/FormAlertRules/ChartPreview/index.tsx@@ -48,6 +48,7 @@ export interface ChartPreviewProps {userQueryKey?: string;allowSelectedIntervalForStepGen?: boolean;yAxisUnit: string;+ setQueryStatus?: (status: string) => void;}// eslint-disable-next-line sonarjs/cognitive-complexity@@ -62,6 +63,7 @@ function ChartPreview({allowSelectedIntervalForStepGen = false,alertDef,yAxisUnit,+ setQueryStatus,}: ChartPreviewProps): JSX.Element | null {const { t } = useTranslation('alerts');const dispatch = useDispatch();@@ -149,10 +151,10 @@ function ChartPreview({useEffect((): void => {const { startTime, endTime } = getTimeRange(queryResponse);-+ if (setQueryStatus) setQueryStatus(queryResponse.status);setMinTimeScale(startTime);setMaxTimeScale(endTime);- }, [maxTime, minTime, globalSelectedInterval, queryResponse]);+ }, [maxTime, minTime, globalSelectedInterval, queryResponse, setQueryStatus]);if (queryResponse.data && graphType === PANEL_TYPES.BAR) {const sortedSeriesData = getSortedSeriesData(@@ -284,6 +286,7 @@ ChartPreview.defaultProps = {userQueryKey: '',allowSelectedIntervalForStepGen: false,alertDef: undefined,+ setQueryStatus: (): void => {},};export default ChartPreview;diff --git a/frontend/src/container/FormAlertRules/index.tsx b/frontend/src/container/FormAlertRules/index.tsxindex 40abbb3583..4b383eb272 100644--- a/frontend/src/container/FormAlertRules/index.tsx+++ b/frontend/src/container/FormAlertRules/index.tsx@@ -101,6 +101,7 @@ function FormAlertRules({const isNewRule = ruleId === 0;const [loading, setLoading] = useState(false);+ const [queryStatus, setQueryStatus] = useState<string>('');// alertDef holds the form values to be postedconst [alertDef, setAlertDef] = useState<AlertDef>(initialValue);@@ -523,6 +524,7 @@ function FormAlertRules({alertDef={alertDef}yAxisUnit={yAxisUnit || ''}graphType={panelType || PANEL_TYPES.TIME_SERIES}+ setQueryStatus={setQueryStatus}/>);@@ -540,6 +542,7 @@ function FormAlertRules({selectedInterval={globalSelectedInterval}yAxisUnit={yAxisUnit || ''}graphType={panelType || PANEL_TYPES.TIME_SERIES}+ setQueryStatus={setQueryStatus}/>);@@ -665,7 +668,8 @@ function FormAlertRules({disabled={isAlertNameMissing ||isAlertAvailableToSave ||- !isChannelConfigurationValid+ !isChannelConfigurationValid ||+ queryStatus === 'error'}>{isNewRule ? t('button_createrule') : t('button_savechanges')}@@ -674,7 +678,11 @@ function FormAlertRules({<ActionButtonloading={loading || false}- disabled={isAlertNameMissing || !isChannelConfigurationValid}+ disabled={+ isAlertNameMissing ||+ !isChannelConfigurationValid ||+ queryStatus === 'error'+ }type="default"onClick={onTestRuleHandler}>