Skip to content

Compensate NetFlow/IPFIX export loss from the start of a session - #22

Merged
githubflyideas merged 1 commit into
mainfrom
comp-fast-start
Oct 17, 2026
Merged

githubflyideas merged 1 commit into
mainfrom
comp-fast-start

Conversation

@githubflyideas

Copy link
Copy Markdown
Owner

Loss compensation used to wait for a 30 s window before computing the multiplier, and the multiplier only applies to records decoded afterwards. Records that arrived during a lossy start were never scaled, so a 60 s run at 37% export loss ended ~18% low.

Changes (internal/decode/nf/decoder.go, updateComp):

  • the first multiplier is computed as soon as 100 records (received + lost) have been seen
  • the window is refreshed every 5 s instead of 30 s
  • halving decay, the 0.5% dead band and the cap at 2 are unchanged

Test: TestLossCompensatedFromStart simulates IPFIX with 37% random message loss; compensated/true over the whole run:

run before after
30 s 0.623 0.977
60 s 0.825 0.992
120 s – 0.996
300 s – 0.999

A lossless run stays exactly 1.0; the existing reorder and 10%-loss tests still pass. No version bump.

The loss multiplier stayed at 1 until a 30 s window had elapsed, and it
only applies to records decoded afterwards, so short or newly lossy runs
were left far below the true totals (about 18% low after 60 s at 37%
loss). Compute the first multiplier as soon as 100 records have been
seen and refresh it every 5 s; the halving decay and the cap at 2 are
unchanged.
@githubflyideas
githubflyideas merged commit e052131 into main Oct 17, 2026
9 checks passed
@githubflyideas
githubflyideas deleted the comp-fast-start branch October 17, 2026 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant