feat(platform): include release in alert runbook
This commit is contained in:
@@ -449,8 +449,9 @@ function normalizePriorityIssues(rows?: QualityPriorityIssue[]): PriorityIssueRo
|
||||
return rows;
|
||||
}
|
||||
|
||||
function notificationPolicyRunbookText(policies: QualityNotificationPolicy[], rules: AlertRuleRow[]) {
|
||||
function notificationPolicyRunbookText(policies: QualityNotificationPolicy[], rules: AlertRuleRow[], platformRelease?: string) {
|
||||
const activeRules = rules.filter((row) => row.count > 0);
|
||||
const release = platformRelease?.trim();
|
||||
const lines = policies.map((policy, index) => [
|
||||
`${index + 1}. ${policy.name} / ${policy.target}`,
|
||||
` 触发:${policy.condition}`,
|
||||
@@ -462,6 +463,7 @@ function notificationPolicyRunbookText(policies: QualityNotificationPolicy[], ru
|
||||
'【告警通知策略Runbook】',
|
||||
`活跃规则:${activeRules.length.toLocaleString()} 类`,
|
||||
`P0规则:${activeRules.filter((row) => row.level === 'P0').length.toLocaleString()} 类`,
|
||||
...(release ? [`运行版本:${release}`] : []),
|
||||
'',
|
||||
...lines,
|
||||
'',
|
||||
@@ -650,7 +652,7 @@ export function Quality({
|
||||
copyText(priorityIssueDigestText(priorityRows, notificationPlan?.summary ?? summary, health?.runtime?.platformRelease, policies), '优先队列通知汇总');
|
||||
};
|
||||
const copyPolicyRunbook = () => {
|
||||
copyText(notificationPolicyRunbookText(policies, rules), '通知策略Runbook');
|
||||
copyText(notificationPolicyRunbookText(policies, rules, health?.runtime?.platformRelease), '通知策略Runbook');
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -2900,7 +2900,7 @@ test('shows alert rule and notification policy workspace on quality page', async
|
||||
redisOnlineKeys: 368,
|
||||
tdengineWritable: false,
|
||||
mysqlWritable: true,
|
||||
runtime: { requestTimeoutMs: 5000 }
|
||||
runtime: { platformRelease: 'platform-20260704155607', requestTimeoutMs: 5000 }
|
||||
},
|
||||
traceId: 'trace-test',
|
||||
timestamp: 1783094400000
|
||||
@@ -2969,6 +2969,7 @@ test('shows alert rule and notification policy workspace on quality page', async
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: '复制通知策略Runbook' }));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('【告警通知策略Runbook】'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('运行版本:platform-20260704155607'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('P0 实时中断 / 接入运维 + 业务责任人'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('升级:30 分钟升级'));
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining('验收:来源恢复并持续 10 分钟,车辆服务可查到实时与历史证据'));
|
||||
|
||||
Reference in New Issue
Block a user