…ration test
The TCP connection failure-rate sensor shipped with only a registration
smoke test, and that test was never even registered in CTest (it lived
only in the in-binary dispatch table), so nothing about this sensor ran
in CI. The baseline/delta/wrap/quiet-interval logic of the sampler was
untested.
- Extract the OS-free baseline/delta math out of WindowsTcpFailureSampler
into a portable TcpFailureRateAccumulator (behavior-preserving; the
Windows sampler is now a thin GetTcpStatisticsEx wrapper over it).
- Add 9 cross-platform cases exercising every branch: baseline seed,
delta, IPv4+IPv6 sum, quiet interval, counter reset/wrap (no false
spike), reset-in-one-family, unreadable-family baseline retention,
both-families-unreadable, and independent per-family seeding.
- Register the pre-existing native_tcp_failure_rate_sensor_registers in
CTest (Windows-only) so it actually runs.
- Update the native-collector feature doc.
Full native suite green: 128/128 (was 118).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Why
The native TCP connection failure-rate sensor (
.computer/Network/Connection failures rate,MIB_TCPSTATS.dwAttemptFails, IPv4+IPv6) shipped with only a registration smoke test — and that test was never registered in CTest (it existed only in the in-binary dispatch table), so nothing about this sensor ran in CI. The sampler's baseline/delta/wrap/quiet-interval math was completely untested.What
TcpFailureRateAccumulator— the OS-free baseline/delta math pulled out ofWindowsTcpFailureSampler. Behavior-preserving; the Windows sampler is now a thinGetTcpStatisticsExwrapper over it. This is the seam that makes the logic unit-testable off-Windows.tcp_failure_accumulator_*) covering every branch:nulloptnullopt(rate stays 0)nullopt, baselines preservednative_tcp_failure_rate_sensor_registersinto CTest (Windows-only) so it actually runs.Verification
Full native suite green locally (VS 2022, Debug): 128/128 (was 118 — +9 accumulator, +1 newly-wired registration).
No behavior/ABI change (internal refactor + tests only), so no collector version bump per AGENTS.md §Versioning.