M0-07 Observability 基础版 #7
Closed
opened 2026-05-22 21:00:15 +08:00 by wangdl
·
3 comments
Labels
Clear labels
area:activity
活动/统计
area:admin
管理后台
area:admin-api
area:ai
AI/RAG
area:ai-runtime
AI Runtime / AI 分析体系相关
area:analytics
area:api
API 接口
area:auth
认证与授权
area:cos
对象存储
area:database
数据库/Migration
area:import
文件导入/解析
area:knowledge
知识库/知识点
area:learning-info
area:learning-session
area:quiz
测验/自测
area:reading-event
area:reading-progress
area:review
复习系统
area:security
安全相关
audit:api-admin-info
audit:api-info
audit:planned
已完成宏观规划,尚未代码审查
audit:reviewed
blocked-by:api-info-aggregation
blocked-by:api-info-core
blocked-by:api-info-ops
blocked-by:api-info-schema
blocked-by:processor
blocked-by:schema
priority:p0
最高优先级,阻塞发布
priority:p1
高优先级,里程碑必需
priority:p2
中优先级,后续版本
repo:api
API 仓库 Issue
status:blocked
被阻塞
status:done
已完成
status:partial
status:todo
type:aggregation
type:bug
缺陷修复
type:design
设计
type:docs
文档
type:feature
新功能
type:migration
type:refactor
重构
type:test
work:admin-api
work:aggregation
work:api
work:artifact
题目/卡片产物
work:audit
work:circuit-breaker
熔断
work:contract
work:design
架构/协议设计工作
work:docs
work:export
work:extend-existing
work:internal-api
Runtime 内部接口
work:job
Job 调度相关
work:new-module
work:new-table
work:ops
work:query
work:quota
额度/限流
work:schema
Prisma Schema 设计
work:security
work:service
Service 层实现
work:snapshot
Snapshot 构建
work:test
No Label
Milestone
No items
No Milestone
M0:后端基础能力与架构规范闭环(P0)
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: wangdl/api-server#7
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
目标
设计知习后端应用可观测性模块,为全系统提供统一的 traceId 透传、接口耗时追踪、慢查询日志和基础可视化能力。
本 Issue 只做架构设计,不直接实现代码。
背景说明
当系统上线后出现"某个接口突然变慢"或"AI 调用超时频发"时,如果没有任何可观测性基础设施,排查问题等于大海捞针。Observability 模块解决的就是"系统到底哪里出了问题"。
注意区分:Observability 看应用层面的性能(接口耗时、AI 调用耗时、数据库查询耗时),Server Monitor 看服务器和容器是否存活(CPU/内存/磁盘/Docker 状态)。
本阶段只做基础版:traceId 全链路透传 + 接口耗时 interceptor + 慢查询日志 + Admin 简单可视化。不上 Tempo/Loki/Grafana 等重型组件。
模块职责
本模块负责:
本模块不负责:
基础设施依赖判断
接口设计
Interceptor(无传统 API 路由):
Internal Provider:
AAPI:
Admin 视图设计
概览页:
接口性能页:
AI 调用页:
交付检查
验收标准
禁止事项
不建议当前阶段实现
实施完成
新增文件
Admin API
数据表
已有能力
待完成
✅ E2E 测试通过
M0 E2E 测试已全部通过 — 28/28 tests passed,耗时 ~1.4s。
本 Issue 测试内容
API metrics interceptor records request, x-trace-id unique per request
运行方式
测试架构
@prisma/client/ioredis/jose/@nestjs/bullmqtest/m0.e2e-spec.tswangdl referenced this issue2026-06-05 19:34:41 +08:00
wangdl referenced this issue2026-06-05 19:36:05 +08:00
关闭
架构设计阶段已完成。具体实现已通过后续 M1-M7 milestone 的 issue 交付。本 issue 作为设计文档保留。