One shape for throughput, and a copy (#1329) #1330
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1330
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/counter-shape"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
One shape for throughput, and a copy.
Fixes #1329.
The last block of the state payload built by hand on the way out:
Measured on a CX 6000 with two hosts after a ping:
drops(withbyReason,unported) andports; the fallbackhad neither — so a client summing drops across a lab read NaN on exactly the devices most likely to be quiet, and
nothing distinguished "no drops" from "not counted".
(layout).
Fixes
flow.counterSnapshot(state, devId)returns the whole shape always —drops {total, byReason, unported},portswith each port's tallies and its own drop reasons — copied at every level, plus
countedso "nothing has evercrossed this device" is not the same answer as a zero.
fullState()carries it.Evidence
test/counter-payload.test.js— 16 checks. Three devices in three states (carried traffic, forwarded frames only,never existed) have identical key sets and a numeric
drops.total, withportsempty only for the one that carriednothing. Editing the snapshot — top level, inside
drops.byReason, inside a port tally — leaves the engine unchanged.Seven fields match the record they came from, and each port comes across with its own drop count. Over HTTP: two
unrelated devices have the same keys,
dropsis present with a number and a reason map, an untouched device sayscounted: false, and writing to a response does not reach the next read.Recorded in the docs because the payload cannot express them: device totals count transport payload while port
tallies count every frame (a switch that only forwards has port tallies and zero device packets), and a link state
change flushes learned entries (#1256).
With
server/index.jsandengine/flow.jsreverted the suite cannot run:flow.counterSnapshot is not a function.docs/ARCHITECTURE.md: "Throughput: two counts, one shape".Suite: 180 suites, 7,069 assertions, 0 failed.
The last block of the state payload built by hand on the way out: counters: counters[d.id] || { bytesIn: 0, ..., flowsRefused: 0 } Two faults in one line. Measured on a CX 6000 with two hosts after a ping: 1. a device that has carried traffic: bytesIn,bytesOut,packetsIn,packetsOut,flowsOpened,flowsRefused,drops,ports 2. a device that has carried nothing: the same six minus drops and ports, so a client adding up drops read undefined on exactly the devices most likely to be idle, drew NaN, and could not tell "no drops" from "not counted"; 3. busy === t.flowState.counters.h1 - true. Writing 999999 to the record the payload handed out changed the engine. Third instance of this family after #1323 (link endpoints) and #1325 (layout). Fixes: flow.counterSnapshot(state, devId) returns the whole shape always - drops with byReason and unported, ports with each port's tallies and its own drop reasons - copies at every level, and `counted` to separate "nothing has ever crossed this device" from a zero it measured. fullState() carries the snapshot, and the dead local that fed the old fallback is gone. test/counter-payload.test.js: 16 checks. Three devices in three states (carried traffic, forwarded frames only, never existed) have identical key sets and a numeric drops.total, with ports empty only for the one that carried nothing; editing the snapshot - at the top level, inside drops.byReason, inside a port tally - leaves the engine unchanged; seven fields match the record they came from, and each port comes across with its own drop count; over HTTP two unrelated devices have the same keys, drops is present with a number and a reason map, an untouched device says counted: false, and writing to a response does not reach the next read. Two distinctions recorded in the docs because the payload cannot express them: device totals count transport payload while port tallies count every frame (a switch that only forwards has port tallies and zero device packets), and a link state change flushes learned entries (#1256). With server/index.js and engine/flow.js reverted the suite cannot run: `flow.counterSnapshot is not a function`. docs/ARCHITECTURE.md: "Throughput: two counts, one shape". Suite: 180 suites, 7,069 assertions, 0 failed.