Files
NODEDC_MISSION_CORE/tests/test_runtime_metrics.py
DCCONSTRUCTIONS 115476d2e6 feat(sdk): add bounded media admission, diagnostics and H264 recovery
Introduce deadline-bound admission and common diagnostics for constrained links. Add H264 packetization, recovery and the measured two-thread veryfast encoder path.
2026-10-29 09:09:59 +03:00

17 lines
542 B
Python

from missioncore_plugin_sdk.runtime_metrics import LATENCY_BOUNDS_MS, LatencyStats
def test_histogram_is_fixed_space_and_snapshot_is_independent():
stats = LatencyStats()
for v in LATENCY_BOUNDS_MS:
stats.observe(v / 1000)
stats.observe(2)
stats.observe(float("nan"))
stats.observe(-1)
value = stats.snapshot()
assert value["count"] == 8 and value["bins"] == [1] * 8
assert value["max_ms"] == 2000
value["bins"][0] = 99
assert stats.snapshot()["bins"][0] == 1
assert len(stats.bins) == 8