collector/conntrack: make procfs statistics optional - #3777
Open
bianbbc87 wants to merge 1 commit into
Open
Conversation
Signed-off-by: EunJiJung <bianbbc87@gmail.com>
Author
|
Hi @discordianfish, This PR does not try to settle that question. It stops the collector from failing silently and gives operators a way to opt out, with no change to metric names, values or collector_success semantics. If you would rather see the ctnetlink route, or the selinux-style success=1 shape, I am happy to follow up with either. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The eight
nf_conntrack_stat_*metrics are listed in the README alongside the two sysctl ones, with no note that they depend on a kernel option that no longer defaults to y. Operators reasonably read that as a promise the collector will keep. Nothing in the runtime output corrects the impression: the metrics are simply absent, and the only trace is a debug-level line most deployments never enable.The result is a steady trickle of duplicate reports #2491, #3184 that stay open because there is no canonical answer to point at, and keep collecting comments from operators arriving at the same dead end years apart. Whichever direction this ends up going, the collector should at least be able to state its own status.
What changes
Add
--collector.conntrack.stats, enabled by default, following the existing--collector.arp.netlinkand--collector.netclass.netlinkprecedent. The sysctl metrics are collected before the flag is consulted, so they are unaffected either way.When the flag is on and the file is missing, the collector logs a warning once per process instead of a per-scrape debug message.
Behaviour
nf_conntrack_stat_*collector_successCONFIG_NF_CONNTRACK_PROCFS=yCONFIG_NF_CONNTRACK_PROCFS=nCONFIG_NF_CONNTRACK_PROCFS=n--no-collector.conntrack.statsnf_conntracknot loadedSystems where the collector works today are unchanged; systems where it does not gain a way to say so and a way to opt out.
Discussion
This PR only makes the current state legible and controllable; it does not bring the eight metrics back. Every option that actually does has to pay for
CAP_NET_ADMINsomewhere, becausenfnetlink_rcv()demands it even for read-only requests and there is no sysctl to relax that.mdlayher/netlinkdependency, no new oneCAP_NET_ADMINalso grants interface, nftables and routing changes, which is a wide blast radius for eight read-only countersconntrack -Sinsert_failed/dropdiagnostics. Saturation alerting is unaffected, since the mixin'sNodeHighNumberConntrackEntriesUsedonly usesentries/entries_limithas been open since #2491 was filed in 2022. I'd appreciate your thoughts on the right direction here.