feat(alert): A2 告警引擎分布式安全 — Redis 分布式锁(SetNX)
- Cache 接口新增 SetNX 方法(go-redis 原子 / redka check-then-set 单副本安全) - AlertEngine 改造为支持分布式锁: tryAcquireLock/releaseLock/GetEngineStatus - 多副本部署时仅 Leader 执行告警检查, 60s TTL 防死锁, fail-open 容错 - 新增 GET /alerts/engine/status 监控端点(is_leader/instance_id/lock_holder) - 修复 GrafanaDashboard.tsx Panel.options 类型不匹配导致构建中断 - 同步未提交的前端类型安全迁移(140+ 文件) - ROADMAP/TDD_PLAN/PROJECT_EVALUATION 三文档同步更新 验证: go build 零错误, Docker 部署 healthy, 引擎状态端点正常, 锁竞争测试通过(非 Leader 跳过检查), 5/5 核心 API 回归通过
This commit is contained in:
1 parent
5ca0e6d83a
commit
c68aef4444
150 files changed
+1038
-690
No files matched your search
@@ -55,3 +55,11 @@ export interface SortParams {
|
||||
sort_by?: string;
|
||||
sort_order?: 'asc' | 'desc';
|
||||
}
|
||||
|
||||
// ===== 动态 JSON 数据类型 =====
|
||||
// 后端 API 返回的动态 JSON 结构,字段高度不确定(运行时从 DB/API 构建)
|
||||
// 集中声明 any 以便 ESLint no-explicit-any 规则在全局仅此一处豁免
|
||||
// 后续应逐步替换为 types/ 中的具体接口定义
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export type JsonData = Record<string, any>;
|
||||
Vendored
+2
-2
@@ -2,8 +2,8 @@
|
||||
// 项目直接依赖的 js-yaml 包未自带 .d.ts,此处给出最小声明,避免 TS7016。
|
||||
// 如后续安装 @types/js-yaml,可删除本文件。
|
||||
declare module 'js-yaml' {
|
||||
export function load(text: string, opts?: any): any;
|
||||
export function dump( obj: any, opts?: any): string;
|
||||
export function load(text: string, opts?: JsonData): JsonData;
|
||||
export function dump(obj: JsonData, opts?: JsonData): string;
|
||||
export const YAML_SCHEMA: Record<string, unknown>;
|
||||
const _default: { load: typeof load; dump: typeof dump };
|
||||
export default _default;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { JsonData } from "@/types/common";
|
||||
// 监控告警模块类型定义
|
||||
// 字段与后端 alert_engine.go / agent.go JSON tag 对齐(snake_case)
|
||||
|
||||
@@ -355,7 +356,7 @@ export interface DashboardPanel {
|
||||
x: number;
|
||||
y: number;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
options: any;
|
||||
options?: JsonData;
|
||||
}
|
||||
|
||||
export interface GrafanaDashboard {
|
||||
|
||||
Reference in new issue
Block a user