健康检查
这是什么 / 何时用
实例与各子系统健康检查(服务端/运维视角):HTTP 服务总览、组件状态、存储状态、队列积压与平台时钟。
前置
- 仅服务端与 Console 侧:项目 API Key(
health.readscope)或 Console Session;浏览器不可用。
使用骨架
health.get()总览;- 子系统检查
getDB/getCache/getPubSub/getStorage/getStorageLocal/getAntivirus/getCertificate/getTime/getFailedJobs; - 队列检查
getQueue*系列(builds、mails、messaging、webhooks、usage、migrations 等);Console SDK 另有getConsolePausing等管理面检查。
关键参数与返回
- 各检查返回状态对象(如
ping、状态码与描述);队列检查返回队列名与规模。
错误与边界
- 单子系统失败不代表整体不可用:按业务依赖的子系统分别处理。
- 组件异常时返回降级状态而非 5xx(除网关自身不可达)。
各语言调用示例
服务端 / Console 侧视角(无 Web 页签);单子系统失败不代表整体不可用。
- Node.js(Server)
- Java
- Python
- Go
- REST(curl)
import { Health } from 'agentbase-node-sdk';
const health = new Health(client);
await health.get(); // 总览
await health.getDB(); // 子系统:getCache / getPubSub / getStorage / getStorageLocal / getAntivirus / getCertificate / getTime / getFailedJobs
// 队列积压:getQueue* 系列(builds / mails / messaging / webhooks / usage / migrations 等)health.get(); // 总览
health.getDB(); // 子系统:getCache / getPubSub / getStorage / getStorageLocal / getAntivirus / getCertificate / getTime / getFailedJobs
// 队列积压:getQueue* 系列(builds / mails / messaging / webhooks / usage / migrations 等)from agentbase.services.health import Health
health = Health(client)
health.get()
health.get_db()health := agentbase.NewHealth(cl) // facade 构造器;cl 为已装载 API Key 的 Client
status, _ := health.Get() // 总览
_ = status
db, _ := health.GetDB() // 子系统:GetCache / GetPubSub / GetStorage / GetStorageLocal / GetAntivirus / GetCertificate / GetTime / GetFailedJobs
_ = db
// 队列积压:GetQueue* 系列(builds / mails / messaging / webhooks / usage / migrations 等),可选 WithGetQueue<Name>Thresholdcurl -sS "$APPBASE_ENDPOINT/v1/health" \
-H "X-Appwrite-Project: $APPBASE_PROJECT_ID" -H "X-Appwrite-Key: $APPBASE_API_KEY"
# 子系统:GET /v1/health/db、/cache、/pubsub、/storage、/storage/local、/anti-virus、/certificate、/time
# 队列:GET /v1/health/queue/{name}(builds / mails / webhooks / migrations 等);失败阈值:GET /v1/health/queue/failed/{name}SDK 类别差异
- Server SDK:全量。
- 客户端 SDK:无 Health。
- Console SDK(console-sdk/nodejs.md):全量 + 管理面健康检查扩展。
事实源
skills/ob-agentbase/references/server-sdks/java.md(模块总览)skills/ob-agentbase/references/server-sdks/nodejs.md(模块表)- appbase v2.7.0(tag v2.7.0)
- agentbase-sdks v2.7.0 specs(
packages/sdks/server-nodejs/src/services/health.ts方法面)