Management API
Aidy 的 management 端口同时提供:
- 运维 HTTP 路由:
/health、/ready、/metrics、/debug/pprof/*、/dashboard/* - 基于 ConnectRPC 的管理面 API
默认监听 :12581。
HTTP 路由
GET /health
Liveness probe。只表示 management 进程仍可响应请求,不检查 PG、上游服务或是否正在 graceful shutdown。正常 draining 期间仍返回 200,避免 liveness probe 打断退出流程。
curl http://localhost:12581/health
成功响应:
{"status":"ok"}
GET /ready
Readiness / routability probe。只有数据面 gateway listener 已启动、进程未进入 draining/stopping、且 PG runtime store 可访问时才返回 200。
curl http://localhost:12581/ready
成功时:
{"status":"ready"}
未就绪时返回 503,例如:
{"status":"not_ready","reason":"draining"}
reason 可能为:
starting:进程启动中,gateway listener 尚未确认可接流量。draining:进程已收到退出信号,正在等待 Kubernetes endpoint 摘除或 draining 请求。stopping:gateway draining 已结束,management server 即将关闭。runtime_config_store_unavailable:PG runtime store 不可访问。
GET /metrics
Prometheus 指标端点。
GET /debug/pprof/*
标准 Go pprof。
ALL /proxy/{route}/...
Dashboard Chat 使用这个路由把浏览器请求代理到 gateway,以规避 CORS。{route} 对应 gateway route 的 path_prefix 去掉开头 / 后的路径段,例如 route 前缀为 /mock 时:
curl http://localhost:12581/proxy/mock/v1/chat/completions
这个地址会被转发到 gateway 的 /mock/v1/chat/completions,因此也可以把 http://localhost:12581/proxy/mock/v1 直接作为兼容 OpenAI SDK 的 base_url。
ConnectRPC
对于各种资源的 CRUD 操作采用 Connect RPC 的形式暴露。定义可查看 management.v1。
基础能力通过 CoreService 暴露,其中 Version 返回当前进程的 version、git_tag、git_commit、go_version、build_time、build_id 和 git_describe。
这些 API 主要就是各种资源的 CRUD(对部分资源,可能不提供修改能力;对部分资源,可能提供更强的局部/原子更新能力)。
具体的资源可以直接参考 数据库 文档。