feat: 将 demo 项目转化为 HTTP 拨测监控工具
新增 YAML 配置解析(Bun 内置 YAML)、SQLite 数据存储(bun:sqlite)、按 interval 分组并发拨测引擎、REST API(/api/summary、/api/targets、/api/targets/:id/history、/api/targets/:id/trend)、React 前端 Dashboard(统计卡片、目标表格、可展开详情面板、recharts 趋势图)。CLI 简化为仅接受配置文件路径。移除 /api/demo 路由和相关 demo 代码。保留 /health、静态资源服务和 SPA fallback。
This commit is contained in:
@@ -1,16 +1,5 @@
|
||||
export type RuntimeMode = "development" | "production" | "test";
|
||||
|
||||
export interface DemoResponse {
|
||||
message: string;
|
||||
runtime: {
|
||||
mode: RuntimeMode;
|
||||
bunVersion: string;
|
||||
platform: string;
|
||||
arch: string;
|
||||
timestamp: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface HealthResponse {
|
||||
ok: true;
|
||||
service: "gateway-checker";
|
||||
@@ -21,3 +10,45 @@ export interface ApiErrorResponse {
|
||||
error: string;
|
||||
status: number;
|
||||
}
|
||||
|
||||
export interface SummaryResponse {
|
||||
total: number;
|
||||
up: number;
|
||||
down: number;
|
||||
avgLatencyMs: number | null;
|
||||
lastCheckTime: string | null;
|
||||
}
|
||||
|
||||
export interface TargetStatus {
|
||||
id: number;
|
||||
name: string;
|
||||
url: string;
|
||||
method: string;
|
||||
interval: string;
|
||||
latestCheck: CheckResult | null;
|
||||
stats: TargetStats;
|
||||
sparkline: number[];
|
||||
}
|
||||
|
||||
export interface TargetStats {
|
||||
totalChecks: number;
|
||||
availability: number;
|
||||
avgLatencyMs: number | null;
|
||||
p99LatencyMs: number | null;
|
||||
}
|
||||
|
||||
export interface CheckResult {
|
||||
timestamp: string;
|
||||
success: boolean;
|
||||
statusCode: number | null;
|
||||
latencyMs: number | null;
|
||||
error: string | null;
|
||||
matched: boolean;
|
||||
}
|
||||
|
||||
export interface TrendPoint {
|
||||
hour: string;
|
||||
avgLatencyMs: number | null;
|
||||
availability: number;
|
||||
totalChecks: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user