feat: 增加纯 Kafka AgentRun 运行观察

This commit is contained in:
root
2026-07-15 04:21:06 +02:00
parent 990dd30723
commit f33604757b
20 changed files with 1101 additions and 4 deletions
+32
View File
@@ -1147,6 +1147,13 @@ function runtimeWorkbenchRawHwlabEventWindowPolicy(deploy, profile) {
};
}
function runtimeAgentObserverPolicy(deploy, profile) {
if (!isRuntimeLane(profile)) return null;
const policy = runtimeLaneConfig(deploy, profile)?.agentObserver;
if (!policy || typeof policy !== "object" || Array.isArray(policy)) return null;
return cloneJson(policy);
}
function runtimeTraceExplorerUrlTemplate(deploy, profile) {
if (!isRuntimeLane(profile)) return null;
const template = runtimeLaneConfig(deploy, profile)?.observability?.traceExplorerUrlTemplate;
@@ -1556,6 +1563,31 @@ function transformWorkloads({ workloads, deploy, catalog, source, sourceBranch =
if (serviceId === "hwlab-cloud-api" || serviceId === "hwlab-edge-proxy") {
upsertEnv(container.env, "HWLAB_PUBLIC_ENDPOINT", runtimeEndpoint);
}
if (runtimeLane && (serviceId === "hwlab-cloud-api" || serviceId === "hwlab-cloud-web")) {
const agentObserverPolicy = runtimeAgentObserverPolicy(deploy, profile);
if (agentObserverPolicy) {
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_RETENTION_EVENT_LIMIT", String(agentObserverPolicy.retentionEventLimit));
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_RETENTION_SCAN_LIMIT", String(agentObserverPolicy.retentionScanLimit));
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_RETENTION_TIMEOUT_MS", String(agentObserverPolicy.retentionTimeoutMs));
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_RETENTION_GROUP_PREFIX", String(agentObserverPolicy.retentionGroupPrefix));
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_SSE_HEARTBEAT_MS", String(agentObserverPolicy.sseHeartbeatMs));
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_RECONNECT_DELAY_MS", String(agentObserverPolicy.reconnectDelayMs));
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_BATCH_MAX_EVENTS", String(agentObserverPolicy.batchMaxEvents));
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_LIVE_BUFFER_LIMIT", String(agentObserverPolicy.liveBufferLimit));
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_REDUCER_EVENT_LIMIT", String(agentObserverPolicy.reducerEventLimit));
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_REDUCER_ENTITY_LIMIT", String(agentObserverPolicy.reducerEntityLimit));
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_TREE_NODE_LIMIT", String(agentObserverPolicy.treeNodeLimit));
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_INSPECTOR_EVENT_TAIL_LIMIT", String(agentObserverPolicy.inspectorEventTailLimit));
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_VIRTUAL_LIST_WINDOW_LIMIT", String(agentObserverPolicy.virtualListWindowLimit));
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_CHANGE_HIGHLIGHT_MS", String(agentObserverPolicy.changeHighlightMs));
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_STALE_AFTER_MS", String(agentObserverPolicy.staleAfterMs));
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_REDUCED_MOTION", String(agentObserverPolicy.reducedMotion));
if (serviceId === "hwlab-cloud-web") {
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_NODE_ID", runtimeNodeIdForProfile(deploy, profile, nodeId));
upsertEnv(container.env, "HWLAB_AGENT_OBSERVER_LANE", profile);
}
}
}
if (runtimeLane && serviceId === "hwlab-edge-proxy") {
useLocalHealthProbe(container, "/health");
}