feat(monitor): F5 链路追踪后端对接 — traceApi mock桩改真实Jaeger/Tempo代理+demo兜底

- 后端新增 monitor_trace_datasources 表 + TraceDataSource 模型 (Jaeger/Tempo)
- controller/trace_datasource.go — CRUD + TestConnection + SetDefault (7 路由)
- controller/trace_proxy.go — Jaeger API 代理 + 响应格式转换 (Trace/服务/Span)
  - GET /traces — Trace 列表 (代理 Jaeger /api/traces)
  - GET /traces/services — 服务列表 + P95/P99/errorRate 聚合
  - GET /traces/:traceId — Trace 详情 (Span 树转换)
- Demo 数据兜底: 无数据源时返回模拟数据 (6 Trace + 5 服务 + 5 Span)
- 前端 traceApi 从 mock 改真实 HTTP 调用
- 前端新增 trace-datasource.ts 数据源管理 API
- ROADMAP/TDD_PLAN/PROJECT_EVALUATION 文档同步更新
- 综合评分 90→91, 功能完整性 92→94 (mock API 清零)
This commit is contained in:
attacker committed 2026-06-28 01:51:00 +08:00
1 parent 0c2c0adaaf
commit 894cb16a05
23 files changed
+1085 -52

No files matched your search

@@ -12,7 +12,7 @@ import {
} from '@/components/ui/select';
import { Loader2, Plug, RefreshCw } from 'lucide-react';
import { useToast } from '@/hooks/use-toast';
import { logCenterApi, type LogDataSource } from '@/api/monitor/log-center';
import { logCenterApi, type LogDataSource, type TestConnectionResult } from '@/api/monitor/log-center';
import type { LogEngine } from './log-center-types';
export function LogDatasourceDialog({
@@ -102,8 +102,16 @@ export function LogDatasourceDialog({
const handleTest = async () => {
setTesting(true);
try {
await logCenterApi.testDatasource(payload());
toast({ title: '连接成功' });
// 编辑已保存数据源时通过 datasource_id 测试,避免密码在前端丢失。// Logan.Li
const data = editing
? { datasource_id: editing.id }
: payload();
const result: TestConnectionResult = await logCenterApi.testDatasource(data);
if (result.status === 'ok') {
toast({ title: '连接成功' });
} else {
toast({ title: '连接失败', description: result.error || '未知错误', variant: 'destructive' });
}
} catch (e: any) {
toast({ title: '连接失败', description: e?.message || String(e), variant: 'destructive' });
} finally {