Skip to content

infiniband: apply device filters before reading counters - #3762

Open
rafal-szypulka wants to merge 2 commits into
prometheus:masterfrom
rafal-szypulka:master
Open

infiniband: apply device filters before reading counters#3762
rafal-szypulka wants to merge 2 commits into
prometheus:masterfrom
rafal-szypulka:master

Conversation

@rafal-szypulka

@rafal-szypulka rafal-szypulka commented Jul 27, 2026

Copy link
Copy Markdown

Summary

Apply the InfiniBand device include/exclude filter before reading device
attributes and counters.

The collector now:

  1. obtains only the InfiniBand device names from procfs;
  2. applies the configured device filter;
  3. parses each accepted device individually.

Motivation

#3694 added:

  • --collector.infiniband.device-include
  • --collector.infiniband.device-exclude

However, the collector currently calls procfs.InfiniBandClass() before
applying the filter. InfiniBandClass() eagerly parses every device,
including all per-port counters. The filter therefore controls emitted
metrics but does not prevent reads from excluded devices.

On systems with restricted or Fabric Manager-managed Mellanox PFs, those
reads can trigger repeated mlx5_core ACCESS_REG(0x805) firmware errors even
when the device is excluded.

This change makes the flags perform filtering before any per-device reads,
which is necessary to address #3434.

Compatibility

With neither filter configured, all devices continue to be collected.

This depends on the new procfs device-listing and per-device parsing APIs.

Testing

The node_exporter and procfs branches were tested together using a Go
workspace and the collector test package cross-compiles successfully for
Linux.

Fixes #3434.

Signed-off-by: Rafal Szypulka <rafal@datacrunch.io>
@rafal-szypulka
rafal-szypulka marked this pull request as ready for review August 31, 2026 14:21
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.

Limit which "pfs" when querying mellanox cards

1 participant