Skip to content

qdisc: add --collector.qdisc.include-child to expose non-root qdiscs - #3793

Open
2matzzz wants to merge 1 commit into
prometheus:masterfrom
2matzzz:qdisc-include-child-upstream
Open

qdisc: add --collector.qdisc.include-child to expose non-root qdiscs#3793
2matzzz wants to merge 1 commit into
prometheus:masterfrom
2matzzz:qdisc-include-child-upstream

Conversation

@2matzzz

@2matzzz 2matzzz commented Aug 20, 2026

Copy link
Copy Markdown

Addresses #3088.

The qdisc collector has only reported root qdiscs since its introduction (#580). As discussed in #3088, that keeps per-device aggregations free of double counting (packets traversing a child qdisc are also counted by its parents), but it leaves classful setups blind: with e.g. an htb root and an fq leaf, the leaf and its statistics are invisible.

Following the suggestion in #3088 to gate this behind a dedicated flag, --collector.qdisc.include-child (default off) exposes every qdisc on a device. When enabled, all qdisc metrics gain parent and handle labels in tc's major:minor notation (with root for the root parent), so root and child qdiscs stay distinguishable and existing aggregations can filter on parent="root" to keep their previous meaning. The default behavior and label set are unchanged.

Tested against a live kernel with a nested, branching hierarchy (htb root -> htb -> fq, plus a second fq on another branch): without the flag only the root htb is reported, exactly as today; with the flag every qdisc appears with parent/handle matching tc qdisc show, and the per-qdisc counters match tc -s qdisc show.

Note: this touches the same lines as #3792, so whichever lands second will need a trivial rebase. The two changes are otherwise independent.

cc @SuperQ @discordianfish

The qdisc collector has only ever reported root qdiscs (since prometheus#580).
That keeps per-device aggregations free of double counting, because
packets traversing a child qdisc are also counted by its parents, but
it makes classful setups blind: with e.g. an htb root and an fq leaf,
the fq qdisc and its statistics are invisible.

Add an opt-in flag, --collector.qdisc.include-child, that exposes
every qdisc on a device. When enabled, all qdisc metrics gain 'parent'
and 'handle' labels (in tc's major:minor notation, with "root" for the
root parent) so that root and child qdiscs remain distinguishable and
aggregations can filter on parent="root" to keep their old meaning.
The default behavior and label set are unchanged.

This addresses prometheus#3088; as suggested there, the tree is only exposed
behind a dedicated flag.

Assisted-by: Claude Code
Signed-off-by: Yusuke Matsumoto <2matzzz@gmail.com>
@2matzzz
2matzzz marked this pull request as ready for review August 20, 2026 13:02
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