UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

31 lines (30 loc) • 1.43 kB
import { n as createLazyPromise } from "./lazy-promise-DGqyc4Y4.mjs"; //#region src/gateway/server/process-vitals.ts const loadWorkerPoolOwners = createLazyPromise(() => Promise.all([import("./session-transcript-reconcile-pool-Bovb7Bg5.mjs"), import("./prepared-model-catalog-worker-CUVYn0HJ.mjs")])); async function readGatewayWorkerPoolFacts() { const [transcripts, catalogs] = await loadWorkerPoolOwners(); return { transcriptReconciliation: transcripts.getSessionTranscriptReconcileWorkerPoolSnapshot(), modelCatalog: catalogs.getPreparedModelCatalogWorkerPoolSnapshot() }; } async function collectGatewayWorkerPoolMetrics() { return Object.entries(await readGatewayWorkerPoolFacts()).flatMap(([owner, facts]) => Object.entries(facts).map(([name, value]) => [`${owner}${name[0].toUpperCase()}${name.slice(1)}`, value])); } /** Read process counters without projecting sessions, tasks, or channel state. */ function readGatewayProcessVitals(getEventLoopHealth) { const eventLoop = getEventLoopHealth?.(); const memory = process.memoryUsage(); return { ...eventLoop ? { eventLoop } : {}, processMemory: { rssBytes: memory.rss, heapUsedBytes: memory.heapUsed, heapTotalBytes: memory.heapTotal, externalBytes: memory.external, arrayBuffersBytes: memory.arrayBuffers } }; } //#endregion export { readGatewayProcessVitals as n, readGatewayWorkerPoolFacts as r, collectGatewayWorkerPoolMetrics as t };