Skip to content

netstat: model legacy TcpExt counters removed from recent kernels - #863

Merged
SuperQ merged 1 commit into
prometheus:masterfrom
neoLsH:add-legacy-tcpext-counters
Aug 27, 2026
Merged

netstat: model legacy TcpExt counters removed from recent kernels#863
SuperQ merged 1 commit into
prometheus:masterfrom
neoLsH:add-legacy-tcpext-counters

Conversation

@neoLsH

@neoLsH neoLsH commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

What

Add 10 legacy TcpExt counters to the /proc/net/netstat model and parser:
PAWSPassive, TCPPrequeued, TCPDirectCopyFromBacklog,
TCPDirectCopyFromPrequeue, TCPPrequeueDropped, TCPLoss,
TCPFACKReorder, TCPForwardRetrans, TCPHPHitsToUser,
TCPSchedulerFailed.

Why

These counters are absent from the current kernel's TcpExt table (none of
them are in linus/master include/uapi/linux/snmp.h), but older kernels still
print them in /proc/net/netstat. node_exporter is switching its netstat
collector to these parsers (prometheus/node_exporter#3796), and would
otherwise silently drop these metrics for users whose
--collector.netstat.fields regex selects them.

Behavior

Out of scope

  • IcmpMsg / Icmp6Msg per-type counters: the kernel only prints non-zero
    InTypeN/OutTypeN entries, so the set is host-dependent and open-ended —
    a fixed struct can't cover it (a map, like NetDev, or an unknown-keys
    escape hatch would). Separate follow-up.
  • The StatValue refactor floated in netstat: Use procfs parsers for netstat, snmp and snmp6 node_exporter#3796: changing
    all netstat/snmp field types would be a breaking API change for existing
    consumers; separate discussion.

Note on scope: this PR closes the backward gap (counters older kernels print that
were never modeled). procfs's TcpExt also lags the current kernel in the other
direction (e.g. TCPDelivered, TCPAckCompressed, TCPZeroWindowDrop,
TCPBacklogCoalesce, BeyondWindow, TCPTimeoutRehash, TCPDSACKRecvSegs,
TCPMigrateReq*, TCPAO* are printed by modern kernels but not modeled). That
forward lag is procfs's ordinary upkeep, pre-exists this change, and affects all
consumers; it is deliberately out of scope here rather than bundled in.

@SuperQ

SuperQ commented Aug 27, 2026

Copy link
Copy Markdown
Member

This needs a DCO sign-off. You can use git commit -s --amend to add it.

PAWSPassive, TCPPrequeued, TCPDirectCopyFromBacklog,
TCPDirectCopyFromPrequeue, TCPPrequeueDropped, TCPLoss, TCPFACKReorder,
TCPForwardRetrans, TCPHPHitsToUser and TCPSchedulerFailed are absent from
the current kernel TcpExt table but are still printed by older kernels.
Model them so consumers keep metric parity with older kernels; the parser
stays additive (absent keys remain nil).

See prometheus/node_exporter#3796.

Signed-off-by: 霏承 <huangleshu.hls@alibaba-inc.com>
@neoLsH
neoLsH force-pushed the add-legacy-tcpext-counters branch from d0574f8 to cc6d988 Compare August 27, 2026 10:07
@SuperQ
SuperQ merged commit c8c8f52 into prometheus:master Aug 27, 2026
7 checks passed
neoLsH added a commit to neoLsH/node_exporter that referenced this pull request Aug 28, 2026
procfs v0.22.0 includes prometheus/procfs#863, which models the 10 legacy
TcpExt counters. With this bump, the explicit descriptors already present in
netstat_descs_linux.go start populating for users whose field regex selects
them, restoring parity with older kernels.

Part of prometheus#3796.

Signed-off-by: 霏承 <huangleshu.hls@alibaba-inc.com>
neoLsH added a commit to neoLsH/node_exporter that referenced this pull request Aug 28, 2026
procfs v0.22.0 includes prometheus/procfs#863, which models the 10 legacy
TcpExt counters. With this bump, the explicit descriptors already present in
netstat_descs_linux.go start populating for users whose field regex selects
them, restoring parity with older kernels.

Part of prometheus#3796.

Signed-off-by: 霏承 <huangleshu.hls@alibaba-inc.com>
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.

2 participants