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: ch queries sending builder as query type in query range api for exceptions alerts (#4941)
Vikrant Guptab3d58315749a
diff --git a/frontend/src/constants/query.ts b/frontend/src/constants/query.tsindex 6b70ae9786..3759fb26b6 100644--- a/frontend/src/constants/query.ts+++ b/frontend/src/constants/query.ts@@ -30,4 +30,5 @@ export enum QueryParams {integration = 'integration',pagination = 'pagination',relativeTime = 'relativeTime',+ alertType = 'alertType',}diff --git a/frontend/src/container/CreateAlertRule/index.tsx b/frontend/src/container/CreateAlertRule/index.tsxindex 5a98cd2d8e..e5a4772f30 100644--- a/frontend/src/container/CreateAlertRule/index.tsx+++ b/frontend/src/container/CreateAlertRule/index.tsx@@ -1,8 +1,9 @@import { Form, Row } from 'antd';import { ENTITY_VERSION_V4 } from 'constants/app';+import { QueryParams } from 'constants/query';import FormAlertRules from 'container/FormAlertRules';import { useGetCompositeQueryParam } from 'hooks/queryBuilder/useGetCompositeQueryParam';-import { isEqual } from 'lodash-es';+import history from 'lib/history';import { useEffect, useState } from 'react';import { useLocation } from 'react-router-dom';import { AlertTypes } from 'types/api/alerts/alertTypes';@@ -19,13 +20,25 @@ import SelectAlertType from './SelectAlertType';function CreateRules(): JSX.Element {const [initValues, setInitValues] = useState<AlertDef | null>(null);- const [alertType, setAlertType] = useState<AlertTypes>();const location = useLocation();const queryParams = new URLSearchParams(location.search);const version = queryParams.get('version');+ const alertTypeFromParams = queryParams.get(QueryParams.alertType);const compositeQuery = useGetCompositeQueryParam();+ function getAlertTypeFromDataSource(): AlertTypes | null {+ if (!compositeQuery) {+ return null;+ }+ const dataSource = compositeQuery?.builder?.queryData[0]?.dataSource;++ return ALERT_TYPE_VS_SOURCE_MAPPING[dataSource];+ }++ const [alertType, setAlertType] = useState<AlertTypes>(+ (alertTypeFromParams as AlertTypes) || getAlertTypeFromDataSource(),+ );const [formInstance] = Form.useForm();@@ -47,21 +60,17 @@ function CreateRules(): JSX.Element {version: version || ENTITY_VERSION_V4,});}+ queryParams.set(QueryParams.alertType, typ);+ const generatedUrl = `${location.pathname}?${queryParams.toString()}`;+ history.replace(generatedUrl);};useEffect(() => {- if (!compositeQuery) {- return;- }- const dataSource = compositeQuery?.builder?.queryData[0]?.dataSource;-- const alertTypeFromQuery = ALERT_TYPE_VS_SOURCE_MAPPING[dataSource];-- if (alertTypeFromQuery && !isEqual(alertType, alertTypeFromQuery)) {- onSelectType(alertTypeFromQuery);+ if (alertType) {+ onSelectType(alertType);}// eslint-disable-next-line react-hooks/exhaustive-deps- }, [compositeQuery]);+ }, [alertType]);if (!initValues) {return (diff --git a/frontend/src/container/FormAlertRules/index.tsx b/frontend/src/container/FormAlertRules/index.tsxindex cb5bd1004e..c5d0356cb0 100644--- a/frontend/src/container/FormAlertRules/index.tsx+++ b/frontend/src/container/FormAlertRules/index.tsx@@ -523,6 +523,7 @@ function FormAlertRules({runQuery={handleRunQuery}alertDef={alertDef}panelType={panelType || PANEL_TYPES.TIME_SERIES}+ key={currentQuery.queryType}/><RuleOptions