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(alerts): add docs and agent skill info banner to ClickHouse query editor (#11262)
Nikhil Sonieb95364abad4
diff --git a/frontend/src/container/FormAlertRules/ChQuerySection/ChQuerySection.tsx b/frontend/src/container/FormAlertRules/ChQuerySection/ChQuerySection.tsxindex 68a18359ef..6a3d6a2023 100644--- a/frontend/src/container/FormAlertRules/ChQuerySection/ChQuerySection.tsx+++ b/frontend/src/container/FormAlertRules/ChQuerySection/ChQuerySection.tsx@@ -1,16 +1,65 @@+import { Callout } from '@signozhq/ui/callout';import ClickHouseQueryBuilder from 'container/NewWidget/LeftContainer/QuerySection/QueryBuilder/ClickHouse/query';import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';+import { AlertTypes } from 'types/api/alerts/alertTypes';+import DOCLINKS from 'utils/docLinks';-function ChQuerySection(): JSX.Element {+import 'container/NewWidget/LeftContainer/QuerySection/QueryBuilder/ClickHouse/ClickHouse.styles.scss';++const ALERT_TYPE_DOC_LINK: Partial<Record<AlertTypes, string>> = {+ [AlertTypes.LOGS_BASED_ALERT]: DOCLINKS.QUERY_CLICKHOUSE_LOGS,+ [AlertTypes.TRACES_BASED_ALERT]: DOCLINKS.QUERY_CLICKHOUSE_TRACES,+ [AlertTypes.EXCEPTIONS_BASED_ALERT]: DOCLINKS.QUERY_CLICKHOUSE_TRACES,+ [AlertTypes.METRICS_BASED_ALERT]: DOCLINKS.QUERY_CLICKHOUSE_METRICS,+};++const ALERT_TYPES_WITH_AGENT_SKILL: AlertTypes[] = [+ AlertTypes.LOGS_BASED_ALERT,+ AlertTypes.TRACES_BASED_ALERT,+ AlertTypes.EXCEPTIONS_BASED_ALERT,+];++interface ChQuerySectionProps {+ alertType: AlertTypes;+}++function ChQuerySection({ alertType }: ChQuerySectionProps): JSX.Element {const { currentQuery } = useQueryBuilder();+ const docLink = ALERT_TYPE_DOC_LINK[alertType];+ const showAgentSkill = ALERT_TYPES_WITH_AGENT_SKILL.includes(alertType);return (- <ClickHouseQueryBuilder- key="A"- queryIndex={0}- queryData={currentQuery.clickhouse_sql[0]}- deletable={false}- />+ <>+ {docLink && (+ <div className="info-banner-wrapper">+ <Callout+ type="info"+ showIcon+ title={+ <span>+ <a href={docLink} target="_blank" rel="noopener">+ Learn to write faster, optimized queries+ </a>+ {showAgentSkill && (+ <>+ {' · Using AI? '}+ <a href={DOCLINKS.AGENT_SKILL_INSTALL} target="_blank" rel="noopener">+ Install the SigNoz ClickHouse query agent skill+ </a>+ </>+ )}+ </span>+ }+ />+ </div>+ )}+ <ClickHouseQueryBuilder+ key="A"+ queryIndex={0}+ queryData={currentQuery.clickhouse_sql[0]}+ deletable={false}+ />+ </>);}diff --git a/frontend/src/container/FormAlertRules/QuerySection.tsx b/frontend/src/container/FormAlertRules/QuerySection.tsxindex 9da4bbb268..111567ed8f 100644--- a/frontend/src/container/FormAlertRules/QuerySection.tsx+++ b/frontend/src/container/FormAlertRules/QuerySection.tsx@@ -56,7 +56,9 @@ function QuerySection({const renderPromqlUI = (): JSX.Element => <PromqlSection />;- const renderChQueryUI = (): JSX.Element => <ChQuerySection />;+ const renderChQueryUI = (): JSX.Element => (+ <ChQuerySection alertType={alertType} />+ );const isDarkMode = useIsDarkMode();diff --git a/frontend/src/container/NewWidget/LeftContainer/QuerySection/QueryBuilder/ClickHouse/index.tsx b/frontend/src/container/NewWidget/LeftContainer/QuerySection/QueryBuilder/ClickHouse/index.tsxindex d67b1e49ef..2a3ab21a43 100644--- a/frontend/src/container/NewWidget/LeftContainer/QuerySection/QueryBuilder/ClickHouse/index.tsx+++ b/frontend/src/container/NewWidget/LeftContainer/QuerySection/QueryBuilder/ClickHouse/index.tsx@@ -26,12 +26,12 @@ function ClickHouseQueryContainer(): JSX.Element | null {<ahref={DOCLINKS.QUERY_CLICKHOUSE_TRACES}target="_blank"- rel="noreferrer"+ rel="noopener">Learn to write faster, optimized queries</a>{' · Using AI? '}- <a href={DOCLINKS.AGENT_SKILL_INSTALL} target="_blank" rel="noreferrer">+ <a href={DOCLINKS.AGENT_SKILL_INSTALL} target="_blank" rel="noopener">Install the SigNoz ClickHouse query agent skill</a></span>diff --git a/frontend/src/utils/docLinks.ts b/frontend/src/utils/docLinks.tsindex a6a2cf9851..a5ca71f339 100644--- a/frontend/src/utils/docLinks.ts+++ b/frontend/src/utils/docLinks.ts@@ -10,6 +10,10 @@ const DOCLINKS = {'https://signoz.io/docs/external-api-monitoring/overview/',QUERY_CLICKHOUSE_TRACES:'https://signoz.io/docs/userguide/writing-clickhouse-traces-query/#timestamp-bucketing-for-distributed_signoz_index_v3',+ QUERY_CLICKHOUSE_LOGS:+ 'https://signoz.io/docs/userguide/logs_clickhouse_queries/',+ QUERY_CLICKHOUSE_METRICS:+ 'https://signoz.io/docs/userguide/write-a-metrics-clickhouse-query/',AGENT_SKILL_INSTALL: 'https://signoz.io/docs/ai/agent-skills/#installation',};