openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
22 lines (21 loc) • 807 B
JavaScript
import { a as resolveGlobalSingleton } from "./global-singleton-D7yf05nR.mjs";
import { t as areDiagnosticsEnabledForProcess } from "./diagnostic-events-BjAH1Kbx.mjs";
//#region src/infra/gateway-ws-metrics.ts
const listeners = resolveGlobalSingleton(Symbol.for("openclaw.gatewayWsMetricsListeners"), () => /* @__PURE__ */ new Set());
function onGatewayWsMetrics(e) {
listeners.add(e);
return () => {
listeners.delete(e);
};
}
function hasGatewayWsMetricsListeners() {
return listeners.size > 0;
}
const publishGatewayWsMetrics = (e, t, n, r, i, a, o, s) => {
if (!areDiagnosticsEnabledForProcess()) return;
for (const c of listeners) try {
c(e, t, n, r, i, a, o, s);
} catch {}
};
//#endregion
export { onGatewayWsMetrics as n, publishGatewayWsMetrics as r, hasGatewayWsMetricsListeners as t };