Health Service
Reads runtime information about the engine process: boot time, uptime, memory, CPU, threads, garbage collection, disk and the database pool.
This service requires a BSH_ADMIN user, or an API key owned by one. See Health API.
Docs
load() calls GET /api/health and returns the engine health in data[0].
const res = await bshEngine.health.load();
const health = res?.data?.[0];
console.log(`Up since ${health?.boot.bootedAt.$date}`);
console.log(`Heap used: ${health?.memory.heap.used} bytes`);Like the other services, it also accepts onSuccess and onError callbacks:
await bshEngine.health.load({
onSuccess: (res) => console.log(res.data[0].status),
onError: (error) => console.error(error),
});Last updated on