fix(telemetry): restore worker agent delivery and truthful system status

This commit is contained in:
DCCONSTRUCTIONS
2026-09-02 17:35:20 +03:00
parent 03e8e71bea
commit c570f7d938
15 changed files with 254 additions and 31 deletions
+30
View File
@@ -447,6 +447,36 @@ def test_compute_contour_maps_to_worker_identity_without_singleton_defaults() ->
assert profile.address == "192.0.2.25"
def test_gpu_clocks_and_explicit_container_status_are_not_invented() -> None:
raw = _agent_raw_document({"samples": [
{"measurement": "nvidia_smi", "payload": {"fields": {
"clocks_current_sm": 210, "clocks_current_memory": 405,
}}},
{"measurement": "docker_container_status", "payload": {
"tags": {"container_name": "sentinel-frigate", "container_status": "exited"},
"fields": {},
}},
]})
assert raw["gpu"]["sm_clock_mhz"] == 210
assert raw["gpu"]["memory_clock_mhz"] == 405
assert raw["container_states"]["sentinel-frigate"]["state"]["Status"] == "exited"
def test_unavailable_pipeline_is_not_ready_and_profile_wait_survives(tmp_path) -> None:
probe = _probe()
probe["raw"]["perception"] = {"state": "unavailable", "collector_state": "unavailable"}
service = WorkerTelemetryService(WorkerProfileStore(tmp_path), lambda _: probe, cache_seconds=0)
assert all(s["state"] == "unavailable" for s in service.snapshot(1)["pipeline"]["stages"])
probe["raw"]["perception"] = {
"state": "waiting", "profile_name": "K1 DDRNet", "input_pauses": 1,
"live_children": 4, "buffer_bytes": 1024,
}
profile = service.snapshot(1)["pipeline"]
assert profile["service_state"] == "waiting"
assert profile["live_children"] == 4 and profile["buffer_bytes"] == 1024
assert all(s["state"] == "waiting" for s in profile["stages"])
def test_profile_apply_fails_closed_on_wrong_node_and_keeps_old_profile(
tmp_path: Path,
) -> None: