diff --git a/src/pages/alertRules/Form/PipelineConfigsNG/Annotations.tsx b/src/pages/alertRules/Form/PipelineConfigsNG/Annotations.tsx
index 1693a777f..db38c6488 100644
--- a/src/pages/alertRules/Form/PipelineConfigsNG/Annotations.tsx
+++ b/src/pages/alertRules/Form/PipelineConfigsNG/Annotations.tsx
@@ -1,10 +1,15 @@
-import React from 'react';
-import { Form, Space, Row, Col, AutoComplete, Input } from 'antd';
-import { PlusCircleOutlined, MinusCircleOutlined } from '@ant-design/icons';
+import React, { useContext } from 'react';
+import { Form, Space, Row, Col, AutoComplete, Input, Tooltip } from 'antd';
+import { PlusCircleOutlined, MinusCircleOutlined, InfoCircleOutlined } from '@ant-design/icons';
import { useTranslation } from 'react-i18next';
+import { CommonStateContext } from '@/App';
+import DocumentDrawer from '@/components/DocumentDrawer';
+import { ANNOTATIONS_ENRICH_QUERIES_DOC_URL } from '@/pages/alertRules/constants';
+
export default function Annotations() {
- const { t } = useTranslation('alertRules');
+ const { t, i18n } = useTranslation('alertRules');
+ const { darkMode } = useContext(CommonStateContext);
return (
@@ -12,7 +17,23 @@ export default function Annotations() {
{t('annotations')}
+
+
+
add()} />
+ {
+ DocumentDrawer({
+ language: i18n.language,
+ darkMode,
+ type: 'iframe',
+ title: t('common:page_help'),
+ documentPath: ANNOTATIONS_ENRICH_QUERIES_DOC_URL,
+ });
+ }}
+ >
+ {t('common:page_help')}
+
{fields.map((field) => (
diff --git a/src/pages/alertRules/FormNG/PipelineConfigsNG/Annotations.tsx b/src/pages/alertRules/FormNG/PipelineConfigsNG/Annotations.tsx
index cacb7131a..47d79fd04 100644
--- a/src/pages/alertRules/FormNG/PipelineConfigsNG/Annotations.tsx
+++ b/src/pages/alertRules/FormNG/PipelineConfigsNG/Annotations.tsx
@@ -1,12 +1,16 @@
-import React from 'react';
-import { Form, Space, Row, Col, AutoComplete, Input } from 'antd';
-import { PlusCircleOutlined } from '@ant-design/icons';
+import React, { useContext } from 'react';
+import { Form, Space, Row, Col, AutoComplete, Input, Tooltip } from 'antd';
+import { PlusCircleOutlined, InfoCircleOutlined } from '@ant-design/icons';
import { useTranslation } from 'react-i18next';
+import { CommonStateContext } from '@/App';
+import DocumentDrawer from '@/components/DocumentDrawer';
import CardContainer, { CardContainerHeader } from '@/pages/alertRules/FormNG/components/CardContainer';
+import { ANNOTATIONS_ENRICH_QUERIES_DOC_URL } from '@/pages/alertRules/constants';
export default function Annotations() {
- const { t } = useTranslation('alertRules');
+ const { t, i18n } = useTranslation('alertRules');
+ const { darkMode } = useContext(CommonStateContext);
return (
<>
@@ -21,7 +25,23 @@ export default function Annotations() {
{t('annotations')}
+
+
+
add()} />
+ {
+ DocumentDrawer({
+ language: i18n.language,
+ darkMode,
+ type: 'iframe',
+ title: t('common:page_help'),
+ documentPath: ANNOTATIONS_ENRICH_QUERIES_DOC_URL,
+ });
+ }}
+ >
+ {t('common:page_help')}
+
{fields.map((field) => (
remove(field.name)}>
diff --git a/src/pages/alertRules/constants.ts b/src/pages/alertRules/constants.ts
index db2889692..00b186ec1 100644
--- a/src/pages/alertRules/constants.ts
+++ b/src/pages/alertRules/constants.ts
@@ -2,3 +2,4 @@ export const priorityColor = ['red', 'orange', 'blue'];
export const panelBaseProps: any = {};
export const daysOfWeek = [0, 1, 2, 3, 4, 5, 6];
export const DATASOURCE_ALL = 0;
+export const ANNOTATIONS_ENRICH_QUERIES_DOC_URL = 'https://flashcat.cloud/docs/content/flashcat-monitor/nightingale-v9/usage/alert-notify/rules/alert-rules/annotations-enrich-queries/';
diff --git a/src/pages/alertRules/locale/en_US.ts b/src/pages/alertRules/locale/en_US.ts
index 2a90c39f8..c9fdcb7ca 100644
--- a/src/pages/alertRules/locale/en_US.ts
+++ b/src/pages/alertRules/locale/en_US.ts
@@ -90,6 +90,8 @@ const en_US = {
override_global_webhook_tip:
'After this switch is turned on, the alert event will only be sent to the callback address of this rule, and will not be sent to the global callback address',
annotations: 'Annotations',
+ annotations_tip:
+ 'Attach static Key:Value notes to every alert event produced by this rule, such as a runbook link (runbook_url), dashboard link (dashboard_url), or summary. Values support template variables (e.g. {{$labels.ident}}, {{$value}}), are rendered when the event is generated, shown on the event detail page, and can be referenced in notification templates via {{$event.AnnotationsJSON.xxx}}. Unlike "Enrich Queries" below, annotations are pre-written static notes and do not query any datasource',
annotationsOptions: {
plan_link: 'Plan link',
dashboard_link: 'Dashboard link',
@@ -546,7 +548,7 @@ const en_US = {
enrich_queries: {
title: 'Enrich Queries',
- tip: "When an alert is triggered, the enrich query will be executed and the results will be written to the event's extra_info (formatted string) and extra_info_map (raw key-value pairs) fields. You can reference them in notification templates using {{ .ExtraInfo }} or {{ .ExtraInfoMap }}",
+ tip: 'When an alert fires, the queries configured here are executed in real time and the fetched data (e.g. matching raw log samples) is attached to the alert event, so recipients see the context directly in the notification. Query conditions can reference event variables (e.g. {{$labels.ident}}); results are written to the event\'s extra_info (formatted text) and extra_info_map (raw key-value pairs) fields and can be referenced in notification templates via {{$event.ExtraInfo}} or {{$event.ExtraInfoMap}}. Unlike "Annotations" above, which are pre-written static notes, enrich queries fetch live data from the datasource at alert time',
},
};
export default en_US;
diff --git a/src/pages/alertRules/locale/ja_JP.ts b/src/pages/alertRules/locale/ja_JP.ts
index 2447d6c8c..f8ca57e54 100644
--- a/src/pages/alertRules/locale/ja_JP.ts
+++ b/src/pages/alertRules/locale/ja_JP.ts
@@ -89,10 +89,12 @@ const ja_JP = {
override_global_webhook: 'グローバルコールバックを上書き',
enrich_queries: {
title: '追加クエリ',
- tip: 'アラートがトリガーされると、追加クエリが実行され、結果がイベントの extra_info(フォーマット済み文字列)および extra_info_map(生のキーと値のペア)フィールドに書き込まれます。通知テンプレートでは {{ .ExtraInfo }} または {{ .ExtraInfoMap }} を使用して参照できます',
+ tip: 'アラートがトリガーされた時点で、ここで設定したクエリをリアルタイムに実行し、取得した現場データ(ヒットした生ログのサンプルなど)をアラートイベントに付加します。受信者は通知の中で直接コンテキストを確認できます。クエリ条件ではイベント変数({{$labels.ident}} など)を参照できます。結果はイベントの extra_info(整形済みテキスト)と extra_info_map(生のキーと値のペア)フィールドに書き込まれ、通知テンプレートでは {{$event.ExtraInfo}} または {{$event.ExtraInfoMap}} で参照できます。上の「追加情報」との違い:追加情報は事前に書いておく静的な説明であり、追加クエリはアラート時点でデータソースをリアルタイムに照会します',
},
override_global_webhook_tip: 'このスイッチをオンにすると、アラートイベントはこのルールのコールバックアドレスのみに送信され、グローバルコールバックアドレスには送信されません',
annotations: '追加情報',
+ annotations_tip:
+ 'このルールが生成するアラートイベントに Key:Value 形式の補足説明を付加します。例:対応手順リンク(runbook_url)、ダッシュボードリンク(dashboard_url)、サマリー(summary)など。Value はテンプレート変数({{$labels.ident}}、{{$value}} など)をサポートし、イベント生成時にレンダリングされてイベント詳細ページに表示されます。通知テンプレートでは {{$event.AnnotationsJSON.xxx}} で参照できます。下の「追加クエリ」との違い:追加情報は事前に書いておく静的な説明であり、データソースへの照会は行いません',
annotationsOptions: {
plan_link: '計画リンク',
dashboard_link: 'ダッシュボードリンク',
diff --git a/src/pages/alertRules/locale/ru_RU.ts b/src/pages/alertRules/locale/ru_RU.ts
index d3e200def..51b022ac3 100644
--- a/src/pages/alertRules/locale/ru_RU.ts
+++ b/src/pages/alertRules/locale/ru_RU.ts
@@ -91,6 +91,8 @@ const ru_RU = {
override_global_webhook_tip:
'Когда этот переключатель включен, события оповещений будут отправляться только на адреса обратного вызова этого правила и не будут отправляться на глобальные адреса обратного вызова',
annotations: 'Дополнительная информация',
+ annotations_tip:
+ 'Прикрепляет к каждому событию оповещения этого правила статические заметки в формате Key:Value, например ссылку на план действий (runbook_url), ссылку на панель мониторинга (dashboard_url) или сводку (summary). Значения поддерживают шаблонные переменные (например {{$labels.ident}}, {{$value}}), рендерятся при создании события, отображаются на странице деталей события и доступны в шаблонах уведомлений через {{$event.AnnotationsJSON.xxx}}. В отличие от «Доп. запросов» ниже, это заранее написанные статические заметки — запросов к источнику данных не выполняется',
annotationsOptions: {
plan_link: 'Ссылка на план действий',
dashboard_link: 'Ссылка на панель мониторинга',
@@ -546,7 +548,7 @@ const ru_RU = {
enrich_queries: {
title: 'Доп. запросы',
- tip: 'Когда срабатывает оповещение, будет выполнен дополнительный запрос, и результаты будут записаны в поля extra_info (форматированная строка) и extra_info_map (исходные пары ключ-значение) события. Вы можете ссылаться на них в шаблонах уведомлений с помощью {{ .ExtraInfo }} или {{ .ExtraInfoMap }}',
+ tip: 'В момент срабатывания оповещения настроенные здесь запросы выполняются в реальном времени, а полученные данные (например, образцы сырых логов) прикрепляются к событию оповещения — получатель видит контекст прямо в уведомлении. В условиях запроса можно ссылаться на переменные события (например {{$labels.ident}}); результаты записываются в поля события extra_info (форматированный текст) и extra_info_map (исходные пары ключ-значение) и доступны в шаблонах уведомлений через {{$event.ExtraInfo}} или {{$event.ExtraInfoMap}}. В отличие от «Дополнительной информации» выше — заранее написанных статических заметок — доп. запросы получают актуальные данные из источника в момент оповещения',
},
};
diff --git a/src/pages/alertRules/locale/zh_CN.ts b/src/pages/alertRules/locale/zh_CN.ts
index 7a6bf25ea..60b395263 100644
--- a/src/pages/alertRules/locale/zh_CN.ts
+++ b/src/pages/alertRules/locale/zh_CN.ts
@@ -88,10 +88,12 @@ const zh_CN = {
override_global_webhook: '覆盖全局回调',
enrich_queries: {
title: '附加查询',
- tip: '告警触发时会执行附加查询,将查询结果写入事件的 extra_info(格式化字符串)和 extra_info_map(原始键值对)字段,可在通知模板中通过 {{ .ExtraInfo }} 或 {{ .ExtraInfoMap }}',
+ tip: '告警触发时,实时执行这里配置的查询,把查到的现场数据(如命中的原始日志样本)附加到告警事件里,让接收人在通知中直接看到上下文。查询条件支持引用事件变量(如 {{$labels.ident}});结果写入事件的 extra_info(格式化文本)和 extra_info_map(原始键值对)字段,可在通知模板中通过 {{$event.ExtraInfo}} 或 {{$event.ExtraInfoMap}} 引用。与上方「附加信息」的区别:附加信息是预先写好的静态说明,附加查询是告警时刻对数据源的实时查询',
},
override_global_webhook_tip: '此开关开启之后,告警事件只会发给本规则的回调地址,不会再发给全局的回调地址',
annotations: '附加信息',
+ annotations_tip:
+ '以 Key:Value 形式给本规则产生的告警事件附加补充说明,如预案链接(runbook_url)、仪表盘链接(dashboard_url)、摘要(summary)等。Value 支持模板变量(如 {{$labels.ident}}、{{$value}}),事件生成时渲染,展示在事件详情页,也可在通知模板中通过 {{$event.AnnotationsJSON.xxx}} 引用。与下方「附加查询」的区别:附加信息是预先写好的静态说明,不会查询数据源',
annotationsOptions: {
plan_link: '预案链接',
dashboard_link: '仪表盘链接',
diff --git a/src/pages/alertRules/locale/zh_HK.ts b/src/pages/alertRules/locale/zh_HK.ts
index 1093d25f4..f7f47d030 100644
--- a/src/pages/alertRules/locale/zh_HK.ts
+++ b/src/pages/alertRules/locale/zh_HK.ts
@@ -88,10 +88,12 @@ const zh_HK = {
override_global_webhook: '覆蓋全局回調',
enrich_queries: {
title: '附加查詢',
- tip: '告警觸發時會執行附加查詢,將查詢結果寫入事件的 extra_info(格式化字符串)和 extra_info_map(原始鍵值對)字段,可在通知模板中通過 {{ .ExtraInfo }} 或 {{ .ExtraInfoMap }}',
+ tip: '告警觸發時,實時執行這裡配置的查詢,把查到的現場數據(如命中的原始日誌樣本)附加到告警事件裡,讓接收人在通知中直接看到上下文。查詢條件支持引用事件變數(如 {{$labels.ident}});結果寫入事件的 extra_info(格式化文本)和 extra_info_map(原始鍵值對)字段,可在通知模板中通過 {{$event.ExtraInfo}} 或 {{$event.ExtraInfoMap}} 引用。與上方「附加資訊」的區別:附加資訊是預先寫好的靜態說明,附加查詢是告警時刻對數據源的實時查詢',
},
override_global_webhook_tip: '此開關開啟之後,告警事件只會發給本規則的回調地址,不會再發給全局的回調地址',
annotations: '附加資訊',
+ annotations_tip:
+ '以 Key:Value 形式給本規則產生的告警事件附加補充說明,如預案連結(runbook_url)、儀表盤連結(dashboard_url)、摘要(summary)等。Value 支持模板變數(如 {{$labels.ident}}、{{$value}}),事件生成時渲染,展示在事件詳情頁,也可在通知模板中通過 {{$event.AnnotationsJSON.xxx}} 引用。與下方「附加查詢」的區別:附加資訊是預先寫好的靜態說明,不會查詢數據源',
annotationsOptions: {
plan_link: '預案連結',
dashboard_link: '儀表盤連結',
diff --git a/src/plugins/doris/AlertRule/EnrichQueries/index.tsx b/src/plugins/doris/AlertRule/EnrichQueries/index.tsx
index bc582609d..f13c1a073 100644
--- a/src/plugins/doris/AlertRule/EnrichQueries/index.tsx
+++ b/src/plugins/doris/AlertRule/EnrichQueries/index.tsx
@@ -15,6 +15,8 @@ import { normalizeTime } from '@/pages/alertRules/Form/utils';
import { NS as EVENT_PIPELINE_NS } from '@/pages/eventPipeline/constants';
import CardContainer, { CardContainerHeader } from '@/pages/alertRules/FormNG/components/CardContainer';
+import { ANNOTATIONS_ENRICH_QUERIES_DOC_URL } from '@/pages/alertRules/constants';
+
import { NAME_SPACE, DORIS_SQL_MODE_DOC_URL } from '../../constants';
import GraphPreview from '../GraphPreview';
@@ -40,7 +42,7 @@ export default function index({ prefixField = {}, fullPrefixName = [], prefixNam
diff --git a/src/plugins/elasticsearch/AlertRule/EnrichQueries/index.tsx b/src/plugins/elasticsearch/AlertRule/EnrichQueries/index.tsx
index a539557c9..12572e32d 100644
--- a/src/plugins/elasticsearch/AlertRule/EnrichQueries/index.tsx
+++ b/src/plugins/elasticsearch/AlertRule/EnrichQueries/index.tsx
@@ -1,12 +1,15 @@
-import React, { useState, useEffect } from 'react';
+import React, { useState, useEffect, useContext } from 'react';
import { Form, Space, Tooltip } from 'antd';
import { PlusCircleOutlined, InfoCircleOutlined } from '@ant-design/icons';
import _ from 'lodash';
import { useTranslation } from 'react-i18next';
+import { CommonStateContext } from '@/App';
+import DocumentDrawer from '@/components/DocumentDrawer';
import { getIndices } from '@/pages/explorer/Elasticsearch/services';
import EnhancedModal from '@/pages/alertRules/Form/components/EnhancedModal';
import CardContainer from '@/pages/alertRules/FormNG/components/CardContainer';
+import { ANNOTATIONS_ENRICH_QUERIES_DOC_URL } from '@/pages/alertRules/constants';
// @ts-ignore
import EnrichQueryValuesMaxLen from 'plus:/parcels/AlertRule/NotifyExtra/EnrichQueryValuesMaxLen';
@@ -20,7 +23,8 @@ interface IProps {
}
export default function index(props: IProps) {
- const { t } = useTranslation('alertRules');
+ const { t, i18n } = useTranslation('alertRules');
+ const { darkMode } = useContext(CommonStateContext);
const { disabled } = props;
const [indexOptions, setIndexOptions] = useState
([]);
const names = ['extra_config', 'enrich_queries'];
@@ -50,7 +54,7 @@ export default function index(props: IProps) {