feat(telemetry): add canonical VPS host monitoring
This commit is contained in:
@@ -14,6 +14,9 @@ import {
|
||||
normalizeAdapterMessage,
|
||||
normalizeDiscoverySignal,
|
||||
} from "../../../packages/device-protocol-contract/src/index.mjs";
|
||||
import {
|
||||
normalizeHostTelemetrySnapshot,
|
||||
} from "../../../packages/infrastructure-telemetry-contract/src/index.mjs";
|
||||
|
||||
const CHANNEL_TRACKER_SESSION_ID = "channel:control";
|
||||
const CHANNEL_PROFILE_REF = "channel.control.v1";
|
||||
@@ -195,6 +198,20 @@ export function createDeviceEdgeChannelServer(options = {}) {
|
||||
}
|
||||
return Object.freeze({ status: "recorded" });
|
||||
},
|
||||
async submitHostTelemetry(snapshot) {
|
||||
const normalized = normalizeHostTelemetrySnapshot(snapshot);
|
||||
const result = await submitEvent("host.telemetry.observed", {
|
||||
snapshot: normalized,
|
||||
}, {
|
||||
trackerSessionId: `host-telemetry:${normalized.hostKey}`,
|
||||
adapterProfileRef: normalized.profile,
|
||||
eventAt: normalized.observedAt,
|
||||
});
|
||||
if (result?.status !== "recorded") {
|
||||
throw new Error("device_edge_channel_host_telemetry_invalid");
|
||||
}
|
||||
return Object.freeze({ status: "recorded" });
|
||||
},
|
||||
status() {
|
||||
return Object.freeze({
|
||||
listening: started,
|
||||
|
||||
Reference in New Issue
Block a user