From 366f90802d4e8e61cc425ceb5dbcd5f41ec2783a Mon Sep 17 00:00:00 2001 From: Alexander Egorenkov <66992637+eaibmz@users.noreply.github.com> Date: Wed, 15 Jul 2026 21:10:44 +0200 Subject: [PATCH 01/87] fibre_channel: fix crash when attempting to dereference invalid counters (#3573) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The statistics counters of a disabled FC host cannot be read from sysfs and any read attempt fails with errno ENOENT. Therefore, all statistics counters returned by procfs are nil in such a case. This results in a crash on s390x Linux when a zFCP host is disabled with `chzdev -d `. Crash stacktrace in a GDB ------------------------- $ gdb /root/node_exporter/node_exporter ... Thread 4 "node_exporter" received signal SIGSEGV, Segmentation fault. [Switching to LWP 35579] 0x00000000007be86c in github.com/prometheus/node_exporter/collector.(*fibrechannelCollector).Update (c=0xc00012fef0, ch=0xc0002fc8c0, ~r0=...) at /root/node_exporter/collector/fibrechannel_linux.go:133 133 c.pushCounter(ch, "dumped_frames_total", *host.Counters.DumpedFrames, *host.Name) (gdb) bt at /root/node_exporter/collector/fibrechannel_linux.go:133 (gdb) p host $1 = {Name = 0xc00038faf0, Speed = 0xc00038fb00, PortState = 0xc00038fb10, PortType = 0xc00038fb30, SymbolicName = 0xc00038fba0, NodeName = 0xc00038fb40, PortID = 0xc00038fb50, PortName = 0xc00038fb60, FabricName = 0xc00038fb80, DevLossTMO = 0xc00038fb90, SupportedClasses = 0xc00038fbb0, SupportedSpeeds = 0xc00038fbd0, Counters = 0xc0001cb2d0} (gdb) p host.Name $2 = (string *) 0xc00038faf0 (gdb) p *host.Name $3 = "host0" (gdb) p *host.Counters.DumpedFrames ❌️ Cannot access memory at address 0x0 (gdb) p *host.Counters $4 = {DumpedFrames = 0x0, ErrorFrames = 0x0, InvalidCRCCount = 0x0, RXFrames = 0x0, RXWords = 0x0, TXFrames = 0x0, TXWords = 0x0, SecondsSinceLastReset = 0x0, InvalidTXWordCount = 0x0, LinkFailureCount = 0x0, LossOfSyncCount = 0x0, LossOfSignalCount = 0x0, NosCount = 0x0, FCPPacketAborts = 0x0} (gdb) bt at /root/node_exporter/collector/fibrechannel_linux.go:133 name="fibrechannel", c=..., ch=0xc0002fc8c0, logger=0xc0002104a0) at /root/node_exporter/collector/collector.go:160 (gdb) p *host.Counters $5 = {DumpedFrames = 0x0, ErrorFrames = 0x0, InvalidCRCCount = 0x0, RXFrames = 0x0, RXWords = 0x0, TXFrames = 0x0, TXWords = 0x0, SecondsSinceLastReset = 0x0, InvalidTXWordCount = 0x0, LinkFailureCount = 0x0, LossOfSyncCount = 0x0, LossOfSignalCount = 0x0, NosCount = 0x0, FCPPacketAborts = 0x0} (gdb) Signed-off-by: Alexander Egorenkov --- collector/fibrechannel_linux.go | 19 ++++++++++++++++++- collector/fixtures/e2e-64k-page-output.txt | 2 +- collector/fixtures/e2e-output.txt | 2 +- collector/fixtures/sys.ttar | 5 +++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/collector/fibrechannel_linux.go b/collector/fibrechannel_linux.go index f56ef48288..4854b93a46 100644 --- a/collector/fibrechannel_linux.go +++ b/collector/fibrechannel_linux.go @@ -127,7 +127,24 @@ func (c *fibrechannelCollector) Update(ch chan<- prometheus.Metric) error { )...) // Then the counters - // Note: `procfs` guarantees these a safe dereference for these counters. + // Note: `procfs` does not guarantee a safe dereference for these counters. + // A disabled host returns no statistics counters. + if host.PortState == nil || *host.PortState == "Unknown" { + host.Counters.DumpedFrames = new(uint64) + host.Counters.ErrorFrames = new(uint64) + host.Counters.InvalidCRCCount = new(uint64) + host.Counters.RXFrames = new(uint64) + host.Counters.RXWords = new(uint64) + host.Counters.TXFrames = new(uint64) + host.Counters.TXWords = new(uint64) + host.Counters.SecondsSinceLastReset = new(uint64) + host.Counters.InvalidTXWordCount = new(uint64) + host.Counters.LinkFailureCount = new(uint64) + host.Counters.LossOfSyncCount = new(uint64) + host.Counters.LossOfSignalCount = new(uint64) + host.Counters.NosCount = new(uint64) + host.Counters.FCPPacketAborts = new(uint64) + } c.pushCounter(ch, "dumped_frames_total", *host.Counters.DumpedFrames, *host.Name) c.pushCounter(ch, "error_frames_total", *host.Counters.ErrorFrames, *host.Name) c.pushCounter(ch, "invalid_crc_total", *host.Counters.InvalidCRCCount, *host.Name) diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index 17b7393acc..5475fcfe72 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -1415,7 +1415,7 @@ node_fibrechannel_error_frames_total{fc_host="host1"} 19 node_fibrechannel_fcp_packet_aborts_total{fc_host="host0"} 19 # HELP node_fibrechannel_info Non-numeric data from /sys/class/fc_host/, value is always 1. # TYPE node_fibrechannel_info gauge -node_fibrechannel_info{dev_loss_tmo="",fabric_name="",fc_host="host1",port_id="",port_name="",port_state="",port_type="",speed="8 Gbit",supported_classes="",supported_speeds="",symbolic_name=""} 1 +node_fibrechannel_info{dev_loss_tmo="",fabric_name="",fc_host="host1",port_id="",port_name="",port_state="Online",port_type="",speed="8 Gbit",supported_classes="",supported_speeds="",symbolic_name=""} 1 node_fibrechannel_info{dev_loss_tmo="30",fabric_name="0",fc_host="host0",port_id="000002",port_name="1000e0071bce95f2",port_state="Online",port_type="Point-To-Point (direct nport connection)",speed="16 Gbit",supported_classes="Class 3",supported_speeds="4 Gbit, 8 Gbit, 16 Gbit",symbolic_name="Emulex SN1100E2P FV12.4.270.3 DV12.4.0.0. HN:gotest. OS:Linux"} 1 # HELP node_fibrechannel_invalid_crc_total Invalid Cyclic Redundancy Check count # TYPE node_fibrechannel_invalid_crc_total counter diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index f121daacbc..141cb76c3a 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -1447,7 +1447,7 @@ node_fibrechannel_error_frames_total{fc_host="host1"} 19 node_fibrechannel_fcp_packet_aborts_total{fc_host="host0"} 19 # HELP node_fibrechannel_info Non-numeric data from /sys/class/fc_host/, value is always 1. # TYPE node_fibrechannel_info gauge -node_fibrechannel_info{dev_loss_tmo="",fabric_name="",fc_host="host1",port_id="",port_name="",port_state="",port_type="",speed="8 Gbit",supported_classes="",supported_speeds="",symbolic_name=""} 1 +node_fibrechannel_info{dev_loss_tmo="",fabric_name="",fc_host="host1",port_id="",port_name="",port_state="Online",port_type="",speed="8 Gbit",supported_classes="",supported_speeds="",symbolic_name=""} 1 node_fibrechannel_info{dev_loss_tmo="30",fabric_name="0",fc_host="host0",port_id="000002",port_name="1000e0071bce95f2",port_state="Online",port_type="Point-To-Point (direct nport connection)",speed="16 Gbit",supported_classes="Class 3",supported_speeds="4 Gbit, 8 Gbit, 16 Gbit",symbolic_name="Emulex SN1100E2P FV12.4.270.3 DV12.4.0.0. HN:gotest. OS:Linux"} 1 # HELP node_fibrechannel_invalid_crc_total Invalid Cyclic Redundancy Check count # TYPE node_fibrechannel_invalid_crc_total counter diff --git a/collector/fixtures/sys.ttar b/collector/fixtures/sys.ttar index d6829754d6..3082ca9fee 100644 --- a/collector/fixtures/sys.ttar +++ b/collector/fixtures/sys.ttar @@ -1298,6 +1298,11 @@ Mode: 644 Directory: sys/class/fc_host/host1 Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/fc_host/host1/port_state +Lines: 1 +Online +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: sys/class/fc_host/host1/speed Lines: 1 8 Gbit From d6c236faac2f1887caf129b10555d5a38f9e41b0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Jul 2026 21:11:08 +0200 Subject: [PATCH 02/87] build(deps): bump the promci group with 2 updates (#3740) Bumps the promci group with 2 updates: [prometheus/promci/publish_main](https://github.com/prometheus/promci) and [prometheus/promci/publish_release](https://github.com/prometheus/promci). Updates `prometheus/promci/publish_main` from 0.8.5 to 0.9.0 - [Release notes](https://github.com/prometheus/promci/releases) - [Commits](https://github.com/prometheus/promci/compare/13941414d409d227afd67544e5d306827db5a1a2...370e8c15dcec50043cbe66f2f34633d9efc0a190) Updates `prometheus/promci/publish_release` from 0.8.5 to 0.9.0 - [Release notes](https://github.com/prometheus/promci/releases) - [Commits](https://github.com/prometheus/promci/compare/13941414d409d227afd67544e5d306827db5a1a2...370e8c15dcec50043cbe66f2f34633d9efc0a190) --- updated-dependencies: - dependency-name: prometheus/promci/publish_main dependency-version: 0.9.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: promci - dependency-name: prometheus/promci/publish_release dependency-version: 0.9.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: promci ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b2104a1f8..3258ff9d48 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,7 +121,7 @@ jobs: needs: [test_go, test_go_arm, build] if: github.event_name == 'push' && github.event.ref == 'refs/heads/master' steps: - - uses: prometheus/promci/publish_main@13941414d409d227afd67544e5d306827db5a1a2 # v0.8.5 + - uses: prometheus/promci/publish_main@370e8c15dcec50043cbe66f2f34633d9efc0a190 # v0.9.0 with: docker_hub_login: ${{ secrets.docker_hub_login }} docker_hub_password: ${{ secrets.docker_hub_password }} @@ -138,7 +138,7 @@ jobs: needs: [test_go, test_go_arm, build] if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') steps: - - uses: prometheus/promci/publish_release@13941414d409d227afd67544e5d306827db5a1a2 # v0.8.5 + - uses: prometheus/promci/publish_release@370e8c15dcec50043cbe66f2f34633d9efc0a190 # v0.9.0 with: docker_hub_login: ${{ secrets.docker_hub_login }} docker_hub_password: ${{ secrets.docker_hub_password }} From 5de0f89cba436cf4ba801757226f027541cdc68b Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Mon, 20 Jul 2026 11:50:12 +0200 Subject: [PATCH 03/87] Update common Prometheus files (#3748) Signed-off-by: prombot --- .github/workflows/approve-workflows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/approve-workflows.yml b/.github/workflows/approve-workflows.yml index adbcb48175..f372012f2b 100644 --- a/.github/workflows/approve-workflows.yml +++ b/.github/workflows/approve-workflows.yml @@ -15,13 +15,13 @@ jobs: if: >- github.event.issue.pull_request && github.event.comment.body == '/workflow-approve' && - github.repository_owner == 'prometheus' + (github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community') runs-on: ubuntu-latest permissions: actions: write contents: read pull-requests: write steps: - - uses: prometheus/promci/approve_workflows@370e8c15dcec50043cbe66f2f34633d9efc0a190 + - uses: prometheus/promci/approve_workflows@370e8c15dcec50043cbe66f2f34633d9efc0a190 # v0.9.0 with: github_token: ${{ github.token }} From 8ec76981383600d35ce8e94800aa29e66920ca3c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jul 2026 06:55:37 +0200 Subject: [PATCH 04/87] build(deps): bump actions/setup-go from 6.4.0 to 6.5.0 (#3741) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 6.4.0 to 6.5.0. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/4a3601121dd01d1626a1e23e37211e3254c1c06c...924ae3a1cded613372ab5595356fb5720e22ba16) --- updated-dependencies: - dependency-name: actions/setup-go dependency-version: 6.5.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3258ff9d48..2a413925c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 with: persist-credentials: false - - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 + - uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 with: go-version: 1.26.x - run: uname -a From 3e62d9daadc3295c28055bb9bb1cc09113664f8d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jul 2026 06:55:53 +0200 Subject: [PATCH 05/87] build(deps): bump vmactions/netbsd-vm from 1.4.1 to 1.4.2 (#3744) Bumps [vmactions/netbsd-vm](https://github.com/vmactions/netbsd-vm) from 1.4.1 to 1.4.2. - [Release notes](https://github.com/vmactions/netbsd-vm/releases) - [Commits](https://github.com/vmactions/netbsd-vm/compare/1d9767765fd3f986e6de3aff4b1148f0c3a45f01...0c26a4c4a5e234038862a4a53a00c905b8a107c9) --- updated-dependencies: - dependency-name: vmactions/netbsd-vm dependency-version: 1.4.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bsd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 5df620ee38..cf7a4b1aa9 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -133,7 +133,7 @@ jobs: with: persist-credentials: false - name: test-e2e - uses: vmactions/netbsd-vm@1d9767765fd3f986e6de3aff4b1148f0c3a45f01 # v1.4.1 + uses: vmactions/netbsd-vm@0c26a4c4a5e234038862a4a53a00c905b8a107c9 # v1.4.2 with: copyback: false envs: 'GO_VERSION GNU_TAR_VERSION' From 856f366b7aec6bcfd005df0f919fe79d18c8cc6b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jul 2026 06:56:13 +0200 Subject: [PATCH 06/87] build(deps): bump actions/checkout from 6.0.3 to 7.0.0 (#3742) Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.3 to 7.0.0. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/df4cb1c069e1874edd31b4311f1884172cec0e10...9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 7.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bsd.yml | 12 ++++++------ .github/workflows/ci.yml | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index cf7a4b1aa9..6768857f11 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the repository - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - name: test-e2e @@ -76,7 +76,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the repository - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - name: test-e2e @@ -129,7 +129,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the repository - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - name: test-e2e @@ -180,7 +180,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the repository - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - name: test-e2e @@ -234,7 +234,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the repository - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - name: test-e2e @@ -296,7 +296,7 @@ jobs: runs-on: macos-latest steps: - name: Checkout the repository - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - name: Install dependencies diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a413925c3..4529887bcf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: # should also be updated. image: quay.io/prometheus/golang-builder:1.26-base steps: - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - run: go mod download @@ -28,7 +28,7 @@ jobs: name: Go ARM tests runs-on: ubuntu-24.04-arm steps: - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 @@ -45,7 +45,7 @@ jobs: # should also be updated. image: quay.io/prometheus/golang-builder:1.26-base steps: - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - run: go install github.com/google/go-jsonnet/cmd/jsonnet@latest @@ -64,7 +64,7 @@ jobs: matrix: thread: [ 0, 1, 2 ] steps: - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - uses: prometheus/promci-setup@3e5cd31b34b8ae19efa8f071c5e3cdb44884a7f8 # v0.2.1 @@ -92,7 +92,7 @@ jobs: DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.26-base REPO_PATH: github.com/prometheus/node_exporter steps: - - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - uses: prometheus/promci-artifacts/restore@f9a587dbc0b2c78a0c54f8ad1cde71ea29a4b76f # v0.1.0 From b401dcfc667cee0a5d29232bab51a8ce1c58ec07 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jul 2026 08:21:57 +0200 Subject: [PATCH 07/87] build(deps): bump vmactions/dragonflybsd-vm from 1.2.9 to 1.3.1 (#3743) Bumps [vmactions/dragonflybsd-vm](https://github.com/vmactions/dragonflybsd-vm) from 1.2.9 to 1.3.1. - [Release notes](https://github.com/vmactions/dragonflybsd-vm/releases) - [Commits](https://github.com/vmactions/dragonflybsd-vm/compare/b4468429bb9ab60b14600c6eeeb6464427f29391...bc8ccbaa091ce3624c93f2dc328ae48129b07580) --- updated-dependencies: - dependency-name: vmactions/dragonflybsd-vm dependency-version: 1.3.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bsd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 6768857f11..55c34717a0 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -184,7 +184,7 @@ jobs: with: persist-credentials: false - name: test-e2e - uses: vmactions/dragonflybsd-vm@b4468429bb9ab60b14600c6eeeb6464427f29391 # v1.2.9 + uses: vmactions/dragonflybsd-vm@bc8ccbaa091ce3624c93f2dc328ae48129b07580 # v1.3.1 with: copyback: false envs: 'GO_VERSION' From 128f5bf9c98942715bbb2811bcd8aa70d9232a10 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Tue, 4 Aug 2026 21:23:53 +0200 Subject: [PATCH 08/87] Update common Prometheus files (#3779) Signed-off-by: prombot --- .github/dependabot.yml | 3 +++ Makefile.common | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 7d81d9e7c1..57d8410442 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -20,6 +20,9 @@ updates: k8s.io: patterns: - "k8s.io/*" + prometheus: + patterns: + - "github.com/prometheus/*" - package-ecosystem: "github-actions" directory: "/" schedule: diff --git a/Makefile.common b/Makefile.common index a7c5f553e1..5cfd6b8bff 100644 --- a/Makefile.common +++ b/Makefile.common @@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_ SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v2.11.4 +GOLANGCI_LINT_VERSION ?= v2.12.2 GOLANGCI_FMT_OPTS ?= # golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64. # windows isn't included here because of the path separator being different. From 1771767c6295668bf903c975981a623bd4c71f29 Mon Sep 17 00:00:00 2001 From: michalskrivanek Date: Wed, 5 Aug 2026 08:08:44 +0200 Subject: [PATCH 09/87] ksmd: add general_profit metric (#3778) Expose /sys/kernel/mm/ksm/general_profit as node_ksmd_general_profit_bytes. This file (available since Linux 6.4, EL9) reports the net memory saved by KSM after subtracting the overhead of rmap_item tracking structures. Also gracefully skip any missing sysfs files instead of failing the entire collector, since general_profit and potentially other files may not exist on older kernels. Assisted-by: claude-4.6-opus Signed-off-by: Michal Skrivanek --- collector/fixtures/e2e-64k-page-output.txt | 3 +++ collector/fixtures/e2e-output.txt | 3 +++ collector/fixtures/sys.ttar | 5 +++++ collector/ksmd_linux.go | 13 +++++++++++-- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index 5475fcfe72..90583b2192 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -1990,6 +1990,9 @@ node_kernel_hung_tasks_total 42 # HELP node_ksmd_full_scans_total ksmd 'full_scans' file. # TYPE node_ksmd_full_scans_total counter node_ksmd_full_scans_total 323 +# HELP node_ksmd_general_profit_bytes ksmd 'general_profit' file. +# TYPE node_ksmd_general_profit_bytes gauge +node_ksmd_general_profit_bytes 1.04448e+06 # HELP node_ksmd_merge_across_nodes ksmd 'merge_across_nodes' file. # TYPE node_ksmd_merge_across_nodes gauge node_ksmd_merge_across_nodes 1 diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index 141cb76c3a..d0656919cd 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -2022,6 +2022,9 @@ node_kernel_hung_tasks_total 42 # HELP node_ksmd_full_scans_total ksmd 'full_scans' file. # TYPE node_ksmd_full_scans_total counter node_ksmd_full_scans_total 323 +# HELP node_ksmd_general_profit_bytes ksmd 'general_profit' file. +# TYPE node_ksmd_general_profit_bytes gauge +node_ksmd_general_profit_bytes 1.04448e+06 # HELP node_ksmd_merge_across_nodes ksmd 'merge_across_nodes' file. # TYPE node_ksmd_merge_across_nodes gauge node_ksmd_merge_across_nodes 1 diff --git a/collector/fixtures/sys.ttar b/collector/fixtures/sys.ttar index 3082ca9fee..dfcc08bacf 100644 --- a/collector/fixtures/sys.ttar +++ b/collector/fixtures/sys.ttar @@ -11960,6 +11960,11 @@ Lines: 1 323 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/kernel/mm/ksm/general_profit +Lines: 1 +1044480 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: sys/kernel/mm/ksm/merge_across_nodes Lines: 1 1 diff --git a/collector/ksmd_linux.go b/collector/ksmd_linux.go index 2a68f43f94..aeb1a1e8eb 100644 --- a/collector/ksmd_linux.go +++ b/collector/ksmd_linux.go @@ -16,16 +16,19 @@ package collector import ( + "errors" "fmt" "log/slog" + "os" "path/filepath" "github.com/prometheus/client_golang/prometheus" ) var ( - ksmdFiles = []string{"full_scans", "merge_across_nodes", "pages_shared", "pages_sharing", - "pages_to_scan", "pages_unshared", "pages_volatile", "run", "sleep_millisecs"} + ksmdFiles = []string{"full_scans", "general_profit", "merge_across_nodes", "pages_shared", + "pages_sharing", "pages_to_scan", "pages_unshared", "pages_volatile", "run", + "sleep_millisecs"} ) type ksmdCollector struct { @@ -41,6 +44,8 @@ func getCanonicalMetricName(filename string) string { switch filename { case "full_scans": return filename + "_total" + case "general_profit": + return "general_profit_bytes" case "sleep_millisecs": return "sleep_seconds" default: @@ -66,6 +71,10 @@ func (c *ksmdCollector) Update(ch chan<- prometheus.Metric) error { for _, n := range ksmdFiles { val, err := readUintFromFile(sysFilePath(filepath.Join("kernel/mm/ksm", n))) if err != nil { + if errors.Is(err, os.ErrNotExist) { + c.logger.Debug("ksmd file not found, skipping", "file", n) + continue + } return err } From 415fb0c3b8d75c6f16eaf60947b039d697f24698 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Wed, 5 Aug 2026 11:10:30 +0000 Subject: [PATCH 10/87] ksmd: Improve help text (#3782) Update the ksmd collector to use pre-defined metrics descriptions instead of auto-generated. This allows for improved help text taken from the kernel documentation. This also avoids memory allocations each time `NewKsmdCollector()` is called. Signed-off-by: Ben Kochie --- collector/fixtures/e2e-64k-page-output.txt | 20 ++-- collector/fixtures/e2e-output.txt | 20 ++-- collector/ksmd_linux.go | 122 +++++++++++++++------ 3 files changed, 108 insertions(+), 54 deletions(-) diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index 90583b2192..f0ac7ebac4 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -1987,34 +1987,34 @@ node_ipvs_outgoing_packets_total 0 # HELP node_kernel_hung_tasks_total Total number of tasks that have been detected as hung since the system booted. # TYPE node_kernel_hung_tasks_total counter node_kernel_hung_tasks_total 42 -# HELP node_ksmd_full_scans_total ksmd 'full_scans' file. +# HELP node_ksmd_full_scans_total How many times all mergeable areas have been scanned. # TYPE node_ksmd_full_scans_total counter node_ksmd_full_scans_total 323 -# HELP node_ksmd_general_profit_bytes ksmd 'general_profit' file. +# HELP node_ksmd_general_profit_bytes How effective is KSM. ksm_saved_pages * sizeof(page) - (all_rmap_items) * sizeof(rmap_item) # TYPE node_ksmd_general_profit_bytes gauge node_ksmd_general_profit_bytes 1.04448e+06 -# HELP node_ksmd_merge_across_nodes ksmd 'merge_across_nodes' file. +# HELP node_ksmd_merge_across_nodes Specifies if pages from different NUMA nodes can be merged. # TYPE node_ksmd_merge_across_nodes gauge node_ksmd_merge_across_nodes 1 -# HELP node_ksmd_pages_shared ksmd 'pages_shared' file. +# HELP node_ksmd_pages_shared How many shared pages are being used. # TYPE node_ksmd_pages_shared gauge node_ksmd_pages_shared 1 -# HELP node_ksmd_pages_sharing ksmd 'pages_sharing' file. +# HELP node_ksmd_pages_sharing How many more sites are sharing them i.e. how much saved. # TYPE node_ksmd_pages_sharing gauge node_ksmd_pages_sharing 255 -# HELP node_ksmd_pages_to_scan ksmd 'pages_to_scan' file. +# HELP node_ksmd_pages_to_scan How many pages to scan before ksmd goes to sleep. # TYPE node_ksmd_pages_to_scan gauge node_ksmd_pages_to_scan 100 -# HELP node_ksmd_pages_unshared ksmd 'pages_unshared' file. +# HELP node_ksmd_pages_unshared How many pages unique but repeatedly checked for merging. # TYPE node_ksmd_pages_unshared gauge node_ksmd_pages_unshared 0 -# HELP node_ksmd_pages_volatile ksmd 'pages_volatile' file. +# HELP node_ksmd_pages_volatile How many pages changing too fast to be placed in a tree. # TYPE node_ksmd_pages_volatile gauge node_ksmd_pages_volatile 0 -# HELP node_ksmd_run ksmd 'run' file. +# HELP node_ksmd_run The status of ksmd. stopped = 0, running = 1 # TYPE node_ksmd_run gauge node_ksmd_run 1 -# HELP node_ksmd_sleep_seconds ksmd 'sleep_millisecs' file. +# HELP node_ksmd_sleep_seconds How many seconds ksmd should sleep before next scan. # TYPE node_ksmd_sleep_seconds gauge node_ksmd_sleep_seconds 0.02 # HELP node_lnstat_allocs_total linux network cache stats diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index d0656919cd..9afd903d6f 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -2019,34 +2019,34 @@ node_ipvs_outgoing_packets_total 0 # HELP node_kernel_hung_tasks_total Total number of tasks that have been detected as hung since the system booted. # TYPE node_kernel_hung_tasks_total counter node_kernel_hung_tasks_total 42 -# HELP node_ksmd_full_scans_total ksmd 'full_scans' file. +# HELP node_ksmd_full_scans_total How many times all mergeable areas have been scanned. # TYPE node_ksmd_full_scans_total counter node_ksmd_full_scans_total 323 -# HELP node_ksmd_general_profit_bytes ksmd 'general_profit' file. +# HELP node_ksmd_general_profit_bytes How effective is KSM. ksm_saved_pages * sizeof(page) - (all_rmap_items) * sizeof(rmap_item) # TYPE node_ksmd_general_profit_bytes gauge node_ksmd_general_profit_bytes 1.04448e+06 -# HELP node_ksmd_merge_across_nodes ksmd 'merge_across_nodes' file. +# HELP node_ksmd_merge_across_nodes Specifies if pages from different NUMA nodes can be merged. # TYPE node_ksmd_merge_across_nodes gauge node_ksmd_merge_across_nodes 1 -# HELP node_ksmd_pages_shared ksmd 'pages_shared' file. +# HELP node_ksmd_pages_shared How many shared pages are being used. # TYPE node_ksmd_pages_shared gauge node_ksmd_pages_shared 1 -# HELP node_ksmd_pages_sharing ksmd 'pages_sharing' file. +# HELP node_ksmd_pages_sharing How many more sites are sharing them i.e. how much saved. # TYPE node_ksmd_pages_sharing gauge node_ksmd_pages_sharing 255 -# HELP node_ksmd_pages_to_scan ksmd 'pages_to_scan' file. +# HELP node_ksmd_pages_to_scan How many pages to scan before ksmd goes to sleep. # TYPE node_ksmd_pages_to_scan gauge node_ksmd_pages_to_scan 100 -# HELP node_ksmd_pages_unshared ksmd 'pages_unshared' file. +# HELP node_ksmd_pages_unshared How many pages unique but repeatedly checked for merging. # TYPE node_ksmd_pages_unshared gauge node_ksmd_pages_unshared 0 -# HELP node_ksmd_pages_volatile ksmd 'pages_volatile' file. +# HELP node_ksmd_pages_volatile How many pages changing too fast to be placed in a tree. # TYPE node_ksmd_pages_volatile gauge node_ksmd_pages_volatile 0 -# HELP node_ksmd_run ksmd 'run' file. +# HELP node_ksmd_run The status of ksmd. stopped = 0, running = 1 # TYPE node_ksmd_run gauge node_ksmd_run 1 -# HELP node_ksmd_sleep_seconds ksmd 'sleep_millisecs' file. +# HELP node_ksmd_sleep_seconds How many seconds ksmd should sleep before next scan. # TYPE node_ksmd_sleep_seconds gauge node_ksmd_sleep_seconds 0.02 # HELP node_lnstat_allocs_total linux network cache stats diff --git a/collector/ksmd_linux.go b/collector/ksmd_linux.go index aeb1a1e8eb..f400f0a0fc 100644 --- a/collector/ksmd_linux.go +++ b/collector/ksmd_linux.go @@ -1,4 +1,4 @@ -// Copyright 2015 The Prometheus Authors +// Copyright The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -17,7 +17,6 @@ package collector import ( "errors" - "fmt" "log/slog" "os" "path/filepath" @@ -25,45 +24,86 @@ import ( "github.com/prometheus/client_golang/prometheus" ) +const ksmdCollectorSubsystem = "ksmd" + var ( - ksmdFiles = []string{"full_scans", "general_profit", "merge_across_nodes", "pages_shared", - "pages_sharing", "pages_to_scan", "pages_unshared", "pages_volatile", "run", - "sleep_millisecs"} + ksmdFiles = []string{ + "full_scans", + "general_profit", + "merge_across_nodes", + "pages_shared", + "pages_sharing", + "pages_to_scan", + "pages_unshared", + "pages_volatile", + "run", + "sleep_millisecs", + } + + // Help text from https://docs.kernel.org/admin-guide/mm/ksm.html + ksmdFullScansDesc = prometheus.NewDesc( + prometheus.BuildFQName(namespace, ksmdCollectorSubsystem, "full_scans_total"), + "How many times all mergeable areas have been scanned.", + nil, nil, + ) + ksmdGeneralProfitDesc = prometheus.NewDesc( + prometheus.BuildFQName(namespace, ksmdCollectorSubsystem, "general_profit_bytes"), + "How effective is KSM. ksm_saved_pages * sizeof(page) - (all_rmap_items) * sizeof(rmap_item)", + nil, nil, + ) + ksmdMergeAcrossNodesDesc = prometheus.NewDesc( + prometheus.BuildFQName(namespace, ksmdCollectorSubsystem, "merge_across_nodes"), + "Specifies if pages from different NUMA nodes can be merged.", + nil, nil, + ) + ksmdPagesSharedDesc = prometheus.NewDesc( + prometheus.BuildFQName(namespace, ksmdCollectorSubsystem, "pages_shared"), + "How many shared pages are being used.", + nil, nil, + ) + ksmdPagesSharingDesc = prometheus.NewDesc( + prometheus.BuildFQName(namespace, ksmdCollectorSubsystem, "pages_sharing"), + "How many more sites are sharing them i.e. how much saved.", + nil, nil, + ) + ksmdPagesToScanDesc = prometheus.NewDesc( + prometheus.BuildFQName(namespace, ksmdCollectorSubsystem, "pages_to_scan"), + "How many pages to scan before ksmd goes to sleep.", + nil, nil, + ) + ksmdPagesUnsharedDesc = prometheus.NewDesc( + prometheus.BuildFQName(namespace, ksmdCollectorSubsystem, "pages_unshared"), + "How many pages unique but repeatedly checked for merging.", + nil, nil, + ) + ksmdPagesVolatileDesc = prometheus.NewDesc( + prometheus.BuildFQName(namespace, ksmdCollectorSubsystem, "pages_volatile"), + "How many pages changing too fast to be placed in a tree.", + nil, nil, + ) + ksmdRunDesc = prometheus.NewDesc( + prometheus.BuildFQName(namespace, ksmdCollectorSubsystem, "run"), + "The status of ksmd. stopped = 0, running = 1", + nil, nil, + ) + ksmdSleepSecondsDesc = prometheus.NewDesc( + prometheus.BuildFQName(namespace, ksmdCollectorSubsystem, "sleep_seconds"), + "How many seconds ksmd should sleep before next scan.", + nil, nil, + ) ) type ksmdCollector struct { - metricDescs map[string]*prometheus.Desc - logger *slog.Logger + logger *slog.Logger } func init() { - registerCollector("ksmd", defaultDisabled, NewKsmdCollector) -} - -func getCanonicalMetricName(filename string) string { - switch filename { - case "full_scans": - return filename + "_total" - case "general_profit": - return "general_profit_bytes" - case "sleep_millisecs": - return "sleep_seconds" - default: - return filename - } + registerCollector(ksmdCollectorSubsystem, defaultDisabled, NewKsmdCollector) } // NewKsmdCollector returns a new Collector exposing kernel/system statistics. func NewKsmdCollector(logger *slog.Logger) (Collector, error) { - subsystem := "ksmd" - descs := make(map[string]*prometheus.Desc) - - for _, n := range ksmdFiles { - descs[n] = prometheus.NewDesc( - prometheus.BuildFQName(namespace, subsystem, getCanonicalMetricName(n)), - fmt.Sprintf("ksmd '%s' file.", n), nil, nil) - } - return &ksmdCollector{descs, logger}, nil + return &ksmdCollector{logger: logger}, nil } // Update implements Collector and exposes kernel and system statistics. @@ -78,15 +118,29 @@ func (c *ksmdCollector) Update(ch chan<- prometheus.Metric) error { return err } - t := prometheus.GaugeValue v := float64(val) switch n { case "full_scans": - t = prometheus.CounterValue + ch <- prometheus.MustNewConstMetric(ksmdFullScansDesc, prometheus.CounterValue, v) + case "general_profit": + ch <- prometheus.MustNewConstMetric(ksmdGeneralProfitDesc, prometheus.GaugeValue, v) + case "merge_across_nodes": + ch <- prometheus.MustNewConstMetric(ksmdMergeAcrossNodesDesc, prometheus.GaugeValue, v) + case "pages_shared": + ch <- prometheus.MustNewConstMetric(ksmdPagesSharedDesc, prometheus.GaugeValue, v) + case "pages_sharing": + ch <- prometheus.MustNewConstMetric(ksmdPagesSharingDesc, prometheus.GaugeValue, v) + case "pages_to_scan": + ch <- prometheus.MustNewConstMetric(ksmdPagesToScanDesc, prometheus.GaugeValue, v) + case "pages_unshared": + ch <- prometheus.MustNewConstMetric(ksmdPagesUnsharedDesc, prometheus.GaugeValue, v) + case "pages_volatile": + ch <- prometheus.MustNewConstMetric(ksmdPagesVolatileDesc, prometheus.GaugeValue, v) + case "run": + ch <- prometheus.MustNewConstMetric(ksmdRunDesc, prometheus.GaugeValue, v) case "sleep_millisecs": - v /= 1000 + ch <- prometheus.MustNewConstMetric(ksmdSleepSecondsDesc, prometheus.GaugeValue, v/1000) } - ch <- prometheus.MustNewConstMetric(c.metricDescs[n], t, v) } return nil From 624f8ede44d1a8d669bca2d00fca51d7411d1e7c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 21:14:55 +0200 Subject: [PATCH 11/87] build(deps): bump the prometheus group with 2 updates (#3780) Bumps the prometheus group with 2 updates: [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) and [github.com/prometheus/common](https://github.com/prometheus/common). Updates `github.com/prometheus/client_golang` from 1.23.2 to 1.24.1 - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/v1.24.1/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.23.2...v1.24.1) Updates `github.com/prometheus/common` from 0.70.0 to 0.70.1 - [Release notes](https://github.com/prometheus/common/releases) - [Changelog](https://github.com/prometheus/common/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/common/compare/v0.70.0...v0.70.1) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-version: 1.24.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prometheus - dependency-name: github.com/prometheus/common dependency-version: 0.70.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: prometheus ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index bd7983b8c0..3e113b774e 100644 --- a/go.mod +++ b/go.mod @@ -21,9 +21,9 @@ require ( github.com/opencontainers/selinux v1.15.1 github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 github.com/prometheus-community/go-runit v0.1.0 - github.com/prometheus/client_golang v1.23.2 + github.com/prometheus/client_golang v1.24.1 github.com/prometheus/client_model v0.6.2 - github.com/prometheus/common v0.70.0 + github.com/prometheus/common v0.70.1 github.com/prometheus/exporter-toolkit v0.17.1 github.com/prometheus/procfs v0.21.1 github.com/safchain/ethtool v0.7.0 diff --git a/go.sum b/go.sum index 0ab3abcb66..3a8b21441a 100644 --- a/go.sum +++ b/go.sum @@ -44,8 +44,8 @@ github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2E github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jsimonetti/rtnetlink/v2 v2.2.0 h1:/KfZ310gOAFrXXol5VwnFEt+ucldD/0dsSRZwpHCP9w= github.com/jsimonetti/rtnetlink/v2 v2.2.0/go.mod h1:lbjDHxC+5RJ08lzPeA90Ls2pEoId3F08MoEMlhfHxeI= -github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= -github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/klauspost/compress v1.19.1 h1:VsB4HPswih7mmZ8WleSFQ75c/Ui1M4trX5oAsJnhSlk= +github.com/klauspost/compress v1.19.1/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lufia/iostat v1.2.1 h1:tnCdZBIglgxD47RyD55kfWQcJMGzO+1QBziSQfesf2k= @@ -76,12 +76,12 @@ github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus-community/go-runit v0.1.0 h1:uTWEj/Fn2RoLdfg/etSqwzgYNOYPrARx1BHUN052tGA= github.com/prometheus-community/go-runit v0.1.0/go.mod h1:AvJ9Jo3gAFu2lbM4+qfjdpq30FfiLDJZKbQ015u08IQ= -github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= -github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= +github.com/prometheus/client_golang v1.24.1 h1:JnJkREXzWxUdCuPFpIWZiPispT9xVV59uiuyR2bPlnU= +github.com/prometheus/client_golang v1.24.1/go.mod h1:F+oSRECHg4sse5ucfYpYDeIv/hu68Zo0uoHKetWnzcE= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.70.0 h1:bcpru3tWPVnxGnETLgOV5jbp/JRXgYEyv65CuBLAMMI= -github.com/prometheus/common v0.70.0/go.mod h1:S/SFasQmgGiYH6C81LKCtYa8QACgthGg5zxL2udV7SY= +github.com/prometheus/common v0.70.1 h1:1HvjP4D5oL3t8RsPlwxA9onvvStjtIHYE5XuuwOi/PY= +github.com/prometheus/common v0.70.1/go.mod h1:VdFUQDMZK3VLkurFUVhia6uys/0suUp86TJz5qbJRhc= github.com/prometheus/exporter-toolkit v0.17.1 h1:psKN4wM7shBL/BxZkDHgm6YZJ3fAVG36+r86An/+7q0= github.com/prometheus/exporter-toolkit v0.17.1/go.mod h1:dabwPJvxsC5+tsp2iolQrqBWZh+QlISKlYRpj9Hh5xk= github.com/prometheus/procfs v0.21.1 h1:GljZCt+zSTS+NZq88cyQ1LjZ+RCHp3uVuabBWA5+OJI= From 0ece0c4a4900a55dab3c7c9881bcb2100d97b581 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 21:15:16 +0200 Subject: [PATCH 12/87] build(deps): bump github.com/mdlayher/wifi from 0.8.0 to 0.9.0 (#3781) Bumps [github.com/mdlayher/wifi](https://github.com/mdlayher/wifi) from 0.8.0 to 0.9.0. - [Release notes](https://github.com/mdlayher/wifi/releases) - [Commits](https://github.com/mdlayher/wifi/compare/v0.8.0...v0.9.0) --- updated-dependencies: - dependency-name: github.com/mdlayher/wifi dependency-version: 0.9.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 3e113b774e..7c4458e399 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/mattn/go-xmlrpc v0.0.3 github.com/mdlayher/ethtool v0.6.1 github.com/mdlayher/netlink v1.11.2 - github.com/mdlayher/wifi v0.8.0 + github.com/mdlayher/wifi v0.9.0 github.com/opencontainers/selinux v1.15.1 github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 github.com/prometheus-community/go-runit v0.1.0 diff --git a/go.sum b/go.sum index 3a8b21441a..58c02fe429 100644 --- a/go.sum +++ b/go.sum @@ -62,8 +62,8 @@ github.com/mdlayher/socket v0.6.1 h1:M7uj2NtuujUY4mYr1C57NmfNiRHbkKpnBxO856lsc3A github.com/mdlayher/socket v0.6.1/go.mod h1:+/SGtqc9V+5dAuRgQsU0fGBI+oRDiW7O2Obx10OIWfg= github.com/mdlayher/vsock v1.3.0 h1:bqQfZ1OznI03y6YiXp2sze05RVdzLn/zsfjnjd4+ivI= github.com/mdlayher/vsock v1.3.0/go.mod h1:WsuksavOvwCnV5UqGHUkvAvCy+Dqy81y4goKQTzxxNY= -github.com/mdlayher/wifi v0.8.0 h1:qi73hVANXCYJEsT6t147dMILsx9V6UBNipZw0mPYdu0= -github.com/mdlayher/wifi v0.8.0/go.mod h1:QHQ211ZKtZKSKssCznixGUOqBcoyBQAuQWSAOnanY4A= +github.com/mdlayher/wifi v0.9.0 h1:d5mmqw9S2U4f95dcW5wnnUagpI6GJh328/AchVSP4ko= +github.com/mdlayher/wifi v0.9.0/go.mod h1:Bfkrz+VncrVPaOLcFG/bR9tSY2PbmYNQicWvAZlUZlI= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= From 02df428f5450b47bae6250f62e9c41e0562a4278 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 21:15:51 +0200 Subject: [PATCH 13/87] build(deps): bump vmactions/netbsd-vm from 1.4.2 to 1.4.5 (#3772) Bumps [vmactions/netbsd-vm](https://github.com/vmactions/netbsd-vm) from 1.4.2 to 1.4.5. - [Release notes](https://github.com/vmactions/netbsd-vm/releases) - [Commits](https://github.com/vmactions/netbsd-vm/compare/0c26a4c4a5e234038862a4a53a00c905b8a107c9...e7ac71b97abbe8437cec8859a5acf72dfa6a8be0) --- updated-dependencies: - dependency-name: vmactions/netbsd-vm dependency-version: 1.4.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bsd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 55c34717a0..40e0b53d26 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -133,7 +133,7 @@ jobs: with: persist-credentials: false - name: test-e2e - uses: vmactions/netbsd-vm@0c26a4c4a5e234038862a4a53a00c905b8a107c9 # v1.4.2 + uses: vmactions/netbsd-vm@e7ac71b97abbe8437cec8859a5acf72dfa6a8be0 # v1.4.5 with: copyback: false envs: 'GO_VERSION GNU_TAR_VERSION' From b0f359bd7cd8ad3e37fea6ded4a62d8853c2fb1b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 21:16:12 +0200 Subject: [PATCH 14/87] build(deps): bump actions/setup-go from 6.5.0 to 7.0.0 (#3773) Bumps [actions/setup-go](https://github.com/actions/setup-go) from 6.5.0 to 7.0.0. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/924ae3a1cded613372ab5595356fb5720e22ba16...b7ad1dad31e06c5925ef5d2fc7ad053ef454303e) --- updated-dependencies: - dependency-name: actions/setup-go dependency-version: 7.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4529887bcf..4dc2b8e925 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: persist-credentials: false - - uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version: 1.26.x - run: uname -a From ac83e377f04d53fd2683480337a0283d46204a33 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 21:16:29 +0200 Subject: [PATCH 15/87] build(deps): bump actions/checkout from 7.0.0 to 7.0.1 (#3775) Bumps [actions/checkout](https://github.com/actions/checkout) from 7.0.0 to 7.0.1. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0...3d3c42e5aac5ba805825da76410c181273ba90b1) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 7.0.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bsd.yml | 12 ++++++------ .github/workflows/ci.yml | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 40e0b53d26..9eb49c1935 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the repository - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: test-e2e @@ -76,7 +76,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the repository - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: test-e2e @@ -129,7 +129,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the repository - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: test-e2e @@ -180,7 +180,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the repository - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: test-e2e @@ -234,7 +234,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the repository - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: test-e2e @@ -296,7 +296,7 @@ jobs: runs-on: macos-latest steps: - name: Checkout the repository - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Install dependencies diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4dc2b8e925..74d39c96d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: # should also be updated. image: quay.io/prometheus/golang-builder:1.26-base steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - run: go mod download @@ -28,7 +28,7 @@ jobs: name: Go ARM tests runs-on: ubuntu-24.04-arm steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 @@ -45,7 +45,7 @@ jobs: # should also be updated. image: quay.io/prometheus/golang-builder:1.26-base steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - run: go install github.com/google/go-jsonnet/cmd/jsonnet@latest @@ -64,7 +64,7 @@ jobs: matrix: thread: [ 0, 1, 2 ] steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: prometheus/promci-setup@3e5cd31b34b8ae19efa8f071c5e3cdb44884a7f8 # v0.2.1 @@ -92,7 +92,7 @@ jobs: DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.26-base REPO_PATH: github.com/prometheus/node_exporter steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: prometheus/promci-artifacts/restore@f9a587dbc0b2c78a0c54f8ad1cde71ea29a4b76f # v0.1.0 From a7dcc3a01545180d4f2087db70994cbc3abfed13 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Sat, 8 Aug 2026 09:43:50 +0200 Subject: [PATCH 16/87] Update common Prometheus files (#3786) Signed-off-by: prombot --- .github/workflows/container_description.yml | 4 ++-- .github/workflows/golangci-lint.yml | 2 +- .github/workflows/govulncheck.yml | 2 +- Makefile.common | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/container_description.yml b/.github/workflows/container_description.yml index 591a4d687f..ed4ada556d 100644 --- a/.github/workflows/container_description.yml +++ b/.github/workflows/container_description.yml @@ -21,7 +21,7 @@ jobs: if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks. steps: - name: git checkout - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Set docker hub repo name @@ -45,7 +45,7 @@ jobs: if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks. steps: - name: git checkout - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Set quay.io org name diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 83241e2d0b..45704a9544 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Install Go diff --git a/.github/workflows/govulncheck.yml b/.github/workflows/govulncheck.yml index 374df32baf..8c4deff9f8 100644 --- a/.github/workflows/govulncheck.yml +++ b/.github/workflows/govulncheck.yml @@ -28,6 +28,6 @@ jobs: run: sudo apt-get update && sudo apt-get -y install libsnmp-dev if: github.repository == 'prometheus/snmp_exporter' - id: govulncheck - uses: golang/govulncheck-action@3fa7bd9cee2cfdf3499a8803b226e43de7b7cdb4 # master + uses: golang/govulncheck-action@032d45514ae346b1db93c04b0c90b841c370344f # master env: GOOS: ${{ contains(github.repository, 'windows_exporter') && 'windows' || '' }} diff --git a/Makefile.common b/Makefile.common index 5cfd6b8bff..b336657fb3 100644 --- a/Makefile.common +++ b/Makefile.common @@ -166,7 +166,8 @@ common-deps: update-go-deps: @echo ">> updating Go dependencies" @for m in $$($(GO) list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \ - $(GO) get $$m; \ + # Prevent go get from pulling deps that require a newer Go version. + GOTOOLCHAIN=go$$($(GO) mod edit -json | jq -r .Go) $(GO) get $$m; \ done $(GO) mod tidy From 24c6dce279c418bcb911824e8c8be1c81a1e832b Mon Sep 17 00:00:00 2001 From: Mark Hamzy Date: Wed, 19 Aug 2026 03:25:20 -0500 Subject: [PATCH 17/87] Fix fibrechannel_linux for ppc64le (#3769) Seen on a master node: ``` panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x106cefa4] goroutine 81 [running]: github.com/prometheus/node_exporter/collector.(*fibrechannelCollector).Update(0x7e28c1ae20f0, 0x7e28c1826770) /go/src/github.com/prometheus/node_exporter/collector/fibrechannel_linux.go:133 +0x604 sh-5.1# ls -l /host/sys/class/fc_host/ total 0 lrwxrwxrwx. 1 root root 0 Jul 30 20:42 host1 -> ../../devices/vio/30000003/host1/fc_host/host1 lrwxrwxrwx. 1 root root 0 Jul 30 20:42 host2 -> ../../devices/vio/30000005/host2/fc_host/host2 sh-5.1# ls -l /host/sys/class/fc_host/host1/ total 0 -rw-r--r--. 1 root root 65536 Jul 30 20:09 dev_loss_tmo lrwxrwxrwx. 1 root root 0 Jul 30 20:42 device -> ../../../host1 -r--r--r--. 1 root root 65536 Jul 30 20:09 fabric_name --w-------. 1 root root 65536 Jul 30 20:42 issue_lip -r--r--r--. 1 root root 65536 Jul 30 20:42 maxframe_size -r--r--r--. 1 root root 65536 Jul 30 20:09 node_name -r--r--r--. 1 root root 65536 Jul 30 20:09 port_id -r--r--r--. 1 root root 65536 Jul 30 20:42 port_name -r--r--r--. 1 root root 65536 Jul 30 20:09 port_state -r--r--r--. 1 root root 65536 Jul 30 20:09 port_type drwxr-xr-x. 2 root root 0 Jul 30 20:42 power -r--r--r--. 1 root root 65536 Jul 30 20:09 speed lrwxrwxrwx. 1 root root 0 Jul 30 20:42 subsystem -> ../../../../../../class/fc_host -r--r--r--. 1 root root 65536 Jul 30 20:09 supported_classes -rw-r--r--. 1 root root 65536 Jul 30 20:42 tgtid_bind_type -rw-r--r--. 1 root root 65536 Jul 30 20:42 uevent ``` Since many filenames for counters are not guaranteed to exist in VMs, allocate if not present. Signed-off-by: Mark Hamzy --- collector/fibrechannel_linux.go | 31 +++++++++- collector/fibrechannel_linux_test.go | 51 +++++++++++++++++ collector/fixtures/e2e-64k-page-output.txt | 15 +++++ collector/fixtures/e2e-output.txt | 15 +++++ collector/fixtures/sys.ttar | 66 ++++++++++++++++++++++ 5 files changed, 175 insertions(+), 3 deletions(-) create mode 100644 collector/fibrechannel_linux_test.go diff --git a/collector/fibrechannel_linux.go b/collector/fibrechannel_linux.go index 4854b93a46..22628881c8 100644 --- a/collector/fibrechannel_linux.go +++ b/collector/fibrechannel_linux.go @@ -127,22 +127,47 @@ func (c *fibrechannelCollector) Update(ch chan<- prometheus.Metric) error { )...) // Then the counters - // Note: `procfs` does not guarantee a safe dereference for these counters. - // A disabled host returns no statistics counters. - if host.PortState == nil || *host.PortState == "Unknown" { + // Note: These are not guaranteed to exist in the filesystem + if host.Counters.DumpedFrames == nil { host.Counters.DumpedFrames = new(uint64) + } + if host.Counters.ErrorFrames == nil { host.Counters.ErrorFrames = new(uint64) + } + if host.Counters.InvalidCRCCount == nil { host.Counters.InvalidCRCCount = new(uint64) + } + if host.Counters.RXFrames == nil { host.Counters.RXFrames = new(uint64) + } + if host.Counters.RXWords == nil { host.Counters.RXWords = new(uint64) + } + if host.Counters.TXFrames == nil { host.Counters.TXFrames = new(uint64) + } + if host.Counters.TXWords == nil { host.Counters.TXWords = new(uint64) + } + if host.Counters.SecondsSinceLastReset == nil { host.Counters.SecondsSinceLastReset = new(uint64) + } + if host.Counters.InvalidTXWordCount == nil { host.Counters.InvalidTXWordCount = new(uint64) + } + if host.Counters.LinkFailureCount == nil { host.Counters.LinkFailureCount = new(uint64) + } + if host.Counters.LossOfSyncCount == nil { host.Counters.LossOfSyncCount = new(uint64) + } + if host.Counters.LossOfSignalCount == nil { host.Counters.LossOfSignalCount = new(uint64) + } + if host.Counters.NosCount == nil { host.Counters.NosCount = new(uint64) + } + if host.Counters.FCPPacketAborts == nil { host.Counters.FCPPacketAborts = new(uint64) } c.pushCounter(ch, "dumped_frames_total", *host.Counters.DumpedFrames, *host.Name) diff --git a/collector/fibrechannel_linux_test.go b/collector/fibrechannel_linux_test.go new file mode 100644 index 0000000000..d56fe211c0 --- /dev/null +++ b/collector/fibrechannel_linux_test.go @@ -0,0 +1,51 @@ +// Copyright 2021 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !nofibrechannel + +package collector + +import ( + "io" + "log/slog" + "testing" + + "github.com/prometheus/client_golang/prometheus" +) + +func TestFibreChannelCollector(t *testing.T) { + // The fixtures directory includes host2 which has + // port_state="Online" but an empty statistics/ dir. + // Before the fix, this would panic with a nil pointer + // dereference when trying to read counter values. + + logger := slog.New(slog.NewTextHandler(io.Discard, nil)) + + // Override sysPath to point to our fixtures + testSysPath := "fixtures/sys" + oldSysPath := *sysPath + *sysPath = testSysPath + defer func() { *sysPath = oldSysPath }() + + collector, err := NewFibreChannelCollector(logger) + if err != nil { + t.Fatal(err) + } + + // This should not panic even with missing statistics files + ch := make(chan prometheus.Metric, 100) + err = collector.Update(ch) + if err != nil { + t.Fatalf("unexpected error: %v", err) + } +} diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index f0ac7ebac4..7b8e4be5e4 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -1406,61 +1406,76 @@ node_entropy_pool_size_bits 4096 # HELP node_fibrechannel_dumped_frames_total Number of dumped frames # TYPE node_fibrechannel_dumped_frames_total counter node_fibrechannel_dumped_frames_total{fc_host="host1"} 0 +node_fibrechannel_dumped_frames_total{fc_host="host2"} 0 # HELP node_fibrechannel_error_frames_total Number of errors in frames # TYPE node_fibrechannel_error_frames_total counter node_fibrechannel_error_frames_total{fc_host="host0"} 0 node_fibrechannel_error_frames_total{fc_host="host1"} 19 +node_fibrechannel_error_frames_total{fc_host="host2"} 0 # HELP node_fibrechannel_fcp_packet_aborts_total Number of aborted packets # TYPE node_fibrechannel_fcp_packet_aborts_total counter node_fibrechannel_fcp_packet_aborts_total{fc_host="host0"} 19 +node_fibrechannel_fcp_packet_aborts_total{fc_host="host2"} 0 # HELP node_fibrechannel_info Non-numeric data from /sys/class/fc_host/, value is always 1. # TYPE node_fibrechannel_info gauge node_fibrechannel_info{dev_loss_tmo="",fabric_name="",fc_host="host1",port_id="",port_name="",port_state="Online",port_type="",speed="8 Gbit",supported_classes="",supported_speeds="",symbolic_name=""} 1 node_fibrechannel_info{dev_loss_tmo="30",fabric_name="0",fc_host="host0",port_id="000002",port_name="1000e0071bce95f2",port_state="Online",port_type="Point-To-Point (direct nport connection)",speed="16 Gbit",supported_classes="Class 3",supported_speeds="4 Gbit, 8 Gbit, 16 Gbit",symbolic_name="Emulex SN1100E2P FV12.4.270.3 DV12.4.0.0. HN:gotest. OS:Linux"} 1 +node_fibrechannel_info{dev_loss_tmo="300",fabric_name="c050760aab8f2cff",fc_host="host2",port_id="0b19e2",port_name="c050760aab8f2cff",port_state="Online",port_type="NPIV VPORT",speed="unknown",supported_classes="Class 3",supported_speeds="",symbolic_name=""} 1 # HELP node_fibrechannel_invalid_crc_total Invalid Cyclic Redundancy Check count # TYPE node_fibrechannel_invalid_crc_total counter node_fibrechannel_invalid_crc_total{fc_host="host0"} 2 node_fibrechannel_invalid_crc_total{fc_host="host1"} 32 +node_fibrechannel_invalid_crc_total{fc_host="host2"} 0 # HELP node_fibrechannel_invalid_tx_words_total Number of invalid words transmitted by host port # TYPE node_fibrechannel_invalid_tx_words_total counter node_fibrechannel_invalid_tx_words_total{fc_host="host0"} 8 node_fibrechannel_invalid_tx_words_total{fc_host="host1"} 128 +node_fibrechannel_invalid_tx_words_total{fc_host="host2"} 0 # HELP node_fibrechannel_link_failure_total Number of times the host port link has failed # TYPE node_fibrechannel_link_failure_total counter node_fibrechannel_link_failure_total{fc_host="host0"} 9 node_fibrechannel_link_failure_total{fc_host="host1"} 144 +node_fibrechannel_link_failure_total{fc_host="host2"} 0 # HELP node_fibrechannel_loss_of_signal_total Number of times signal has been lost # TYPE node_fibrechannel_loss_of_signal_total counter node_fibrechannel_loss_of_signal_total{fc_host="host0"} 17 node_fibrechannel_loss_of_signal_total{fc_host="host1"} 272 +node_fibrechannel_loss_of_signal_total{fc_host="host2"} 0 # HELP node_fibrechannel_loss_of_sync_total Number of failures on either bit or transmission word boundaries # TYPE node_fibrechannel_loss_of_sync_total counter node_fibrechannel_loss_of_sync_total{fc_host="host0"} 16 node_fibrechannel_loss_of_sync_total{fc_host="host1"} 256 +node_fibrechannel_loss_of_sync_total{fc_host="host2"} 0 # HELP node_fibrechannel_nos_total Number Not_Operational Primitive Sequence received by host port # TYPE node_fibrechannel_nos_total counter node_fibrechannel_nos_total{fc_host="host0"} 18 node_fibrechannel_nos_total{fc_host="host1"} 288 +node_fibrechannel_nos_total{fc_host="host2"} 0 # HELP node_fibrechannel_rx_frames_total Number of frames received # TYPE node_fibrechannel_rx_frames_total counter node_fibrechannel_rx_frames_total{fc_host="host0"} 3 node_fibrechannel_rx_frames_total{fc_host="host1"} 48 +node_fibrechannel_rx_frames_total{fc_host="host2"} 0 # HELP node_fibrechannel_rx_words_total Number of words received by host port # TYPE node_fibrechannel_rx_words_total counter node_fibrechannel_rx_words_total{fc_host="host0"} 4 node_fibrechannel_rx_words_total{fc_host="host1"} 64 +node_fibrechannel_rx_words_total{fc_host="host2"} 0 # HELP node_fibrechannel_seconds_since_last_reset_total Number of seconds since last host port reset # TYPE node_fibrechannel_seconds_since_last_reset_total counter node_fibrechannel_seconds_since_last_reset_total{fc_host="host0"} 7 node_fibrechannel_seconds_since_last_reset_total{fc_host="host1"} 112 +node_fibrechannel_seconds_since_last_reset_total{fc_host="host2"} 0 # HELP node_fibrechannel_tx_frames_total Number of frames transmitted by host port # TYPE node_fibrechannel_tx_frames_total counter node_fibrechannel_tx_frames_total{fc_host="host0"} 5 node_fibrechannel_tx_frames_total{fc_host="host1"} 80 +node_fibrechannel_tx_frames_total{fc_host="host2"} 0 # HELP node_fibrechannel_tx_words_total Number of words transmitted by host port # TYPE node_fibrechannel_tx_words_total counter node_fibrechannel_tx_words_total{fc_host="host0"} 6 node_fibrechannel_tx_words_total{fc_host="host1"} 96 +node_fibrechannel_tx_words_total{fc_host="host2"} 0 # HELP node_filefd_allocated File descriptor statistics: allocated. # TYPE node_filefd_allocated gauge node_filefd_allocated 1024 diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index 9afd903d6f..d03fb08f44 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -1438,61 +1438,76 @@ node_entropy_pool_size_bits 4096 # HELP node_fibrechannel_dumped_frames_total Number of dumped frames # TYPE node_fibrechannel_dumped_frames_total counter node_fibrechannel_dumped_frames_total{fc_host="host1"} 0 +node_fibrechannel_dumped_frames_total{fc_host="host2"} 0 # HELP node_fibrechannel_error_frames_total Number of errors in frames # TYPE node_fibrechannel_error_frames_total counter node_fibrechannel_error_frames_total{fc_host="host0"} 0 node_fibrechannel_error_frames_total{fc_host="host1"} 19 +node_fibrechannel_error_frames_total{fc_host="host2"} 0 # HELP node_fibrechannel_fcp_packet_aborts_total Number of aborted packets # TYPE node_fibrechannel_fcp_packet_aborts_total counter node_fibrechannel_fcp_packet_aborts_total{fc_host="host0"} 19 +node_fibrechannel_fcp_packet_aborts_total{fc_host="host2"} 0 # HELP node_fibrechannel_info Non-numeric data from /sys/class/fc_host/, value is always 1. # TYPE node_fibrechannel_info gauge node_fibrechannel_info{dev_loss_tmo="",fabric_name="",fc_host="host1",port_id="",port_name="",port_state="Online",port_type="",speed="8 Gbit",supported_classes="",supported_speeds="",symbolic_name=""} 1 node_fibrechannel_info{dev_loss_tmo="30",fabric_name="0",fc_host="host0",port_id="000002",port_name="1000e0071bce95f2",port_state="Online",port_type="Point-To-Point (direct nport connection)",speed="16 Gbit",supported_classes="Class 3",supported_speeds="4 Gbit, 8 Gbit, 16 Gbit",symbolic_name="Emulex SN1100E2P FV12.4.270.3 DV12.4.0.0. HN:gotest. OS:Linux"} 1 +node_fibrechannel_info{dev_loss_tmo="300",fabric_name="c050760aab8f2cff",fc_host="host2",port_id="0b19e2",port_name="c050760aab8f2cff",port_state="Online",port_type="NPIV VPORT",speed="unknown",supported_classes="Class 3",supported_speeds="",symbolic_name=""} 1 # HELP node_fibrechannel_invalid_crc_total Invalid Cyclic Redundancy Check count # TYPE node_fibrechannel_invalid_crc_total counter node_fibrechannel_invalid_crc_total{fc_host="host0"} 2 node_fibrechannel_invalid_crc_total{fc_host="host1"} 32 +node_fibrechannel_invalid_crc_total{fc_host="host2"} 0 # HELP node_fibrechannel_invalid_tx_words_total Number of invalid words transmitted by host port # TYPE node_fibrechannel_invalid_tx_words_total counter node_fibrechannel_invalid_tx_words_total{fc_host="host0"} 8 node_fibrechannel_invalid_tx_words_total{fc_host="host1"} 128 +node_fibrechannel_invalid_tx_words_total{fc_host="host2"} 0 # HELP node_fibrechannel_link_failure_total Number of times the host port link has failed # TYPE node_fibrechannel_link_failure_total counter node_fibrechannel_link_failure_total{fc_host="host0"} 9 node_fibrechannel_link_failure_total{fc_host="host1"} 144 +node_fibrechannel_link_failure_total{fc_host="host2"} 0 # HELP node_fibrechannel_loss_of_signal_total Number of times signal has been lost # TYPE node_fibrechannel_loss_of_signal_total counter node_fibrechannel_loss_of_signal_total{fc_host="host0"} 17 node_fibrechannel_loss_of_signal_total{fc_host="host1"} 272 +node_fibrechannel_loss_of_signal_total{fc_host="host2"} 0 # HELP node_fibrechannel_loss_of_sync_total Number of failures on either bit or transmission word boundaries # TYPE node_fibrechannel_loss_of_sync_total counter node_fibrechannel_loss_of_sync_total{fc_host="host0"} 16 node_fibrechannel_loss_of_sync_total{fc_host="host1"} 256 +node_fibrechannel_loss_of_sync_total{fc_host="host2"} 0 # HELP node_fibrechannel_nos_total Number Not_Operational Primitive Sequence received by host port # TYPE node_fibrechannel_nos_total counter node_fibrechannel_nos_total{fc_host="host0"} 18 node_fibrechannel_nos_total{fc_host="host1"} 288 +node_fibrechannel_nos_total{fc_host="host2"} 0 # HELP node_fibrechannel_rx_frames_total Number of frames received # TYPE node_fibrechannel_rx_frames_total counter node_fibrechannel_rx_frames_total{fc_host="host0"} 3 node_fibrechannel_rx_frames_total{fc_host="host1"} 48 +node_fibrechannel_rx_frames_total{fc_host="host2"} 0 # HELP node_fibrechannel_rx_words_total Number of words received by host port # TYPE node_fibrechannel_rx_words_total counter node_fibrechannel_rx_words_total{fc_host="host0"} 4 node_fibrechannel_rx_words_total{fc_host="host1"} 64 +node_fibrechannel_rx_words_total{fc_host="host2"} 0 # HELP node_fibrechannel_seconds_since_last_reset_total Number of seconds since last host port reset # TYPE node_fibrechannel_seconds_since_last_reset_total counter node_fibrechannel_seconds_since_last_reset_total{fc_host="host0"} 7 node_fibrechannel_seconds_since_last_reset_total{fc_host="host1"} 112 +node_fibrechannel_seconds_since_last_reset_total{fc_host="host2"} 0 # HELP node_fibrechannel_tx_frames_total Number of frames transmitted by host port # TYPE node_fibrechannel_tx_frames_total counter node_fibrechannel_tx_frames_total{fc_host="host0"} 5 node_fibrechannel_tx_frames_total{fc_host="host1"} 80 +node_fibrechannel_tx_frames_total{fc_host="host2"} 0 # HELP node_fibrechannel_tx_words_total Number of words transmitted by host port # TYPE node_fibrechannel_tx_words_total counter node_fibrechannel_tx_words_total{fc_host="host0"} 6 node_fibrechannel_tx_words_total{fc_host="host1"} 96 +node_fibrechannel_tx_words_total{fc_host="host2"} 0 # HELP node_filefd_allocated File descriptor statistics: allocated. # TYPE node_filefd_allocated gauge node_filefd_allocated 1024 diff --git a/collector/fixtures/sys.ttar b/collector/fixtures/sys.ttar index dfcc08bacf..06f38954f9 100644 --- a/collector/fixtures/sys.ttar +++ b/collector/fixtures/sys.ttar @@ -1381,6 +1381,72 @@ Lines: 1 0x60 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/class/fc_host/host2 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/fc_host/host2/dev_loss_tmo +Lines: 1 +300 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/fc_host/host2/fabric_name +Lines: 1 +0xc050760aab8f2cff +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/fc_host/host2/issue_lip +Lines: 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/fc_host/host2/maxframe_size +Lines: 1 +2048 bytes +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/fc_host/host2/node_name +Lines: 1 +0xc050760aab8f2cff +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/fc_host/host2/port_id +Lines: 1 +0x0b19e2 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/fc_host/host2/port_name +Lines: 1 +0xc050760aab8f2cff +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/fc_host/host2/port_state +Lines: 1 +Online +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/fc_host/host2/port_type +Lines: 1 +NPIV VPORT +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/fc_host/host2/speed +Lines: 1 +unknown +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/fc_host/host2/supported_classes +Lines: 1 +Class 3 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/fc_host/host2/tgtid_bind_type +Lines: 1 +wwpn (World Wide Port Name) +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/fc_host/host2/uevent +Lines: 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: sys/class/hwmon Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 0fc9422299bd1cec15ee10193a67914460652935 Mon Sep 17 00:00:00 2001 From: Yurii Kondrakov Date: Fri, 21 Aug 2026 08:36:01 -0400 Subject: [PATCH 18/87] Add `chip` label to DRM metrics (#3572) * Extend DRM labels Signed-off-by: Deezzir * chore: move `cleanMetricName` to a shared helper file Signed-off-by: Deezzir --------- Signed-off-by: Deezzir --- collector/drm_linux.go | 15 +++++++++++++-- collector/helper_linux.go | 30 ++++++++++++++++++++++++++++++ collector/hwmon_linux.go | 16 ++++------------ 3 files changed, 47 insertions(+), 14 deletions(-) create mode 100644 collector/helper_linux.go diff --git a/collector/drm_linux.go b/collector/drm_linux.go index 6c19514c4f..1739bc3d54 100644 --- a/collector/drm_linux.go +++ b/collector/drm_linux.go @@ -40,7 +40,7 @@ var ( drmCardInfo = prometheus.NewDesc( prometheus.BuildFQName(namespace, drmCollectorSubsystem, "card_info"), "Card information", - []string{"card", "memory_vendor", "power_performance_level", "unique_id", "vendor"}, nil, + []string{"card", "memory_vendor", "power_performance_level", "unique_id", "chip", "vendor"}, nil, ) drmGPUBusyPercent = prometheus.NewDesc( prometheus.BuildFQName(namespace, drmCollectorSubsystem, "gpu_busy_percent"), @@ -96,6 +96,17 @@ func (c *drmCollector) Update(ch chan<- prometheus.Metric) error { return c.updateAMDCards(ch) } +func chipName(s sysfs.ClassDRMCardAMDGPUStats) string { + // generate a chip name based on the deviceType and devName + cleanDevName := cleanMetricName(s.DevName) + cleanDevType := cleanMetricName(s.DevType) + + if cleanDevType != "" && cleanDevName != "" { + return cleanDevType + "_" + cleanDevName + } + return cleanDevName +} + func (c *drmCollector) updateAMDCards(ch chan<- prometheus.Metric) error { vendor := "amd" stats, err := c.fs.ClassDRMCardAMDGPUStats() @@ -106,7 +117,7 @@ func (c *drmCollector) updateAMDCards(ch chan<- prometheus.Metric) error { for _, s := range stats { ch <- prometheus.MustNewConstMetric( drmCardInfo, prometheus.GaugeValue, 1, - s.Name, s.MemoryVRAMVendor, s.PowerDPMForcePerformanceLevel, s.UniqueID, vendor) + s.Name, s.MemoryVRAMVendor, s.PowerDPMForcePerformanceLevel, s.UniqueID, chipName(s), vendor) ch <- prometheus.MustNewConstMetric( drmGPUBusyPercent, prometheus.GaugeValue, float64(s.GPUBusyPercent), s.Name) diff --git a/collector/helper_linux.go b/collector/helper_linux.go new file mode 100644 index 0000000000..36cf978023 --- /dev/null +++ b/collector/helper_linux.go @@ -0,0 +1,30 @@ +// Copyright The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package collector + +import ( + "regexp" + "strings" +) + +var ( + hwmonInvalidMetricChars = regexp.MustCompile("[^a-z0-9:_]") +) + +func cleanMetricName(name string) string { + lower := strings.ToLower(name) + replaced := hwmonInvalidMetricChars.ReplaceAllLiteralString(lower, "_") + cleaned := strings.Trim(replaced, "_") + return cleaned +} diff --git a/collector/hwmon_linux.go b/collector/hwmon_linux.go index 833782446a..5d9d4b7225 100644 --- a/collector/hwmon_linux.go +++ b/collector/hwmon_linux.go @@ -37,11 +37,10 @@ var ( collectorHWmonSensorInclude = kingpin.Flag("collector.hwmon.sensor-include", "Regexp of hwmon sensor to include (mutually exclusive to sensor-exclude).").String() collectorHWmonSensorExclude = kingpin.Flag("collector.hwmon.sensor-exclude", "Regexp of hwmon sensor to exclude (mutually exclusive to sensor-include).").String() - hwmonInvalidMetricChars = regexp.MustCompile("[^a-z0-9:_]") - hwmonFilenameFormat = regexp.MustCompile(`^(?P[^0-9]+)(?P[0-9]*)?(_(?P.+))?$`) - hwmonLabelDesc = []string{"chip", "sensor"} - hwmonChipNameLabelDesc = []string{"chip", "chip_name"} - hwmonSensorTypes = []string{ + hwmonFilenameFormat = regexp.MustCompile(`^(?P[^0-9]+)(?P[0-9]*)?(_(?P.+))?$`) + hwmonLabelDesc = []string{"chip", "sensor"} + hwmonChipNameLabelDesc = []string{"chip", "chip_name"} + hwmonSensorTypes = []string{ "vrm", "beep_enable", "update_interval", "in", "cpu", "fan", "pwm", "temp", "curr", "power", "energy", "humidity", "intrusion", "freq", @@ -69,13 +68,6 @@ func NewHwMonCollector(logger *slog.Logger) (Collector, error) { }, nil } -func cleanMetricName(name string) string { - lower := strings.ToLower(name) - replaced := hwmonInvalidMetricChars.ReplaceAllLiteralString(lower, "_") - cleaned := strings.Trim(replaced, "_") - return cleaned -} - func addValueFile(data map[string]map[string]string, sensor string, prop string, file string) { raw, err := sysReadFile(file) if err != nil { From c7126a10d5c4a944adc0767d1e50987e6a3769b0 Mon Sep 17 00:00:00 2001 From: Nicolas Takashi Date: Fri, 21 Aug 2026 13:38:08 +0100 Subject: [PATCH 19/87] [CHORE] adding agents.md (#3699) * [CHORE] adding agents.md Signed-off-by: Nicolas Takashi * Address review feedback: link naming conventions, note procfs usage Signed-off-by: Nicolas Takashi * Trim AGENTS.md per review: drop directory-listing sections, keep non-inferable rules Signed-off-by: Nicolas Takashi --------- Signed-off-by: Nicolas Takashi Signed-off-by: Nicolas Takashi --- AGENTS.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000000..144e10e532 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,32 @@ +# AGENTS.md + +## Rules +- Collector availability is controlled by Go build tags and OS-specific filenames; check `//go:build` lines before assuming a collector exists on the current OS. +- Use `kingpin.Flag()`, never `kingpin.Flag().Envar()`: the project has a "one-way-to-configure" policy of CLI flags only. Runtime env vars (`GOMAXPROCS`) and deprecated collectors are the only historical exceptions; maintainers have rejected env var flags for new code. +- Collector code must not shell out: `.golangci.yml` denies `os/exec` outside tests, and `CONTRIBUTING.md` says collectors may read `/proc`, `/sys`, use syscalls, or local sockets only. +- Keep metrics in the `node` namespace, follow the [Prometheus metric naming conventions](https://prometheus.io/docs/practices/naming/), and update README collector tables when adding, removing, enabling, disabling, or changing collector flags. +- Parse `/proc` files via the [`procfs`](https://github.com/prometheus/procfs) dependency rather than adding ad-hoc parsing in a collector; extend `procfs` upstream if a needed file isn't covered yet. + +## Build And Test Commands +- Full CI-like local check is `make`; it runs vet, metric/rule checks, shared Prometheus checks, 32-bit tests when supported, and Linux e2e only. +- Focused unit tests: `go test ./collector -run TestName` or `go test ./... -run TestName`; use `make test` when tests need unpacked fixtures. +- `make test` unpacks `collector/fixtures/sys.ttar` and `collector/fixtures/udev.ttar`, then runs `go test -short $(test-flags) ./...`. +- `make build` uses `promu` and writes `./node_exporter`, which `make test-e2e` expects; root tests in `node_exporter_test.go` skip unless a binary exists at `$GOPATH/bin/node_exporter`. +- `make test-e2e` is Linux-only from the main Makefile path; it depends on `make build`, fixture unpacking, and `make tools`. +- `make checkmetrics` downloads/uses `promtool` and checks `collector/fixtures/e2e-output*.txt`; run it after metric output changes. +- Lint/format shortcuts: `make format`, `make lint`, `make lint-fix`, `make yamllint`, `make unused`. + +## Fixtures And Generated Outputs +- Do not edit unpacked `collector/fixtures/sys/` or `collector/fixtures/udev/` as source of truth; update `collector/fixtures/sys.ttar` and `collector/fixtures/udev.ttar` with `make update_fixtures`. +- To refresh e2e metric golden files, run `make build tools` first, then `./end-to-end-test.sh -u`; it writes the appropriate `collector/fixtures/e2e-output*.txt`. +- `end-to-end-test.sh` filters collector flags by OS/build context using `tools/tools match`, so an ignored flag in e2e may mean the collector is build-tag-gated for that platform rather than broken (see `Rules`). + +## Toolchain Notes +- `go.mod`'s Go directive is not the source of truth for the toolchain version CI actually uses; check the workflow's `setup-go` step and `.promu.yml`/`.promu-cgo.yml`, which can each pin a different version. +- `Makefile.common` is shared Prometheus infrastructure; comments say to open PRs against `prometheus/prometheus/Makefile.common` for generic changes. +- golangci-lint version comes from `make print-golangci-lint-version` (`GOLANGCI_LINT_VERSION` in `Makefile.common`), not from a locally installed default. +- Docker builds produce per-arch images named `$(DOCKER_REPO)/node-exporter-linux-:$(DOCKER_IMAGE_TAG)` and cover `Dockerfile` plus `Dockerfile.*` variants. + +## Node Mixin +- Mixin checks are separate: CI runs `make promtool`, `make -C docs/node-mixin clean`, `make -C docs/node-mixin jb_install`, then `make -C docs/node-mixin` and expects `git diff --exit-code`. +- `docs/node-mixin` requires `jsonnet`, `jsonnetfmt`, and `jb`; generated files are `node_alerts.yaml`, `node_rules.yaml`, and `dashboards_out/`. From 365df48b47de5054343aa8359ec4d20167f6de1d Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Fri, 21 Aug 2026 14:41:29 +0200 Subject: [PATCH 20/87] Update common Prometheus files (#3789) Signed-off-by: prombot --- Makefile.common | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile.common b/Makefile.common index b336657fb3..cd54cb419c 100644 --- a/Makefile.common +++ b/Makefile.common @@ -165,8 +165,8 @@ common-deps: .PHONY: update-go-deps update-go-deps: @echo ">> updating Go dependencies" + # GOTOOLCHAIN prevents go get from pulling deps that require a newer Go version. @for m in $$($(GO) list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \ - # Prevent go get from pulling deps that require a newer Go version. GOTOOLCHAIN=go$$($(GO) mod edit -json | jq -r .Go) $(GO) get $$m; \ done $(GO) mod tidy @@ -247,6 +247,7 @@ common-docker-repo-name: .PHONY: common-docker $(BUILD_DOCKER_ARCHS) common-docker: $(BUILD_DOCKER_ARCHS) +# DOCKER_ARCHS holds promu architecture names, which are not OCI platform strings. $(BUILD_DOCKER_ARCHS): common-docker-%: @for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \ dockerfile=$${variant#*:}; \ @@ -255,10 +256,16 @@ $(BUILD_DOCKER_ARCHS): common-docker-%: if [ "$*" = "armv7" ]; then \ distroless_arch="arm"; \ fi; \ + arch="$*"; \ + case "$$arch" in \ + armv*) docker_platform="linux/arm/v$${arch#armv}";; \ + *) docker_platform="linux/$$arch";; \ + esac; \ if [ "$$dockerfile" = "Dockerfile" ]; then \ echo "Building default variant ($$variant_name) for linux-$* using $$dockerfile"; \ docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" \ -f $$dockerfile \ + --platform "$$docker_platform" \ --build-arg ARCH="$*" \ --build-arg OS="linux" \ --build-arg DISTROLESS_ARCH="$$distroless_arch" \ @@ -272,6 +279,7 @@ $(BUILD_DOCKER_ARCHS): common-docker-%: echo "Building $$variant_name variant for linux-$* using $$dockerfile"; \ docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name" \ -f $$dockerfile \ + --platform "$$docker_platform" \ --build-arg ARCH="$*" \ --build-arg OS="linux" \ --build-arg DISTROLESS_ARCH="$$distroless_arch" \ From 5b9f9b27194301f561ac7dce2ddd84c65048243e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Aug 2026 09:45:09 -0300 Subject: [PATCH 21/87] build(deps): bump vmactions/openbsd-vm from 1.4.4 to 1.4.5 (#3776) Bumps [vmactions/openbsd-vm](https://github.com/vmactions/openbsd-vm) from 1.4.4 to 1.4.5. - [Release notes](https://github.com/vmactions/openbsd-vm/releases) - [Commits](https://github.com/vmactions/openbsd-vm/compare/18edb32f4e48dae5865d7b8b3a9587bc01218a20...c941015845c0f0c429676840963dc63b226d4f69) --- updated-dependencies: - dependency-name: vmactions/openbsd-vm dependency-version: 1.4.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bsd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 9eb49c1935..459988d0b3 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -80,7 +80,7 @@ jobs: with: persist-credentials: false - name: test-e2e - uses: vmactions/openbsd-vm@18edb32f4e48dae5865d7b8b3a9587bc01218a20 # v1.4.4 + uses: vmactions/openbsd-vm@c941015845c0f0c429676840963dc63b226d4f69 # v1.4.5 with: copyback: false envs: 'GO_VERSION GNU_TAR_VERSION' From 254a86c0334cf194156a90d8535549f73e4cb122 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Aug 2026 09:45:30 -0300 Subject: [PATCH 22/87] build(deps): bump vmactions/solaris-vm from 1.3.7 to 1.3.8 (#3774) Bumps [vmactions/solaris-vm](https://github.com/vmactions/solaris-vm) from 1.3.7 to 1.3.8. - [Release notes](https://github.com/vmactions/solaris-vm/releases) - [Commits](https://github.com/vmactions/solaris-vm/compare/d30dd6c228c8661ade859e36ead7660b9a62efcc...315163f088b66e55bbcc45928bd224d4973b2312) --- updated-dependencies: - dependency-name: vmactions/solaris-vm dependency-version: 1.3.8 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bsd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 459988d0b3..9ba0346063 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -238,7 +238,7 @@ jobs: with: persist-credentials: false - name: test-e2e - uses: vmactions/solaris-vm@d30dd6c228c8661ade859e36ead7660b9a62efcc # v1.3.7 + uses: vmactions/solaris-vm@315163f088b66e55bbcc45928bd224d4973b2312 # v1.3.8 with: copyback: false envs: 'GO_VERSION' From 048741c011eb3f0b3c3a0e0b44ad8d4401e39911 Mon Sep 17 00:00:00 2001 From: USJUN <157643778+U-S-jun@users.noreply.github.com> Date: Fri, 21 Aug 2026 23:25:26 +0900 Subject: [PATCH 23/87] textfile: support UTF-8 metric and label names (#3729) Signed-off-by: USJUN --- collector/textfile.go | 2 +- collector/textfile_test.go | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/collector/textfile.go b/collector/textfile.go index 5b39609d73..6629eb9d8e 100644 --- a/collector/textfile.go +++ b/collector/textfile.go @@ -293,7 +293,7 @@ func (c *textFileCollector) processFile(dir, name string) (*time.Time, map[strin } defer f.Close() - parser := expfmt.NewTextParser(model.LegacyValidation) + parser := expfmt.NewTextParser(model.UTF8Validation) families, err := parser.TextToMetricFamilies(f) if err != nil { return nil, nil, fmt.Errorf("failed to parse textfile data from %q: %w", path, err) diff --git a/collector/textfile_test.go b/collector/textfile_test.go index 2fb31faca1..222ffa8fee 100644 --- a/collector/textfile_test.go +++ b/collector/textfile_test.go @@ -22,6 +22,7 @@ import ( "net/http" "net/http/httptest" "os" + "path/filepath" "testing" "github.com/alecthomas/kingpin/v2" @@ -156,3 +157,37 @@ func TestTextfileCollector(t *testing.T) { } } } + +func TestTextfileCollectorSupportsUTF8Names(t *testing.T) { + dir := t.TempDir() + const input = `# HELP "my.dotted.metric" A metric with UTF-8 compatible names. +# TYPE "my.dotted.metric" gauge +{"my.dotted.metric", "error.message"="Not Found"} 1 +` + if err := os.WriteFile(filepath.Join(dir, "test.prom"), []byte(input), 0o600); err != nil { + t.Fatal(err) + } + + c := &textFileCollector{ + paths: []string{dir}, + logger: slog.New(slog.NewTextHandler(io.Discard, nil)), + } + registry := prometheus.NewRegistry() + registry.MustRegister(collectorAdapter{c}) + + families, err := registry.Gather() + if err != nil { + t.Fatalf("failed to gather textfile with UTF-8 names: %v", err) + } + + for _, family := range families { + if family.GetName() != "my.dotted.metric" { + continue + } + if got := family.Metric[0].Label[0].GetName(); got != "error.message" { + t.Fatalf("expected dotted label name, got %q", got) + } + return + } + t.Fatalf("expected dotted metric name, got %v", families) +} From 6de91dab87b1bf8da77304a900435c58b06de37a Mon Sep 17 00:00:00 2001 From: at-blacknight Date: Sat, 22 Aug 2026 00:33:30 +1000 Subject: [PATCH 24/87] edac: Fix printf-style formatting in slog call (#3759) The Debug call added in #3734 passes printf verbs and positional arguments to slog, which does not format them. The format string is logged verbatim and the arguments are consumed as key/value pairs, so controller and channel numbers become attribute keys: a duplicate key when the two are equal, and otherwise a key whose name changes on every iteration. Under --log.format=json that is an object with a repeated key, and parsers silently drop one of the values. The csrow number and the error, the two things worth reading, are the only parts that survive, and they appear as values of meaningless keys. %w compounds it: that is an fmt.Errorf directive and not a valid Printf verb, left behind when the error return this replaced was converted to a log line. Pass the values as named attributes instead. Metric output is unchanged. Signed-off-by: Adam Butler --- collector/edac_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/edac_linux.go b/collector/edac_linux.go index 784d8c1095..f5f95c2075 100644 --- a/collector/edac_linux.go +++ b/collector/edac_linux.go @@ -201,7 +201,7 @@ func (c *edacCollector) Update(ch chan<- prometheus.Metric) error { label, ) } else { - c.logger.Debug("couldn't get ue_count for controller/csrow/channel %s/%s/%s: %w", controllerNumber, csrowNumber, channelNumber, err) + c.logger.Debug("couldn't get ue_count", "controller", controllerNumber, "csrow", csrowNumber, "channel", channelNumber, "err", err) } } } From baa938bdb57bbcf974d343076fdbd1063564d4eb Mon Sep 17 00:00:00 2001 From: Nicolas Takashi Date: Thu, 27 Aug 2026 08:33:04 +0100 Subject: [PATCH 25/87] main: use exporter-toolkit bootstrap runner (#3660) Refactor node_exporter's entrypoint to build its configuration and run via the exporter-toolkit bootstrap runner, as groundwork for making node_exporter easier to embed outside the standalone binary. Signed-off-by: Nicolas Takashi --- go.mod | 2 +- go.sum | 4 +-- node_exporter.go | 83 +++++++++++++----------------------------------- 3 files changed, 25 insertions(+), 64 deletions(-) diff --git a/go.mod b/go.mod index 7c4458e399..7fa9aaa664 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/prometheus/client_golang v1.24.1 github.com/prometheus/client_model v0.6.2 github.com/prometheus/common v0.70.1 - github.com/prometheus/exporter-toolkit v0.17.1 + github.com/prometheus/exporter-toolkit v0.19.0 github.com/prometheus/procfs v0.21.1 github.com/safchain/ethtool v0.7.0 golang.org/x/sys v0.47.0 diff --git a/go.sum b/go.sum index 58c02fe429..b6f9aef455 100644 --- a/go.sum +++ b/go.sum @@ -82,8 +82,8 @@ github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNw github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= github.com/prometheus/common v0.70.1 h1:1HvjP4D5oL3t8RsPlwxA9onvvStjtIHYE5XuuwOi/PY= github.com/prometheus/common v0.70.1/go.mod h1:VdFUQDMZK3VLkurFUVhia6uys/0suUp86TJz5qbJRhc= -github.com/prometheus/exporter-toolkit v0.17.1 h1:psKN4wM7shBL/BxZkDHgm6YZJ3fAVG36+r86An/+7q0= -github.com/prometheus/exporter-toolkit v0.17.1/go.mod h1:dabwPJvxsC5+tsp2iolQrqBWZh+QlISKlYRpj9Hh5xk= +github.com/prometheus/exporter-toolkit v0.19.0 h1:JljWCzE5naAiZ7Ukeb8PwjNbU+WwISuW0ktgdXMnMhc= +github.com/prometheus/exporter-toolkit v0.19.0/go.mod h1:kOoEK/7wbe2Ns33l7wYHOXDZAZ/XGLyJqoGwmJxK+QU= github.com/prometheus/procfs v0.21.1 h1:GljZCt+zSTS+NZq88cyQ1LjZ+RCHp3uVuabBWA5+OJI= github.com/prometheus/procfs v0.21.1/go.mod h1:aB55Cww9pdSJVHk0hUf0inxWyyjPogFIjmHKYgMKmtY= github.com/safchain/ethtool v0.7.0 h1:rlJzfDetsVvT61uz8x1YIcFn12akMfuPulHtZjtb7Is= diff --git a/node_exporter.go b/node_exporter.go index 17c372eb31..ac990dee29 100644 --- a/node_exporter.go +++ b/node_exporter.go @@ -24,17 +24,12 @@ import ( "slices" "sort" - "github.com/prometheus/common/promslog" - "github.com/prometheus/common/promslog/flag" - "github.com/alecthomas/kingpin/v2" "github.com/prometheus/client_golang/prometheus" promcollectors "github.com/prometheus/client_golang/prometheus/collectors" versioncollector "github.com/prometheus/client_golang/prometheus/collectors/version" "github.com/prometheus/client_golang/prometheus/promhttp" - "github.com/prometheus/common/version" - "github.com/prometheus/exporter-toolkit/web" - "github.com/prometheus/exporter-toolkit/web/kingpinflag" + "github.com/prometheus/exporter-toolkit/bootstrap" "github.com/prometheus/node_exporter/collector" ) @@ -181,18 +176,6 @@ func (h *handler) innerHandler(filters ...string) (http.Handler, error) { func main() { var ( - metricsPath = kingpin.Flag( - "web.telemetry-path", - "Path under which to expose metrics.", - ).Default("/metrics").String() - disableExporterMetrics = kingpin.Flag( - "web.disable-exporter-metrics", - "Exclude metrics about the exporter itself (promhttp_*, process_*, go_*).", - ).Bool() - maxRequests = kingpin.Flag( - "web.max-requests", - "Maximum number of parallel scrape requests. Use 0 to disable.", - ).Default("40").Int() disableDefaultCollectors = kingpin.Flag( "collector.disable-defaults", "Set all collectors to disabled by default.", @@ -200,52 +183,30 @@ func main() { maxProcs = kingpin.Flag( "runtime.gomaxprocs", "The target number of CPUs Go will run on (GOMAXPROCS)", ).Envar("GOMAXPROCS").Default("1").Int() - toolkitFlags = kingpinflag.AddFlags(kingpin.CommandLine, ":9100") ) - promslogConfig := &promslog.Config{} - flag.AddFlags(kingpin.CommandLine, promslogConfig) - kingpin.Version(version.Print("node_exporter")) kingpin.CommandLine.UsageWriter(os.Stdout) - kingpin.HelpFlag.Short('h') - kingpin.Parse() - logger := promslog.New(promslogConfig) - - if *disableDefaultCollectors { - collector.DisableDefaultCollectors() - } - logger.Info("Starting node_exporter", "version", version.Info()) - logger.Info("Build context", "build_context", version.BuildContext()) - if user, err := user.Current(); err == nil && user.Uid == "0" { - logger.Warn("Node Exporter is running as root user. This exporter is designed to run as unprivileged user, root is not required.") - } - runtime.GOMAXPROCS(*maxProcs) - logger.Debug("Go MAXPROCS", "procs", runtime.GOMAXPROCS(0)) - - http.Handle(*metricsPath, newHandler(!*disableExporterMetrics, *maxRequests, logger)) - if *metricsPath != "/" { - landingConfig := web.LandingConfig{ - Name: "Node Exporter", - Description: "Prometheus Node Exporter", - Version: version.Info(), - Links: []web.LandingLinks{ - { - Address: *metricsPath, - Text: "Metrics", - }, - }, - } - landingPage, err := web.NewLandingPage(landingConfig) - if err != nil { - logger.Error(err.Error()) - os.Exit(1) - } - http.Handle("/", landingPage) - } - - server := &http.Server{} - if err := web.ListenAndServe(server, toolkitFlags, logger); err != nil { - logger.Error(err.Error()) + runner := bootstrap.New(bootstrap.Config{ + App: kingpin.CommandLine, + Name: "node_exporter", + Description: "Prometheus Node Exporter", + DefaultAddress: ":9100", + MetricsHandlerFactory: func(b *bootstrap.Bootstrap) (http.Handler, error) { + if *disableDefaultCollectors { + collector.DisableDefaultCollectors() + } + if user, err := user.Current(); err == nil && user.Uid == "0" { + b.Logger.Warn("Node Exporter is running as root user. This exporter is designed to run as unprivileged user, root is not required.") + } + runtime.GOMAXPROCS(*maxProcs) + b.Logger.Debug("Go MAXPROCS", "procs", runtime.GOMAXPROCS(0)) + b.Handle("/debug/pprof/", http.DefaultServeMux) + return newHandler(!b.DisableExporterMetrics, b.MaxRequests, b.Logger), nil + }, + }) + + if err := runner.Run(); err != nil { + fmt.Fprintln(os.Stderr, err) os.Exit(1) } } From 963cc14f99e033eb537aa0e6b0ee82e08322d28b Mon Sep 17 00:00:00 2001 From: Rene Treffer Date: Fri, 28 Aug 2026 18:44:41 +0200 Subject: [PATCH 26/87] Revert dup cpu frequency, add node_cpufreq flag (#3795) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both cpu_linux and cpufreq export cpu frequencies under the same name. This makes the metric mutually exclusive. A previous PR made it possible to enable both which can cause flapping help texts. This PR re-introduces mutual-exclusive behavior for the frequencies. A new flag `collector.cpufreq.enable-cpufreq-prefix` can be used to migrate all cpufreq metrics to node_cpufreq to avoid the collision. Signed-off-by: René Treffer --- collector/cpu_linux.go | 5 +- collector/cpufreq_common.go | 110 ++++++++++++++++++------------ collector/cpufreq_linux.go | 18 ++--- collector/cpufreq_linux_test.go | 106 ++++++++++++++++++++++++++++ collector/cpufreq_solaris.go | 6 +- collector/fixtures/e2e-output.txt | 10 --- 6 files changed, 192 insertions(+), 63 deletions(-) create mode 100644 collector/cpufreq_linux_test.go diff --git a/collector/cpu_linux.go b/collector/cpu_linux.go index f7b0c3ef1f..3b65a5734a 100644 --- a/collector/cpu_linux.go +++ b/collector/cpu_linux.go @@ -219,10 +219,13 @@ func (c *cpuCollector) updateInfo(ch chan<- prometheus.Metric) error { cpu.CacheSize) } + // The cpufreq collector exports the same metric name with a different + // help string and label set. Only export the /proc/cpuinfo frequency + // when cpufreq is disabled or uses its own metric prefix. cpuFreqEnabled, ok := collectorState["cpufreq"] if !ok || cpuFreqEnabled == nil { c.logger.Debug("cpufreq key missing or nil value in collectorState map") - } else if *cpuFreqEnabled { + } else if !*cpuFreqEnabled || *useCPUFreqPrefix { for _, cpu := range info { ch <- prometheus.MustNewConstMetric(c.cpuFrequencyHz, prometheus.GaugeValue, diff --git a/collector/cpufreq_common.go b/collector/cpufreq_common.go index d9d5108bb4..64cbe7e4f0 100644 --- a/collector/cpufreq_common.go +++ b/collector/cpufreq_common.go @@ -16,48 +16,74 @@ package collector import ( + "github.com/alecthomas/kingpin/v2" "github.com/prometheus/client_golang/prometheus" ) -var ( - cpuFreqHertzDesc = prometheus.NewDesc( - prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "frequency_hertz"), - "Current CPU thread frequency in hertz.", - []string{"cpu"}, nil, - ) - cpuFreqAvgDesc = prometheus.NewDesc( - prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "frequency_avg_hertz"), - "Average CPU thread frequency in hertz.", - []string{"cpu"}, nil, - ) - cpuFreqMinDesc = prometheus.NewDesc( - prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "frequency_min_hertz"), - "Minimum CPU thread frequency in hertz.", - []string{"cpu"}, nil, - ) - cpuFreqMaxDesc = prometheus.NewDesc( - prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "frequency_max_hertz"), - "Maximum CPU thread frequency in hertz.", - []string{"cpu"}, nil, - ) - cpuFreqScalingFreqDesc = prometheus.NewDesc( - prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "scaling_frequency_hertz"), - "Current scaled CPU thread frequency in hertz.", - []string{"cpu"}, nil, - ) - cpuFreqScalingFreqMinDesc = prometheus.NewDesc( - prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "scaling_frequency_min_hertz"), - "Minimum scaled CPU thread frequency in hertz.", - []string{"cpu"}, nil, - ) - cpuFreqScalingFreqMaxDesc = prometheus.NewDesc( - prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "scaling_frequency_max_hertz"), - "Maximum scaled CPU thread frequency in hertz.", - []string{"cpu"}, nil, - ) - cpuFreqScalingGovernorDesc = prometheus.NewDesc( - prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "scaling_governor"), - "Current enabled CPU frequency governor.", - []string{"cpu", "governor"}, nil, - ) -) +const cpuFreqCollectorSubsystem = "cpufreq" + +var useCPUFreqPrefix = kingpin.Flag("collector.cpufreq.enable-cpufreq-prefix", + "Expose cpufreq metrics with the node_cpufreq_ prefix instead of node_cpu_. This avoids a metric name collision with the cpu collector and will be the default behavior in 2.x.").Bool() + +type cpuFreqDescs struct { + hertz *prometheus.Desc + avgHertz *prometheus.Desc + minHertz *prometheus.Desc + maxHertz *prometheus.Desc + scalingHertz *prometheus.Desc + scalingMinHertz *prometheus.Desc + scalingMaxHertz *prometheus.Desc + scalingGovernor *prometheus.Desc +} + +// newCPUFreqDescs builds the cpufreq metric descriptions. It must run after +// flag parsing because the metric prefix depends on +// --collector.cpufreq.enable-cpufreq-prefix. +func newCPUFreqDescs() cpuFreqDescs { + subsystem := cpuCollectorSubsystem + if *useCPUFreqPrefix { + subsystem = cpuFreqCollectorSubsystem + } + return cpuFreqDescs{ + hertz: prometheus.NewDesc( + prometheus.BuildFQName(namespace, subsystem, "frequency_hertz"), + "Current CPU thread frequency in hertz.", + []string{"cpu"}, nil, + ), + avgHertz: prometheus.NewDesc( + prometheus.BuildFQName(namespace, subsystem, "frequency_avg_hertz"), + "Average CPU thread frequency in hertz.", + []string{"cpu"}, nil, + ), + minHertz: prometheus.NewDesc( + prometheus.BuildFQName(namespace, subsystem, "frequency_min_hertz"), + "Minimum CPU thread frequency in hertz.", + []string{"cpu"}, nil, + ), + maxHertz: prometheus.NewDesc( + prometheus.BuildFQName(namespace, subsystem, "frequency_max_hertz"), + "Maximum CPU thread frequency in hertz.", + []string{"cpu"}, nil, + ), + scalingHertz: prometheus.NewDesc( + prometheus.BuildFQName(namespace, subsystem, "scaling_frequency_hertz"), + "Current scaled CPU thread frequency in hertz.", + []string{"cpu"}, nil, + ), + scalingMinHertz: prometheus.NewDesc( + prometheus.BuildFQName(namespace, subsystem, "scaling_frequency_min_hertz"), + "Minimum scaled CPU thread frequency in hertz.", + []string{"cpu"}, nil, + ), + scalingMaxHertz: prometheus.NewDesc( + prometheus.BuildFQName(namespace, subsystem, "scaling_frequency_max_hertz"), + "Maximum scaled CPU thread frequency in hertz.", + []string{"cpu"}, nil, + ), + scalingGovernor: prometheus.NewDesc( + prometheus.BuildFQName(namespace, subsystem, "scaling_governor"), + "Current enabled CPU frequency governor.", + []string{"cpu", "governor"}, nil, + ), + } +} diff --git a/collector/cpufreq_linux.go b/collector/cpufreq_linux.go index fbefdcf899..3c759d55e5 100644 --- a/collector/cpufreq_linux.go +++ b/collector/cpufreq_linux.go @@ -26,6 +26,7 @@ import ( type cpuFreqCollector struct { fs sysfs.FS + descs cpuFreqDescs logger *slog.Logger } @@ -42,6 +43,7 @@ func NewCPUFreqCollector(logger *slog.Logger) (Collector, error) { return &cpuFreqCollector{ fs: fs, + descs: newCPUFreqDescs(), logger: logger, }, nil } @@ -58,7 +60,7 @@ func (c *cpuFreqCollector) Update(ch chan<- prometheus.Metric) error { for _, stats := range cpuFreqs { if stats.CpuinfoCurrentFrequency != nil { ch <- prometheus.MustNewConstMetric( - cpuFreqHertzDesc, + c.descs.hertz, prometheus.GaugeValue, float64(*stats.CpuinfoCurrentFrequency)*1000.0, stats.Name, @@ -66,7 +68,7 @@ func (c *cpuFreqCollector) Update(ch chan<- prometheus.Metric) error { } if stats.CpuinfoAverageFrequency != nil { ch <- prometheus.MustNewConstMetric( - cpuFreqAvgDesc, + c.descs.avgHertz, prometheus.GaugeValue, float64(*stats.CpuinfoAverageFrequency)*1000.0, stats.Name, @@ -74,7 +76,7 @@ func (c *cpuFreqCollector) Update(ch chan<- prometheus.Metric) error { } if stats.CpuinfoMinimumFrequency != nil { ch <- prometheus.MustNewConstMetric( - cpuFreqMinDesc, + c.descs.minHertz, prometheus.GaugeValue, float64(*stats.CpuinfoMinimumFrequency)*1000.0, stats.Name, @@ -82,7 +84,7 @@ func (c *cpuFreqCollector) Update(ch chan<- prometheus.Metric) error { } if stats.CpuinfoMaximumFrequency != nil { ch <- prometheus.MustNewConstMetric( - cpuFreqMaxDesc, + c.descs.maxHertz, prometheus.GaugeValue, float64(*stats.CpuinfoMaximumFrequency)*1000.0, stats.Name, @@ -90,7 +92,7 @@ func (c *cpuFreqCollector) Update(ch chan<- prometheus.Metric) error { } if stats.ScalingCurrentFrequency != nil { ch <- prometheus.MustNewConstMetric( - cpuFreqScalingFreqDesc, + c.descs.scalingHertz, prometheus.GaugeValue, float64(*stats.ScalingCurrentFrequency)*1000.0, stats.Name, @@ -98,7 +100,7 @@ func (c *cpuFreqCollector) Update(ch chan<- prometheus.Metric) error { } if stats.ScalingMinimumFrequency != nil { ch <- prometheus.MustNewConstMetric( - cpuFreqScalingFreqMinDesc, + c.descs.scalingMinHertz, prometheus.GaugeValue, float64(*stats.ScalingMinimumFrequency)*1000.0, stats.Name, @@ -106,7 +108,7 @@ func (c *cpuFreqCollector) Update(ch chan<- prometheus.Metric) error { } if stats.ScalingMaximumFrequency != nil { ch <- prometheus.MustNewConstMetric( - cpuFreqScalingFreqMaxDesc, + c.descs.scalingMaxHertz, prometheus.GaugeValue, float64(*stats.ScalingMaximumFrequency)*1000.0, stats.Name, @@ -120,7 +122,7 @@ func (c *cpuFreqCollector) Update(ch chan<- prometheus.Metric) error { state = 1 } ch <- prometheus.MustNewConstMetric( - cpuFreqScalingGovernorDesc, + c.descs.scalingGovernor, prometheus.GaugeValue, float64(state), stats.Name, diff --git a/collector/cpufreq_linux_test.go b/collector/cpufreq_linux_test.go new file mode 100644 index 0000000000..0b2a782ccb --- /dev/null +++ b/collector/cpufreq_linux_test.go @@ -0,0 +1,106 @@ +// Copyright The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !nocpu + +package collector + +import ( + "fmt" + "io" + "log/slog" + "strings" + "testing" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/testutil" +) + +type testCPUFreqCollector struct { + mc Collector +} + +func (c testCPUFreqCollector) Collect(ch chan<- prometheus.Metric) { + c.mc.Update(ch) +} + +func (c testCPUFreqCollector) Describe(ch chan<- *prometheus.Desc) { + prometheus.DescribeByCollect(c, ch) +} + +func newTestCPUFreqCollector(logger *slog.Logger) (prometheus.Collector, error) { + mc, err := NewCPUFreqCollector(logger) + if err != nil { + return testCPUFreqCollector{}, err + } + return &testCPUFreqCollector{mc}, nil +} + +const cpuFreqFixtureMetrics = `# HELP node_%[1]s_scaling_frequency_hertz Current scaled CPU thread frequency in hertz. +# TYPE node_%[1]s_scaling_frequency_hertz gauge +node_%[1]s_scaling_frequency_hertz{cpu="0"} 1.699981e+09 +node_%[1]s_scaling_frequency_hertz{cpu="1"} 1.699981e+09 +node_%[1]s_scaling_frequency_hertz{cpu="2"} 8e+06 +node_%[1]s_scaling_frequency_hertz{cpu="3"} 8e+06 +# HELP node_%[1]s_scaling_frequency_max_hertz Maximum scaled CPU thread frequency in hertz. +# TYPE node_%[1]s_scaling_frequency_max_hertz gauge +node_%[1]s_scaling_frequency_max_hertz{cpu="0"} 3.7e+09 +node_%[1]s_scaling_frequency_max_hertz{cpu="1"} 3.7e+09 +node_%[1]s_scaling_frequency_max_hertz{cpu="2"} 4.2e+09 +node_%[1]s_scaling_frequency_max_hertz{cpu="3"} 4.2e+09 +# HELP node_%[1]s_scaling_frequency_min_hertz Minimum scaled CPU thread frequency in hertz. +# TYPE node_%[1]s_scaling_frequency_min_hertz gauge +node_%[1]s_scaling_frequency_min_hertz{cpu="0"} 8e+08 +node_%[1]s_scaling_frequency_min_hertz{cpu="1"} 8e+08 +node_%[1]s_scaling_frequency_min_hertz{cpu="2"} 1e+06 +node_%[1]s_scaling_frequency_min_hertz{cpu="3"} 1e+06 +# HELP node_%[1]s_scaling_governor Current enabled CPU frequency governor. +# TYPE node_%[1]s_scaling_governor gauge +node_%[1]s_scaling_governor{cpu="0",governor="performance"} 0 +node_%[1]s_scaling_governor{cpu="0",governor="powersave"} 1 +node_%[1]s_scaling_governor{cpu="1",governor="performance"} 0 +node_%[1]s_scaling_governor{cpu="1",governor="powersave"} 1 +node_%[1]s_scaling_governor{cpu="2",governor="performance"} 0 +node_%[1]s_scaling_governor{cpu="2",governor="powersave"} 1 +node_%[1]s_scaling_governor{cpu="3",governor="performance"} 0 +node_%[1]s_scaling_governor{cpu="3",governor="powersave"} 1 +` + +func TestCPUFreqMetrics(t *testing.T) { + *sysPath = "fixtures/sys" + + for _, tc := range []struct { + name string + cpufreqPrefix bool + subsystem string + }{ + {name: "cpu prefix", cpufreqPrefix: false, subsystem: "cpu"}, + {name: "cpufreq prefix", cpufreqPrefix: true, subsystem: "cpufreq"}, + } { + t.Run(tc.name, func(t *testing.T) { + *useCPUFreqPrefix = tc.cpufreqPrefix + defer func() { *useCPUFreqPrefix = false }() + + logger := slog.New(slog.NewTextHandler(io.Discard, nil)) + collector, err := newTestCPUFreqCollector(logger) + if err != nil { + t.Fatal(err) + } + + expected := fmt.Sprintf(cpuFreqFixtureMetrics, tc.subsystem) + if err := testutil.CollectAndCompare(collector, strings.NewReader(expected)); err != nil { + t.Fatal(err) + } + }) + } +} diff --git a/collector/cpufreq_solaris.go b/collector/cpufreq_solaris.go index 41826a999c..69b7c57400 100644 --- a/collector/cpufreq_solaris.go +++ b/collector/cpufreq_solaris.go @@ -28,6 +28,7 @@ import ( import "C" type cpuFreqCollector struct { + descs cpuFreqDescs logger *slog.Logger } @@ -37,6 +38,7 @@ func init() { func NewCpuFreqCollector(logger *slog.Logger) (Collector, error) { return &cpuFreqCollector{ + descs: newCPUFreqDescs(), logger: logger, }, nil } @@ -68,14 +70,14 @@ func (c *cpuFreqCollector) Update(ch chan<- prometheus.Metric) error { lcpu := strconv.Itoa(cpu) ch <- prometheus.MustNewConstMetric( - cpuFreqHertzDesc, + c.descs.hertz, prometheus.GaugeValue, float64(cpuFreqV.UintVal), lcpu, ) // Multiply by 1e+6 to convert MHz to Hz. ch <- prometheus.MustNewConstMetric( - cpuFreqMaxDesc, + c.descs.maxHertz, prometheus.GaugeValue, float64(cpuFreqMaxV.IntVal)*1e+6, lcpu, diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index d03fb08f44..2e2a42b0e5 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -902,16 +902,6 @@ node_cpu_flag_info{flag="aes"} 1 node_cpu_flag_info{flag="avx"} 1 node_cpu_flag_info{flag="avx2"} 1 node_cpu_flag_info{flag="constant_tsc"} 1 -# HELP node_cpu_frequency_hertz CPU frequency in hertz from /proc/cpuinfo. -# TYPE node_cpu_frequency_hertz gauge -node_cpu_frequency_hertz{core="0",cpu="0",package="0"} 7.99998e+08 -node_cpu_frequency_hertz{core="0",cpu="4",package="0"} 7.99989e+08 -node_cpu_frequency_hertz{core="1",cpu="1",package="0"} 8.00037e+08 -node_cpu_frequency_hertz{core="1",cpu="5",package="0"} 8.00083e+08 -node_cpu_frequency_hertz{core="2",cpu="2",package="0"} 8.0001e+08 -node_cpu_frequency_hertz{core="2",cpu="6",package="0"} 8.00017e+08 -node_cpu_frequency_hertz{core="3",cpu="3",package="0"} 8.00028e+08 -node_cpu_frequency_hertz{core="3",cpu="7",package="0"} 8.0003e+08 # HELP node_cpu_guest_seconds_total Seconds the CPUs spent in guests (VMs) for each mode. # TYPE node_cpu_guest_seconds_total counter node_cpu_guest_seconds_total{cpu="0",mode="nice"} 0.01 From 9a077374d780c3cbda129a5760fb785853c79542 Mon Sep 17 00:00:00 2001 From: Jason Jiang Date: Sat, 29 Aug 2026 20:54:41 +0800 Subject: [PATCH 27/87] docs: clarify Docker rootfs wording (#3653) Signed-off-by: jcj46548-ux Co-authored-by: Ben Kochie --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8abf2cdf0f..713663132b 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ the `node_exporter` access to the host namespaces. Be aware that any non-root mount points you want to monitor will need to be bind-mounted into the container. -If you start container for host monitoring, specify `path.rootfs` argument. +If you start a container for host monitoring, specify the `path.rootfs` argument. This argument must match path in bind-mount of host root. The node\_exporter will use `path.rootfs` as prefix to access host filesystem. From 794e058b51d43ed089e739370889761a3ffe7d01 Mon Sep 17 00:00:00 2001 From: neoLsH <43921685+neoLsH@users.noreply.github.com> Date: Mon, 31 Aug 2026 21:29:08 +0800 Subject: [PATCH 28/87] netstat: Use procfs parsers for netstat, snmp and snmp6 (#3796) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * netstat: Use procfs parsers for netstat, snmp and snmp6 Replace the hand-written parsers for /proc/net/netstat, /proc/net/snmp and /proc/net/snmp6 with the parsers from prometheus/procfs (Proc.Netstat, Proc.Snmp and Proc.Snmp6). The statistics are read via /proc/self/net, which is equivalent to /proc/net (both are network-namespace local views of the current process), so the collected data is unchanged. Metrics are exposed by iterating the procfs statistics structs, the same approach the NFS collector uses: fields are *float64 and only the ones present on the system are exported, matching the previous behavior. The --collector.netstat.fields flag and the exported metric names are unchanged; the e2e golden output is identical. Signed-off-by: neoLsH <43921685+neoLsH@users.noreply.github.com> * netstat: use explicit package-level metric descriptors Replace the per-scrape prometheus.NewDesc calls with a pre-built map of explicit descriptors (netstat_descs_linux.go, generated from the procfs statistics structs), as requested in review. Collection still reflects over the procfs structs but looks up the descriptor by "_", so descriptors are allocated once and are source-visible literals for the AST-based doc generation. Metric names, help strings and types are unchanged. Signed-off-by: 霏承 * Bump procfs to v0.22.0 to populate legacy TcpExt descriptors 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 #3796. Signed-off-by: 霏承 * Add generator and drift test for the netstat descriptor table netstat_descs_linux.go was previously committed without its generator. Add an in-repo generator (netstat_descs_gen.go, a build-ignored program run via GOOS=linux go generate ./collector) that regenerates the explicit descriptor table from the procfs structs, mirroring the go:generate pattern used elsewhere in the Prometheus ecosystem. Add TestNetStatDescsInSync, a drift test that fails if the committed table diverges from the procfs structs (e.g. after a procfs upgrade) until the table is regenerated. Part of #3796. Signed-off-by: 霏承 --------- Signed-off-by: neoLsH <43921685+neoLsH@users.noreply.github.com> Signed-off-by: 霏承 --- collector/fixtures/proc/10/net | 1 + collector/netstat_descs_drift_test.go | 78 ++ collector/netstat_descs_gen.go | 96 ++ collector/netstat_descs_linux.go | 1262 +++++++++++++++++++++++++ collector/netstat_linux.go | 159 ++-- collector/netstat_linux_test.go | 215 +++-- go.mod | 2 +- go.sum | 4 +- 8 files changed, 1652 insertions(+), 165 deletions(-) create mode 120000 collector/fixtures/proc/10/net create mode 100644 collector/netstat_descs_drift_test.go create mode 100644 collector/netstat_descs_gen.go create mode 100644 collector/netstat_descs_linux.go diff --git a/collector/fixtures/proc/10/net b/collector/fixtures/proc/10/net new file mode 120000 index 0000000000..f1e889e8e3 --- /dev/null +++ b/collector/fixtures/proc/10/net @@ -0,0 +1 @@ +../net \ No newline at end of file diff --git a/collector/netstat_descs_drift_test.go b/collector/netstat_descs_drift_test.go new file mode 100644 index 0000000000..8be8ee72b7 --- /dev/null +++ b/collector/netstat_descs_drift_test.go @@ -0,0 +1,78 @@ +// Copyright The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package collector + +import ( + "os" + "reflect" + "regexp" + "sort" + "testing" + + "github.com/prometheus/procfs" +) + +// TestNetStatDescsInSync guards against drift between the committed descriptor +// table (netstat_descs_linux.go) and the procfs structs it is generated from. +// If a procfs upgrade adds or removes statistics fields, this test fails until +// the table is regenerated with `GOOS=linux go generate ./collector`. +func TestNetStatDescsInSync(t *testing.T) { + src, err := os.ReadFile("netstat_descs_linux.go") + if err != nil { + t.Fatalf("read netstat_descs_linux.go: %v", err) + } + + re := regexp.MustCompile(`"([A-Za-z0-9]+_[A-Za-z0-9]+)": prometheus\.NewDesc`) + committed := map[string]bool{} + for _, m := range re.FindAllSubmatch(src, -1) { + committed[string(m[1])] = true + } + + var n procfs.ProcNetstat + var s procfs.ProcSnmp + var s6 procfs.ProcSnmp6 + expected := map[string]bool{} + for _, v := range []any{ + n.TcpExt, n.IpExt, + s.Ip, s.Icmp, s.IcmpMsg, s.Tcp, s.Udp, s.UdpLite, + s6.Ip6, s6.Icmp6, s6.Udp6, s6.UdpLite6, + } { + tt := reflect.TypeOf(v) + for i := 0; i < tt.NumField(); i++ { + f := tt.Field(i) + if f.Type != reflect.TypeFor[*float64]() { + continue + } + expected[tt.Name()+"_"+f.Name] = true + } + } + + var missing, extra []string + for k := range expected { + if !committed[k] { + missing = append(missing, k) + } + } + for k := range committed { + if !expected[k] { + extra = append(extra, k) + } + } + sort.Strings(missing) + sort.Strings(extra) + + if len(missing) != 0 || len(extra) != 0 { + t.Fatalf("netstat_descs_linux.go is out of sync with procfs (missing=%v extra=%v); run `GOOS=linux go generate ./collector`", missing, extra) + } +} diff --git a/collector/netstat_descs_gen.go b/collector/netstat_descs_gen.go new file mode 100644 index 0000000000..3027a82aa5 --- /dev/null +++ b/collector/netstat_descs_gen.go @@ -0,0 +1,96 @@ +// Copyright The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build ignore + +// Command netstat-descs regenerates collector/netstat_descs_linux.go from the +// procfs netstat/snmp/snmp6 statistics structs. +// +// Run from the repository root: +// +// go generate ./collector +// +// The output is a table of explicit, source-visible prometheus.Desc literals +// (one per *float64 field of each statistics struct), keyed by +// "_". Keeping the descriptors as literals lets the AST-based +// documentation tooling read them and avoids allocating descriptors per scrape. +package main + +import ( + "fmt" + "os" + "reflect" + "strings" + + "github.com/prometheus/procfs" +) + +type entry struct { + key string + help string +} + +func main() { + var n procfs.ProcNetstat + var s procfs.ProcSnmp + var s6 procfs.ProcSnmp6 + + structs := []any{ + n.TcpExt, n.IpExt, + s.Ip, s.Icmp, s.IcmpMsg, s.Tcp, s.Udp, s.UdpLite, + s6.Ip6, s6.Icmp6, s6.Udp6, s6.UdpLite6, + } + + var b strings.Builder + b.WriteString(`// Code generated by netstat-descs; DO NOT EDIT. + +//go:build !nonetstat + +package collector + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// netStatMetricDescs returns the explicit, source-visible metric descriptors +// for every field of the procfs netstat/snmp/snmp6 statistics structs, keyed by +// "_". Descriptors are allocated once; collection looks them up +// by name instead of calling prometheus.NewDesc on every scrape. +func netStatMetricDescs() map[string]*prometheus.Desc { + return map[string]*prometheus.Desc{ +`) + + count := 0 + for _, v := range structs { + t := reflect.TypeOf(v) + proto := t.Name() + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + if f.Type != reflect.TypeFor[*float64]() { + continue + } + key := proto + "_" + f.Name + help := "Statistic " + proto + f.Name + "." + fmt.Fprintf(&b, "\t\t%q: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, netStatsSubsystem, %q),\n\t\t\t%q,\n\t\t\tnil, nil),\n", key, key, help) + count++ + } + } + + b.WriteString("\t}\n}\n") + + if err := os.WriteFile("netstat_descs_linux.go", []byte(b.String()), 0o644); err != nil { + fmt.Fprintln(os.Stderr, "write netstat_descs_linux.go:", err) + os.Exit(1) + } + fmt.Fprintf(os.Stderr, "wrote netstat_descs_linux.go (%d descriptors)\n", count) +} diff --git a/collector/netstat_descs_linux.go b/collector/netstat_descs_linux.go new file mode 100644 index 0000000000..1abc6ebec1 --- /dev/null +++ b/collector/netstat_descs_linux.go @@ -0,0 +1,1262 @@ +// Code generated by netstat-descs; DO NOT EDIT. + +//go:build !nonetstat + +package collector + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// netStatMetricDescs returns the explicit, source-visible metric descriptors +// for every field of the procfs netstat/snmp/snmp6 statistics structs, keyed by +// "_". Descriptors are allocated once; collection looks them up +// by name instead of calling prometheus.NewDesc on every scrape. +func netStatMetricDescs() map[string]*prometheus.Desc { + return map[string]*prometheus.Desc{ + "TcpExt_SyncookiesSent": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_SyncookiesSent"), + "Statistic TcpExtSyncookiesSent.", + nil, nil), + "TcpExt_SyncookiesRecv": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_SyncookiesRecv"), + "Statistic TcpExtSyncookiesRecv.", + nil, nil), + "TcpExt_SyncookiesFailed": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_SyncookiesFailed"), + "Statistic TcpExtSyncookiesFailed.", + nil, nil), + "TcpExt_EmbryonicRsts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_EmbryonicRsts"), + "Statistic TcpExtEmbryonicRsts.", + nil, nil), + "TcpExt_PruneCalled": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_PruneCalled"), + "Statistic TcpExtPruneCalled.", + nil, nil), + "TcpExt_RcvPruned": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_RcvPruned"), + "Statistic TcpExtRcvPruned.", + nil, nil), + "TcpExt_OfoPruned": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_OfoPruned"), + "Statistic TcpExtOfoPruned.", + nil, nil), + "TcpExt_OutOfWindowIcmps": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_OutOfWindowIcmps"), + "Statistic TcpExtOutOfWindowIcmps.", + nil, nil), + "TcpExt_LockDroppedIcmps": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_LockDroppedIcmps"), + "Statistic TcpExtLockDroppedIcmps.", + nil, nil), + "TcpExt_ArpFilter": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_ArpFilter"), + "Statistic TcpExtArpFilter.", + nil, nil), + "TcpExt_TW": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TW"), + "Statistic TcpExtTW.", + nil, nil), + "TcpExt_TWRecycled": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TWRecycled"), + "Statistic TcpExtTWRecycled.", + nil, nil), + "TcpExt_TWKilled": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TWKilled"), + "Statistic TcpExtTWKilled.", + nil, nil), + "TcpExt_PAWSActive": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_PAWSActive"), + "Statistic TcpExtPAWSActive.", + nil, nil), + "TcpExt_PAWSEstab": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_PAWSEstab"), + "Statistic TcpExtPAWSEstab.", + nil, nil), + "TcpExt_DelayedACKs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_DelayedACKs"), + "Statistic TcpExtDelayedACKs.", + nil, nil), + "TcpExt_DelayedACKLocked": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_DelayedACKLocked"), + "Statistic TcpExtDelayedACKLocked.", + nil, nil), + "TcpExt_DelayedACKLost": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_DelayedACKLost"), + "Statistic TcpExtDelayedACKLost.", + nil, nil), + "TcpExt_ListenOverflows": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_ListenOverflows"), + "Statistic TcpExtListenOverflows.", + nil, nil), + "TcpExt_ListenDrops": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_ListenDrops"), + "Statistic TcpExtListenDrops.", + nil, nil), + "TcpExt_TCPHPHits": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPHPHits"), + "Statistic TcpExtTCPHPHits.", + nil, nil), + "TcpExt_TCPPureAcks": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPPureAcks"), + "Statistic TcpExtTCPPureAcks.", + nil, nil), + "TcpExt_TCPHPAcks": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPHPAcks"), + "Statistic TcpExtTCPHPAcks.", + nil, nil), + "TcpExt_TCPRenoRecovery": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPRenoRecovery"), + "Statistic TcpExtTCPRenoRecovery.", + nil, nil), + "TcpExt_TCPSackRecovery": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPSackRecovery"), + "Statistic TcpExtTCPSackRecovery.", + nil, nil), + "TcpExt_TCPSACKReneging": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPSACKReneging"), + "Statistic TcpExtTCPSACKReneging.", + nil, nil), + "TcpExt_TCPSACKReorder": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPSACKReorder"), + "Statistic TcpExtTCPSACKReorder.", + nil, nil), + "TcpExt_TCPRenoReorder": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPRenoReorder"), + "Statistic TcpExtTCPRenoReorder.", + nil, nil), + "TcpExt_TCPTSReorder": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPTSReorder"), + "Statistic TcpExtTCPTSReorder.", + nil, nil), + "TcpExt_TCPFullUndo": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPFullUndo"), + "Statistic TcpExtTCPFullUndo.", + nil, nil), + "TcpExt_TCPPartialUndo": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPPartialUndo"), + "Statistic TcpExtTCPPartialUndo.", + nil, nil), + "TcpExt_TCPDSACKUndo": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPDSACKUndo"), + "Statistic TcpExtTCPDSACKUndo.", + nil, nil), + "TcpExt_TCPLossUndo": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPLossUndo"), + "Statistic TcpExtTCPLossUndo.", + nil, nil), + "TcpExt_TCPLostRetransmit": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPLostRetransmit"), + "Statistic TcpExtTCPLostRetransmit.", + nil, nil), + "TcpExt_TCPRenoFailures": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPRenoFailures"), + "Statistic TcpExtTCPRenoFailures.", + nil, nil), + "TcpExt_TCPSackFailures": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPSackFailures"), + "Statistic TcpExtTCPSackFailures.", + nil, nil), + "TcpExt_TCPLossFailures": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPLossFailures"), + "Statistic TcpExtTCPLossFailures.", + nil, nil), + "TcpExt_TCPFastRetrans": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPFastRetrans"), + "Statistic TcpExtTCPFastRetrans.", + nil, nil), + "TcpExt_TCPSlowStartRetrans": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPSlowStartRetrans"), + "Statistic TcpExtTCPSlowStartRetrans.", + nil, nil), + "TcpExt_TCPTimeouts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPTimeouts"), + "Statistic TcpExtTCPTimeouts.", + nil, nil), + "TcpExt_TCPLossProbes": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPLossProbes"), + "Statistic TcpExtTCPLossProbes.", + nil, nil), + "TcpExt_TCPLossProbeRecovery": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPLossProbeRecovery"), + "Statistic TcpExtTCPLossProbeRecovery.", + nil, nil), + "TcpExt_TCPRenoRecoveryFail": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPRenoRecoveryFail"), + "Statistic TcpExtTCPRenoRecoveryFail.", + nil, nil), + "TcpExt_TCPSackRecoveryFail": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPSackRecoveryFail"), + "Statistic TcpExtTCPSackRecoveryFail.", + nil, nil), + "TcpExt_TCPRcvCollapsed": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPRcvCollapsed"), + "Statistic TcpExtTCPRcvCollapsed.", + nil, nil), + "TcpExt_TCPDSACKOldSent": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPDSACKOldSent"), + "Statistic TcpExtTCPDSACKOldSent.", + nil, nil), + "TcpExt_TCPDSACKOfoSent": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPDSACKOfoSent"), + "Statistic TcpExtTCPDSACKOfoSent.", + nil, nil), + "TcpExt_TCPDSACKRecv": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPDSACKRecv"), + "Statistic TcpExtTCPDSACKRecv.", + nil, nil), + "TcpExt_TCPDSACKOfoRecv": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPDSACKOfoRecv"), + "Statistic TcpExtTCPDSACKOfoRecv.", + nil, nil), + "TcpExt_TCPAbortOnData": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPAbortOnData"), + "Statistic TcpExtTCPAbortOnData.", + nil, nil), + "TcpExt_TCPAbortOnClose": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPAbortOnClose"), + "Statistic TcpExtTCPAbortOnClose.", + nil, nil), + "TcpExt_TCPAbortOnMemory": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPAbortOnMemory"), + "Statistic TcpExtTCPAbortOnMemory.", + nil, nil), + "TcpExt_TCPAbortOnTimeout": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPAbortOnTimeout"), + "Statistic TcpExtTCPAbortOnTimeout.", + nil, nil), + "TcpExt_TCPAbortOnLinger": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPAbortOnLinger"), + "Statistic TcpExtTCPAbortOnLinger.", + nil, nil), + "TcpExt_TCPAbortFailed": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPAbortFailed"), + "Statistic TcpExtTCPAbortFailed.", + nil, nil), + "TcpExt_TCPMemoryPressures": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPMemoryPressures"), + "Statistic TcpExtTCPMemoryPressures.", + nil, nil), + "TcpExt_TCPMemoryPressuresChrono": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPMemoryPressuresChrono"), + "Statistic TcpExtTCPMemoryPressuresChrono.", + nil, nil), + "TcpExt_TCPSACKDiscard": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPSACKDiscard"), + "Statistic TcpExtTCPSACKDiscard.", + nil, nil), + "TcpExt_TCPDSACKIgnoredOld": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPDSACKIgnoredOld"), + "Statistic TcpExtTCPDSACKIgnoredOld.", + nil, nil), + "TcpExt_TCPDSACKIgnoredNoUndo": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPDSACKIgnoredNoUndo"), + "Statistic TcpExtTCPDSACKIgnoredNoUndo.", + nil, nil), + "TcpExt_TCPSpuriousRTOs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPSpuriousRTOs"), + "Statistic TcpExtTCPSpuriousRTOs.", + nil, nil), + "TcpExt_TCPMD5NotFound": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPMD5NotFound"), + "Statistic TcpExtTCPMD5NotFound.", + nil, nil), + "TcpExt_TCPMD5Unexpected": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPMD5Unexpected"), + "Statistic TcpExtTCPMD5Unexpected.", + nil, nil), + "TcpExt_TCPMD5Failure": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPMD5Failure"), + "Statistic TcpExtTCPMD5Failure.", + nil, nil), + "TcpExt_TCPSackShifted": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPSackShifted"), + "Statistic TcpExtTCPSackShifted.", + nil, nil), + "TcpExt_TCPSackMerged": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPSackMerged"), + "Statistic TcpExtTCPSackMerged.", + nil, nil), + "TcpExt_TCPSackShiftFallback": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPSackShiftFallback"), + "Statistic TcpExtTCPSackShiftFallback.", + nil, nil), + "TcpExt_TCPBacklogDrop": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPBacklogDrop"), + "Statistic TcpExtTCPBacklogDrop.", + nil, nil), + "TcpExt_PFMemallocDrop": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_PFMemallocDrop"), + "Statistic TcpExtPFMemallocDrop.", + nil, nil), + "TcpExt_TCPMinTTLDrop": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPMinTTLDrop"), + "Statistic TcpExtTCPMinTTLDrop.", + nil, nil), + "TcpExt_TCPDeferAcceptDrop": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPDeferAcceptDrop"), + "Statistic TcpExtTCPDeferAcceptDrop.", + nil, nil), + "TcpExt_IPReversePathFilter": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_IPReversePathFilter"), + "Statistic TcpExtIPReversePathFilter.", + nil, nil), + "TcpExt_TCPTimeWaitOverflow": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPTimeWaitOverflow"), + "Statistic TcpExtTCPTimeWaitOverflow.", + nil, nil), + "TcpExt_TCPReqQFullDoCookies": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPReqQFullDoCookies"), + "Statistic TcpExtTCPReqQFullDoCookies.", + nil, nil), + "TcpExt_TCPReqQFullDrop": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPReqQFullDrop"), + "Statistic TcpExtTCPReqQFullDrop.", + nil, nil), + "TcpExt_TCPRetransFail": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPRetransFail"), + "Statistic TcpExtTCPRetransFail.", + nil, nil), + "TcpExt_TCPRcvCoalesce": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPRcvCoalesce"), + "Statistic TcpExtTCPRcvCoalesce.", + nil, nil), + "TcpExt_TCPRcvQDrop": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPRcvQDrop"), + "Statistic TcpExtTCPRcvQDrop.", + nil, nil), + "TcpExt_TCPOFOQueue": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPOFOQueue"), + "Statistic TcpExtTCPOFOQueue.", + nil, nil), + "TcpExt_TCPOFODrop": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPOFODrop"), + "Statistic TcpExtTCPOFODrop.", + nil, nil), + "TcpExt_TCPOFOMerge": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPOFOMerge"), + "Statistic TcpExtTCPOFOMerge.", + nil, nil), + "TcpExt_TCPChallengeACK": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPChallengeACK"), + "Statistic TcpExtTCPChallengeACK.", + nil, nil), + "TcpExt_TCPSYNChallenge": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPSYNChallenge"), + "Statistic TcpExtTCPSYNChallenge.", + nil, nil), + "TcpExt_TCPFastOpenActive": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPFastOpenActive"), + "Statistic TcpExtTCPFastOpenActive.", + nil, nil), + "TcpExt_TCPFastOpenActiveFail": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPFastOpenActiveFail"), + "Statistic TcpExtTCPFastOpenActiveFail.", + nil, nil), + "TcpExt_TCPFastOpenPassive": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPFastOpenPassive"), + "Statistic TcpExtTCPFastOpenPassive.", + nil, nil), + "TcpExt_TCPFastOpenPassiveFail": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPFastOpenPassiveFail"), + "Statistic TcpExtTCPFastOpenPassiveFail.", + nil, nil), + "TcpExt_TCPFastOpenListenOverflow": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPFastOpenListenOverflow"), + "Statistic TcpExtTCPFastOpenListenOverflow.", + nil, nil), + "TcpExt_TCPFastOpenCookieReqd": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPFastOpenCookieReqd"), + "Statistic TcpExtTCPFastOpenCookieReqd.", + nil, nil), + "TcpExt_TCPFastOpenBlackhole": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPFastOpenBlackhole"), + "Statistic TcpExtTCPFastOpenBlackhole.", + nil, nil), + "TcpExt_TCPSpuriousRtxHostQueues": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPSpuriousRtxHostQueues"), + "Statistic TcpExtTCPSpuriousRtxHostQueues.", + nil, nil), + "TcpExt_BusyPollRxPackets": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_BusyPollRxPackets"), + "Statistic TcpExtBusyPollRxPackets.", + nil, nil), + "TcpExt_TCPAutoCorking": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPAutoCorking"), + "Statistic TcpExtTCPAutoCorking.", + nil, nil), + "TcpExt_TCPFromZeroWindowAdv": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPFromZeroWindowAdv"), + "Statistic TcpExtTCPFromZeroWindowAdv.", + nil, nil), + "TcpExt_TCPToZeroWindowAdv": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPToZeroWindowAdv"), + "Statistic TcpExtTCPToZeroWindowAdv.", + nil, nil), + "TcpExt_TCPWantZeroWindowAdv": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPWantZeroWindowAdv"), + "Statistic TcpExtTCPWantZeroWindowAdv.", + nil, nil), + "TcpExt_TCPSynRetrans": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPSynRetrans"), + "Statistic TcpExtTCPSynRetrans.", + nil, nil), + "TcpExt_TCPOrigDataSent": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPOrigDataSent"), + "Statistic TcpExtTCPOrigDataSent.", + nil, nil), + "TcpExt_TCPHystartTrainDetect": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPHystartTrainDetect"), + "Statistic TcpExtTCPHystartTrainDetect.", + nil, nil), + "TcpExt_TCPHystartTrainCwnd": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPHystartTrainCwnd"), + "Statistic TcpExtTCPHystartTrainCwnd.", + nil, nil), + "TcpExt_TCPHystartDelayDetect": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPHystartDelayDetect"), + "Statistic TcpExtTCPHystartDelayDetect.", + nil, nil), + "TcpExt_TCPHystartDelayCwnd": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPHystartDelayCwnd"), + "Statistic TcpExtTCPHystartDelayCwnd.", + nil, nil), + "TcpExt_TCPACKSkippedSynRecv": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPACKSkippedSynRecv"), + "Statistic TcpExtTCPACKSkippedSynRecv.", + nil, nil), + "TcpExt_TCPACKSkippedPAWS": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPACKSkippedPAWS"), + "Statistic TcpExtTCPACKSkippedPAWS.", + nil, nil), + "TcpExt_TCPACKSkippedSeq": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPACKSkippedSeq"), + "Statistic TcpExtTCPACKSkippedSeq.", + nil, nil), + "TcpExt_TCPACKSkippedFinWait2": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPACKSkippedFinWait2"), + "Statistic TcpExtTCPACKSkippedFinWait2.", + nil, nil), + "TcpExt_TCPACKSkippedTimeWait": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPACKSkippedTimeWait"), + "Statistic TcpExtTCPACKSkippedTimeWait.", + nil, nil), + "TcpExt_TCPACKSkippedChallenge": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPACKSkippedChallenge"), + "Statistic TcpExtTCPACKSkippedChallenge.", + nil, nil), + "TcpExt_TCPWinProbe": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPWinProbe"), + "Statistic TcpExtTCPWinProbe.", + nil, nil), + "TcpExt_TCPKeepAlive": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPKeepAlive"), + "Statistic TcpExtTCPKeepAlive.", + nil, nil), + "TcpExt_TCPMTUPFail": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPMTUPFail"), + "Statistic TcpExtTCPMTUPFail.", + nil, nil), + "TcpExt_TCPMTUPSuccess": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPMTUPSuccess"), + "Statistic TcpExtTCPMTUPSuccess.", + nil, nil), + "TcpExt_TCPWqueueTooBig": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPWqueueTooBig"), + "Statistic TcpExtTCPWqueueTooBig.", + nil, nil), + "TcpExt_TCPLoss": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPLoss"), + "Statistic TcpExtTCPLoss.", + nil, nil), + "TcpExt_PAWSPassive": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_PAWSPassive"), + "Statistic TcpExtPAWSPassive.", + nil, nil), + "TcpExt_TCPForwardRetrans": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPForwardRetrans"), + "Statistic TcpExtTCPForwardRetrans.", + nil, nil), + "TcpExt_TCPSchedulerFailed": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPSchedulerFailed"), + "Statistic TcpExtTCPSchedulerFailed.", + nil, nil), + "TcpExt_TCPPrequeued": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPPrequeued"), + "Statistic TcpExtTCPPrequeued.", + nil, nil), + "TcpExt_TCPDirectCopyFromBacklog": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPDirectCopyFromBacklog"), + "Statistic TcpExtTCPDirectCopyFromBacklog.", + nil, nil), + "TcpExt_TCPDirectCopyFromPrequeue": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPDirectCopyFromPrequeue"), + "Statistic TcpExtTCPDirectCopyFromPrequeue.", + nil, nil), + "TcpExt_TCPPrequeueDropped": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPPrequeueDropped"), + "Statistic TcpExtTCPPrequeueDropped.", + nil, nil), + "TcpExt_TCPFACKReorder": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPFACKReorder"), + "Statistic TcpExtTCPFACKReorder.", + nil, nil), + "TcpExt_TCPHPHitsToUser": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "TcpExt_TCPHPHitsToUser"), + "Statistic TcpExtTCPHPHitsToUser.", + nil, nil), + "IpExt_InNoRoutes": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_InNoRoutes"), + "Statistic IpExtInNoRoutes.", + nil, nil), + "IpExt_InTruncatedPkts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_InTruncatedPkts"), + "Statistic IpExtInTruncatedPkts.", + nil, nil), + "IpExt_InMcastPkts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_InMcastPkts"), + "Statistic IpExtInMcastPkts.", + nil, nil), + "IpExt_OutMcastPkts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_OutMcastPkts"), + "Statistic IpExtOutMcastPkts.", + nil, nil), + "IpExt_InBcastPkts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_InBcastPkts"), + "Statistic IpExtInBcastPkts.", + nil, nil), + "IpExt_OutBcastPkts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_OutBcastPkts"), + "Statistic IpExtOutBcastPkts.", + nil, nil), + "IpExt_InOctets": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_InOctets"), + "Statistic IpExtInOctets.", + nil, nil), + "IpExt_OutOctets": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_OutOctets"), + "Statistic IpExtOutOctets.", + nil, nil), + "IpExt_InMcastOctets": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_InMcastOctets"), + "Statistic IpExtInMcastOctets.", + nil, nil), + "IpExt_OutMcastOctets": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_OutMcastOctets"), + "Statistic IpExtOutMcastOctets.", + nil, nil), + "IpExt_InBcastOctets": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_InBcastOctets"), + "Statistic IpExtInBcastOctets.", + nil, nil), + "IpExt_OutBcastOctets": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_OutBcastOctets"), + "Statistic IpExtOutBcastOctets.", + nil, nil), + "IpExt_InCsumErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_InCsumErrors"), + "Statistic IpExtInCsumErrors.", + nil, nil), + "IpExt_InNoECTPkts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_InNoECTPkts"), + "Statistic IpExtInNoECTPkts.", + nil, nil), + "IpExt_InECT1Pkts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_InECT1Pkts"), + "Statistic IpExtInECT1Pkts.", + nil, nil), + "IpExt_InECT0Pkts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_InECT0Pkts"), + "Statistic IpExtInECT0Pkts.", + nil, nil), + "IpExt_InCEPkts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_InCEPkts"), + "Statistic IpExtInCEPkts.", + nil, nil), + "IpExt_ReasmOverlaps": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IpExt_ReasmOverlaps"), + "Statistic IpExtReasmOverlaps.", + nil, nil), + "Ip_Forwarding": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_Forwarding"), + "Statistic IpForwarding.", + nil, nil), + "Ip_DefaultTTL": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_DefaultTTL"), + "Statistic IpDefaultTTL.", + nil, nil), + "Ip_InReceives": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_InReceives"), + "Statistic IpInReceives.", + nil, nil), + "Ip_InHdrErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_InHdrErrors"), + "Statistic IpInHdrErrors.", + nil, nil), + "Ip_InAddrErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_InAddrErrors"), + "Statistic IpInAddrErrors.", + nil, nil), + "Ip_ForwDatagrams": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_ForwDatagrams"), + "Statistic IpForwDatagrams.", + nil, nil), + "Ip_InUnknownProtos": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_InUnknownProtos"), + "Statistic IpInUnknownProtos.", + nil, nil), + "Ip_InDiscards": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_InDiscards"), + "Statistic IpInDiscards.", + nil, nil), + "Ip_InDelivers": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_InDelivers"), + "Statistic IpInDelivers.", + nil, nil), + "Ip_OutRequests": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_OutRequests"), + "Statistic IpOutRequests.", + nil, nil), + "Ip_OutDiscards": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_OutDiscards"), + "Statistic IpOutDiscards.", + nil, nil), + "Ip_OutNoRoutes": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_OutNoRoutes"), + "Statistic IpOutNoRoutes.", + nil, nil), + "Ip_ReasmTimeout": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_ReasmTimeout"), + "Statistic IpReasmTimeout.", + nil, nil), + "Ip_ReasmReqds": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_ReasmReqds"), + "Statistic IpReasmReqds.", + nil, nil), + "Ip_ReasmOKs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_ReasmOKs"), + "Statistic IpReasmOKs.", + nil, nil), + "Ip_ReasmFails": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_ReasmFails"), + "Statistic IpReasmFails.", + nil, nil), + "Ip_FragOKs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_FragOKs"), + "Statistic IpFragOKs.", + nil, nil), + "Ip_FragFails": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_FragFails"), + "Statistic IpFragFails.", + nil, nil), + "Ip_FragCreates": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip_FragCreates"), + "Statistic IpFragCreates.", + nil, nil), + "Icmp_InMsgs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_InMsgs"), + "Statistic IcmpInMsgs.", + nil, nil), + "Icmp_InErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_InErrors"), + "Statistic IcmpInErrors.", + nil, nil), + "Icmp_InCsumErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_InCsumErrors"), + "Statistic IcmpInCsumErrors.", + nil, nil), + "Icmp_InDestUnreachs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_InDestUnreachs"), + "Statistic IcmpInDestUnreachs.", + nil, nil), + "Icmp_InTimeExcds": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_InTimeExcds"), + "Statistic IcmpInTimeExcds.", + nil, nil), + "Icmp_InParmProbs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_InParmProbs"), + "Statistic IcmpInParmProbs.", + nil, nil), + "Icmp_InSrcQuenchs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_InSrcQuenchs"), + "Statistic IcmpInSrcQuenchs.", + nil, nil), + "Icmp_InRedirects": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_InRedirects"), + "Statistic IcmpInRedirects.", + nil, nil), + "Icmp_InEchos": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_InEchos"), + "Statistic IcmpInEchos.", + nil, nil), + "Icmp_InEchoReps": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_InEchoReps"), + "Statistic IcmpInEchoReps.", + nil, nil), + "Icmp_InTimestamps": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_InTimestamps"), + "Statistic IcmpInTimestamps.", + nil, nil), + "Icmp_InTimestampReps": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_InTimestampReps"), + "Statistic IcmpInTimestampReps.", + nil, nil), + "Icmp_InAddrMasks": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_InAddrMasks"), + "Statistic IcmpInAddrMasks.", + nil, nil), + "Icmp_InAddrMaskReps": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_InAddrMaskReps"), + "Statistic IcmpInAddrMaskReps.", + nil, nil), + "Icmp_OutMsgs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_OutMsgs"), + "Statistic IcmpOutMsgs.", + nil, nil), + "Icmp_OutErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_OutErrors"), + "Statistic IcmpOutErrors.", + nil, nil), + "Icmp_OutDestUnreachs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_OutDestUnreachs"), + "Statistic IcmpOutDestUnreachs.", + nil, nil), + "Icmp_OutTimeExcds": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_OutTimeExcds"), + "Statistic IcmpOutTimeExcds.", + nil, nil), + "Icmp_OutParmProbs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_OutParmProbs"), + "Statistic IcmpOutParmProbs.", + nil, nil), + "Icmp_OutSrcQuenchs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_OutSrcQuenchs"), + "Statistic IcmpOutSrcQuenchs.", + nil, nil), + "Icmp_OutRedirects": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_OutRedirects"), + "Statistic IcmpOutRedirects.", + nil, nil), + "Icmp_OutEchos": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_OutEchos"), + "Statistic IcmpOutEchos.", + nil, nil), + "Icmp_OutEchoReps": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_OutEchoReps"), + "Statistic IcmpOutEchoReps.", + nil, nil), + "Icmp_OutTimestamps": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_OutTimestamps"), + "Statistic IcmpOutTimestamps.", + nil, nil), + "Icmp_OutTimestampReps": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_OutTimestampReps"), + "Statistic IcmpOutTimestampReps.", + nil, nil), + "Icmp_OutAddrMasks": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_OutAddrMasks"), + "Statistic IcmpOutAddrMasks.", + nil, nil), + "Icmp_OutAddrMaskReps": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp_OutAddrMaskReps"), + "Statistic IcmpOutAddrMaskReps.", + nil, nil), + "IcmpMsg_InType3": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IcmpMsg_InType3"), + "Statistic IcmpMsgInType3.", + nil, nil), + "IcmpMsg_OutType3": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "IcmpMsg_OutType3"), + "Statistic IcmpMsgOutType3.", + nil, nil), + "Tcp_RtoAlgorithm": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Tcp_RtoAlgorithm"), + "Statistic TcpRtoAlgorithm.", + nil, nil), + "Tcp_RtoMin": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Tcp_RtoMin"), + "Statistic TcpRtoMin.", + nil, nil), + "Tcp_RtoMax": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Tcp_RtoMax"), + "Statistic TcpRtoMax.", + nil, nil), + "Tcp_MaxConn": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Tcp_MaxConn"), + "Statistic TcpMaxConn.", + nil, nil), + "Tcp_ActiveOpens": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Tcp_ActiveOpens"), + "Statistic TcpActiveOpens.", + nil, nil), + "Tcp_PassiveOpens": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Tcp_PassiveOpens"), + "Statistic TcpPassiveOpens.", + nil, nil), + "Tcp_AttemptFails": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Tcp_AttemptFails"), + "Statistic TcpAttemptFails.", + nil, nil), + "Tcp_EstabResets": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Tcp_EstabResets"), + "Statistic TcpEstabResets.", + nil, nil), + "Tcp_CurrEstab": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Tcp_CurrEstab"), + "Statistic TcpCurrEstab.", + nil, nil), + "Tcp_InSegs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Tcp_InSegs"), + "Statistic TcpInSegs.", + nil, nil), + "Tcp_OutSegs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Tcp_OutSegs"), + "Statistic TcpOutSegs.", + nil, nil), + "Tcp_RetransSegs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Tcp_RetransSegs"), + "Statistic TcpRetransSegs.", + nil, nil), + "Tcp_InErrs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Tcp_InErrs"), + "Statistic TcpInErrs.", + nil, nil), + "Tcp_OutRsts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Tcp_OutRsts"), + "Statistic TcpOutRsts.", + nil, nil), + "Tcp_InCsumErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Tcp_InCsumErrors"), + "Statistic TcpInCsumErrors.", + nil, nil), + "Udp_InDatagrams": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Udp_InDatagrams"), + "Statistic UdpInDatagrams.", + nil, nil), + "Udp_NoPorts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Udp_NoPorts"), + "Statistic UdpNoPorts.", + nil, nil), + "Udp_InErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Udp_InErrors"), + "Statistic UdpInErrors.", + nil, nil), + "Udp_OutDatagrams": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Udp_OutDatagrams"), + "Statistic UdpOutDatagrams.", + nil, nil), + "Udp_RcvbufErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Udp_RcvbufErrors"), + "Statistic UdpRcvbufErrors.", + nil, nil), + "Udp_SndbufErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Udp_SndbufErrors"), + "Statistic UdpSndbufErrors.", + nil, nil), + "Udp_InCsumErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Udp_InCsumErrors"), + "Statistic UdpInCsumErrors.", + nil, nil), + "Udp_IgnoredMulti": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Udp_IgnoredMulti"), + "Statistic UdpIgnoredMulti.", + nil, nil), + "UdpLite_InDatagrams": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "UdpLite_InDatagrams"), + "Statistic UdpLiteInDatagrams.", + nil, nil), + "UdpLite_NoPorts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "UdpLite_NoPorts"), + "Statistic UdpLiteNoPorts.", + nil, nil), + "UdpLite_InErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "UdpLite_InErrors"), + "Statistic UdpLiteInErrors.", + nil, nil), + "UdpLite_OutDatagrams": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "UdpLite_OutDatagrams"), + "Statistic UdpLiteOutDatagrams.", + nil, nil), + "UdpLite_RcvbufErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "UdpLite_RcvbufErrors"), + "Statistic UdpLiteRcvbufErrors.", + nil, nil), + "UdpLite_SndbufErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "UdpLite_SndbufErrors"), + "Statistic UdpLiteSndbufErrors.", + nil, nil), + "UdpLite_InCsumErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "UdpLite_InCsumErrors"), + "Statistic UdpLiteInCsumErrors.", + nil, nil), + "UdpLite_IgnoredMulti": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "UdpLite_IgnoredMulti"), + "Statistic UdpLiteIgnoredMulti.", + nil, nil), + "Ip6_InReceives": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InReceives"), + "Statistic Ip6InReceives.", + nil, nil), + "Ip6_InHdrErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InHdrErrors"), + "Statistic Ip6InHdrErrors.", + nil, nil), + "Ip6_InTooBigErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InTooBigErrors"), + "Statistic Ip6InTooBigErrors.", + nil, nil), + "Ip6_InNoRoutes": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InNoRoutes"), + "Statistic Ip6InNoRoutes.", + nil, nil), + "Ip6_InAddrErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InAddrErrors"), + "Statistic Ip6InAddrErrors.", + nil, nil), + "Ip6_InUnknownProtos": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InUnknownProtos"), + "Statistic Ip6InUnknownProtos.", + nil, nil), + "Ip6_InTruncatedPkts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InTruncatedPkts"), + "Statistic Ip6InTruncatedPkts.", + nil, nil), + "Ip6_InDiscards": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InDiscards"), + "Statistic Ip6InDiscards.", + nil, nil), + "Ip6_InDelivers": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InDelivers"), + "Statistic Ip6InDelivers.", + nil, nil), + "Ip6_OutForwDatagrams": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_OutForwDatagrams"), + "Statistic Ip6OutForwDatagrams.", + nil, nil), + "Ip6_OutRequests": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_OutRequests"), + "Statistic Ip6OutRequests.", + nil, nil), + "Ip6_OutDiscards": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_OutDiscards"), + "Statistic Ip6OutDiscards.", + nil, nil), + "Ip6_OutNoRoutes": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_OutNoRoutes"), + "Statistic Ip6OutNoRoutes.", + nil, nil), + "Ip6_ReasmTimeout": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_ReasmTimeout"), + "Statistic Ip6ReasmTimeout.", + nil, nil), + "Ip6_ReasmReqds": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_ReasmReqds"), + "Statistic Ip6ReasmReqds.", + nil, nil), + "Ip6_ReasmOKs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_ReasmOKs"), + "Statistic Ip6ReasmOKs.", + nil, nil), + "Ip6_ReasmFails": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_ReasmFails"), + "Statistic Ip6ReasmFails.", + nil, nil), + "Ip6_FragOKs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_FragOKs"), + "Statistic Ip6FragOKs.", + nil, nil), + "Ip6_FragFails": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_FragFails"), + "Statistic Ip6FragFails.", + nil, nil), + "Ip6_FragCreates": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_FragCreates"), + "Statistic Ip6FragCreates.", + nil, nil), + "Ip6_InMcastPkts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InMcastPkts"), + "Statistic Ip6InMcastPkts.", + nil, nil), + "Ip6_OutMcastPkts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_OutMcastPkts"), + "Statistic Ip6OutMcastPkts.", + nil, nil), + "Ip6_InOctets": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InOctets"), + "Statistic Ip6InOctets.", + nil, nil), + "Ip6_OutOctets": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_OutOctets"), + "Statistic Ip6OutOctets.", + nil, nil), + "Ip6_InMcastOctets": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InMcastOctets"), + "Statistic Ip6InMcastOctets.", + nil, nil), + "Ip6_OutMcastOctets": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_OutMcastOctets"), + "Statistic Ip6OutMcastOctets.", + nil, nil), + "Ip6_InBcastOctets": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InBcastOctets"), + "Statistic Ip6InBcastOctets.", + nil, nil), + "Ip6_OutBcastOctets": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_OutBcastOctets"), + "Statistic Ip6OutBcastOctets.", + nil, nil), + "Ip6_InNoECTPkts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InNoECTPkts"), + "Statistic Ip6InNoECTPkts.", + nil, nil), + "Ip6_InECT1Pkts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InECT1Pkts"), + "Statistic Ip6InECT1Pkts.", + nil, nil), + "Ip6_InECT0Pkts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InECT0Pkts"), + "Statistic Ip6InECT0Pkts.", + nil, nil), + "Ip6_InCEPkts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Ip6_InCEPkts"), + "Statistic Ip6InCEPkts.", + nil, nil), + "Icmp6_InMsgs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InMsgs"), + "Statistic Icmp6InMsgs.", + nil, nil), + "Icmp6_InErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InErrors"), + "Statistic Icmp6InErrors.", + nil, nil), + "Icmp6_OutMsgs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutMsgs"), + "Statistic Icmp6OutMsgs.", + nil, nil), + "Icmp6_OutErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutErrors"), + "Statistic Icmp6OutErrors.", + nil, nil), + "Icmp6_InCsumErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InCsumErrors"), + "Statistic Icmp6InCsumErrors.", + nil, nil), + "Icmp6_InDestUnreachs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InDestUnreachs"), + "Statistic Icmp6InDestUnreachs.", + nil, nil), + "Icmp6_InPktTooBigs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InPktTooBigs"), + "Statistic Icmp6InPktTooBigs.", + nil, nil), + "Icmp6_InTimeExcds": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InTimeExcds"), + "Statistic Icmp6InTimeExcds.", + nil, nil), + "Icmp6_InParmProblems": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InParmProblems"), + "Statistic Icmp6InParmProblems.", + nil, nil), + "Icmp6_InEchos": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InEchos"), + "Statistic Icmp6InEchos.", + nil, nil), + "Icmp6_InEchoReplies": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InEchoReplies"), + "Statistic Icmp6InEchoReplies.", + nil, nil), + "Icmp6_InGroupMembQueries": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InGroupMembQueries"), + "Statistic Icmp6InGroupMembQueries.", + nil, nil), + "Icmp6_InGroupMembResponses": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InGroupMembResponses"), + "Statistic Icmp6InGroupMembResponses.", + nil, nil), + "Icmp6_InGroupMembReductions": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InGroupMembReductions"), + "Statistic Icmp6InGroupMembReductions.", + nil, nil), + "Icmp6_InRouterSolicits": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InRouterSolicits"), + "Statistic Icmp6InRouterSolicits.", + nil, nil), + "Icmp6_InRouterAdvertisements": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InRouterAdvertisements"), + "Statistic Icmp6InRouterAdvertisements.", + nil, nil), + "Icmp6_InNeighborSolicits": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InNeighborSolicits"), + "Statistic Icmp6InNeighborSolicits.", + nil, nil), + "Icmp6_InNeighborAdvertisements": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InNeighborAdvertisements"), + "Statistic Icmp6InNeighborAdvertisements.", + nil, nil), + "Icmp6_InRedirects": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InRedirects"), + "Statistic Icmp6InRedirects.", + nil, nil), + "Icmp6_InMLDv2Reports": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InMLDv2Reports"), + "Statistic Icmp6InMLDv2Reports.", + nil, nil), + "Icmp6_OutDestUnreachs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutDestUnreachs"), + "Statistic Icmp6OutDestUnreachs.", + nil, nil), + "Icmp6_OutPktTooBigs": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutPktTooBigs"), + "Statistic Icmp6OutPktTooBigs.", + nil, nil), + "Icmp6_OutTimeExcds": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutTimeExcds"), + "Statistic Icmp6OutTimeExcds.", + nil, nil), + "Icmp6_OutParmProblems": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutParmProblems"), + "Statistic Icmp6OutParmProblems.", + nil, nil), + "Icmp6_OutEchos": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutEchos"), + "Statistic Icmp6OutEchos.", + nil, nil), + "Icmp6_OutEchoReplies": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutEchoReplies"), + "Statistic Icmp6OutEchoReplies.", + nil, nil), + "Icmp6_OutGroupMembQueries": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutGroupMembQueries"), + "Statistic Icmp6OutGroupMembQueries.", + nil, nil), + "Icmp6_OutGroupMembResponses": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutGroupMembResponses"), + "Statistic Icmp6OutGroupMembResponses.", + nil, nil), + "Icmp6_OutGroupMembReductions": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutGroupMembReductions"), + "Statistic Icmp6OutGroupMembReductions.", + nil, nil), + "Icmp6_OutRouterSolicits": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutRouterSolicits"), + "Statistic Icmp6OutRouterSolicits.", + nil, nil), + "Icmp6_OutRouterAdvertisements": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutRouterAdvertisements"), + "Statistic Icmp6OutRouterAdvertisements.", + nil, nil), + "Icmp6_OutNeighborSolicits": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutNeighborSolicits"), + "Statistic Icmp6OutNeighborSolicits.", + nil, nil), + "Icmp6_OutNeighborAdvertisements": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutNeighborAdvertisements"), + "Statistic Icmp6OutNeighborAdvertisements.", + nil, nil), + "Icmp6_OutRedirects": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutRedirects"), + "Statistic Icmp6OutRedirects.", + nil, nil), + "Icmp6_OutMLDv2Reports": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutMLDv2Reports"), + "Statistic Icmp6OutMLDv2Reports.", + nil, nil), + "Icmp6_InType1": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InType1"), + "Statistic Icmp6InType1.", + nil, nil), + "Icmp6_InType134": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InType134"), + "Statistic Icmp6InType134.", + nil, nil), + "Icmp6_InType135": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InType135"), + "Statistic Icmp6InType135.", + nil, nil), + "Icmp6_InType136": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InType136"), + "Statistic Icmp6InType136.", + nil, nil), + "Icmp6_InType143": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_InType143"), + "Statistic Icmp6InType143.", + nil, nil), + "Icmp6_OutType133": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutType133"), + "Statistic Icmp6OutType133.", + nil, nil), + "Icmp6_OutType135": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutType135"), + "Statistic Icmp6OutType135.", + nil, nil), + "Icmp6_OutType136": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutType136"), + "Statistic Icmp6OutType136.", + nil, nil), + "Icmp6_OutType143": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Icmp6_OutType143"), + "Statistic Icmp6OutType143.", + nil, nil), + "Udp6_InDatagrams": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Udp6_InDatagrams"), + "Statistic Udp6InDatagrams.", + nil, nil), + "Udp6_NoPorts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Udp6_NoPorts"), + "Statistic Udp6NoPorts.", + nil, nil), + "Udp6_InErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Udp6_InErrors"), + "Statistic Udp6InErrors.", + nil, nil), + "Udp6_OutDatagrams": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Udp6_OutDatagrams"), + "Statistic Udp6OutDatagrams.", + nil, nil), + "Udp6_RcvbufErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Udp6_RcvbufErrors"), + "Statistic Udp6RcvbufErrors.", + nil, nil), + "Udp6_SndbufErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Udp6_SndbufErrors"), + "Statistic Udp6SndbufErrors.", + nil, nil), + "Udp6_InCsumErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Udp6_InCsumErrors"), + "Statistic Udp6InCsumErrors.", + nil, nil), + "Udp6_IgnoredMulti": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "Udp6_IgnoredMulti"), + "Statistic Udp6IgnoredMulti.", + nil, nil), + "UdpLite6_InDatagrams": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "UdpLite6_InDatagrams"), + "Statistic UdpLite6InDatagrams.", + nil, nil), + "UdpLite6_NoPorts": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "UdpLite6_NoPorts"), + "Statistic UdpLite6NoPorts.", + nil, nil), + "UdpLite6_InErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "UdpLite6_InErrors"), + "Statistic UdpLite6InErrors.", + nil, nil), + "UdpLite6_OutDatagrams": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "UdpLite6_OutDatagrams"), + "Statistic UdpLite6OutDatagrams.", + nil, nil), + "UdpLite6_RcvbufErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "UdpLite6_RcvbufErrors"), + "Statistic UdpLite6RcvbufErrors.", + nil, nil), + "UdpLite6_SndbufErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "UdpLite6_SndbufErrors"), + "Statistic UdpLite6SndbufErrors.", + nil, nil), + "UdpLite6_InCsumErrors": prometheus.NewDesc( + prometheus.BuildFQName(namespace, netStatsSubsystem, "UdpLite6_InCsumErrors"), + "Statistic UdpLite6InCsumErrors.", + nil, nil), + } +} diff --git a/collector/netstat_linux.go b/collector/netstat_linux.go index 5065a19af3..07713895da 100644 --- a/collector/netstat_linux.go +++ b/collector/netstat_linux.go @@ -13,22 +13,20 @@ //go:build !nonetstat +// Regenerate the explicit descriptor table after a procfs upgrade: +//go:generate go run netstat_descs_gen.go + package collector import ( - "bufio" - "errors" "fmt" - "io" "log/slog" - "maps" - "os" + "reflect" "regexp" - "strconv" - "strings" "github.com/alecthomas/kingpin/v2" "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/procfs" ) const ( @@ -37,9 +35,15 @@ const ( var ( netStatFields = kingpin.Flag("collector.netstat.fields", "Regexp of fields to return for netstat collector.").Default("^(.*_(InErrors|InErrs)|Ip_Forwarding|Ip(6|Ext)_(InOctets|OutOctets)|Icmp6?_(InMsgs|OutMsgs)|TcpExt_(Listen.*|Syncookies.*|TCPSynRetrans|TCPTimeouts|TCPOFOQueue|TCPRcvQDrop)|Tcp_(ActiveOpens|InSegs|OutSegs|OutRsts|PassiveOpens|RetransSegs|CurrEstab)|Udp6?_(InDatagrams|OutDatagrams|NoPorts|RcvbufErrors|SndbufErrors))$").String() + + // netStatDescs holds the explicit metric descriptors, allocated once at + // package init (see netstat_descs_linux.go) so collection never calls + // prometheus.NewDesc per scrape. + netStatDescs = netStatMetricDescs() ) type netStatCollector struct { + proc procfs.Proc fieldPattern *regexp.Regexp logger *slog.Logger } @@ -52,124 +56,79 @@ func init() { // a new Collector exposing network stats. func NewNetStatCollector(logger *slog.Logger) (Collector, error) { pattern := regexp.MustCompile(*netStatFields) + fs, err := procfs.NewFS(*procPath) + if err != nil { + return nil, fmt.Errorf("failed to open procfs: %w", err) + } + + // Network statistics in /proc/net are network namespace local. Reading + // them via the current process' /proc/self/net keeps the same semantics + // while allowing the use of the procfs parsers. + proc, err := fs.Self() + if err != nil { + return nil, fmt.Errorf("failed to open /proc/self: %w", err) + } + return &netStatCollector{ + proc: proc, fieldPattern: pattern, logger: logger, }, nil } func (c *netStatCollector) Update(ch chan<- prometheus.Metric) error { - netStats, err := getNetStats(procFilePath("net/netstat")) + netStats, err := c.proc.Netstat() if err != nil { return fmt.Errorf("couldn't get netstats: %w", err) } - snmpStats, err := getNetStats(procFilePath("net/snmp")) + snmpStats, err := c.proc.Snmp() if err != nil { return fmt.Errorf("couldn't get SNMP stats: %w", err) } - snmp6Stats, err := getSNMP6Stats(procFilePath("net/snmp6")) + snmp6Stats, err := c.proc.Snmp6() if err != nil { return fmt.Errorf("couldn't get SNMP6 stats: %w", err) } - // Merge the results of snmpStats into netStats (collisions are possible, but - // we know that the keys are always unique for the given use case). - maps.Copy(netStats, snmpStats) - maps.Copy(netStats, snmp6Stats) - for protocol, protocolStats := range netStats { - for name, value := range protocolStats { - key := protocol + "_" + name - v, err := strconv.ParseFloat(value, 64) - if err != nil { - return fmt.Errorf("invalid value %s in netstats: %w", value, err) - } - if !c.fieldPattern.MatchString(key) { - continue - } - ch <- prometheus.MustNewConstMetric( - prometheus.NewDesc( - prometheus.BuildFQName(namespace, netStatsSubsystem, key), - fmt.Sprintf("Statistic %s.", protocol+name), - nil, nil, - ), - prometheus.UntypedValue, v, - ) - } - } - return nil -} -func getNetStats(fileName string) (map[string]map[string]string, error) { - file, err := os.Open(fileName) - if err != nil { - return nil, err - } - defer file.Close() + c.emitStruct(ch, netStats.TcpExt) + c.emitStruct(ch, netStats.IpExt) + c.emitStruct(ch, snmpStats.Ip) + c.emitStruct(ch, snmpStats.Icmp) + c.emitStruct(ch, snmpStats.IcmpMsg) + c.emitStruct(ch, snmpStats.Tcp) + c.emitStruct(ch, snmpStats.Udp) + c.emitStruct(ch, snmpStats.UdpLite) + c.emitStruct(ch, snmp6Stats.Ip6) + c.emitStruct(ch, snmp6Stats.Icmp6) + c.emitStruct(ch, snmp6Stats.Udp6) + c.emitStruct(ch, snmp6Stats.UdpLite6) - return parseNetStats(file, fileName) + return nil } -func parseNetStats(r io.Reader, fileName string) (map[string]map[string]string, error) { - var ( - netStats = map[string]map[string]string{} - scanner = bufio.NewScanner(r) - ) - - for scanner.Scan() { - nameParts := strings.Split(scanner.Text(), " ") - scanner.Scan() - valueParts := strings.Split(scanner.Text(), " ") - // Remove trailing :. - protocol := nameParts[0][:len(nameParts[0])-1] - netStats[protocol] = map[string]string{} - if len(nameParts) != len(valueParts) { - return nil, fmt.Errorf("mismatch field count mismatch in %s: %s", - fileName, protocol) - } - for i := 1; i < len(nameParts); i++ { - netStats[protocol][nameParts[i]] = valueParts[i] - } - } - - return netStats, scanner.Err() -} +// emitStruct emits one metric per non-nil field of a procfs netstat/snmp +// statistics struct, using the struct's type name as the protocol name and +// looking up the pre-built descriptor by "_". +func (c *netStatCollector) emitStruct(ch chan<- prometheus.Metric, stats any) { + v := reflect.ValueOf(stats) + protocol := v.Type().Name() -func getSNMP6Stats(fileName string) (map[string]map[string]string, error) { - file, err := os.Open(fileName) - if err != nil { - // On systems with IPv6 disabled, this file won't exist. - // Do nothing. - if errors.Is(err, os.ErrNotExist) { - return nil, nil + for i := 0; i < v.NumField(); i++ { + value, ok := v.Field(i).Interface().(*float64) + if !ok || value == nil { + continue } - return nil, err - } - defer file.Close() - - return parseSNMP6Stats(file) -} - -func parseSNMP6Stats(r io.Reader) (map[string]map[string]string, error) { - var ( - netStats = map[string]map[string]string{} - scanner = bufio.NewScanner(r) - ) - - for scanner.Scan() { - stat := strings.Fields(scanner.Text()) - if len(stat) < 2 { + name := v.Type().Field(i).Name + key := protocol + "_" + name + desc, ok := netStatDescs[key] + if !ok { continue } - // Expect to have "6" in metric name, skip line otherwise - if sixIndex := strings.Index(stat[0], "6"); sixIndex != -1 { - protocol := stat[0][:sixIndex+1] - name := stat[0][sixIndex+1:] - if _, present := netStats[protocol]; !present { - netStats[protocol] = map[string]string{} - } - netStats[protocol][name] = stat[1] + if !c.fieldPattern.MatchString(key) { + continue } - } - return netStats, scanner.Err() + ch <- prometheus.MustNewConstMetric(desc, prometheus.UntypedValue, *value) + } } diff --git a/collector/netstat_linux_test.go b/collector/netstat_linux_test.go index a30f44a2c9..8ba3a9dd30 100644 --- a/collector/netstat_linux_test.go +++ b/collector/netstat_linux_test.go @@ -16,83 +16,174 @@ package collector import ( - "os" + "io" + "log/slog" + "strings" "testing" + + "github.com/alecthomas/kingpin/v2" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/testutil" ) -func TestNetStats(t *testing.T) { - testNetStats(t, "fixtures/proc/net/netstat") - testSNMPStats(t, "fixtures/proc/net/snmp") - testSNMP6Stats(t, "fixtures/proc/net/snmp6") +type testNetStatCollector struct { + c Collector } -func testNetStats(t *testing.T, fileName string) { - file, err := os.Open(fileName) - if err != nil { - t.Fatal(err) - } - defer file.Close() - - netStats, err := parseNetStats(file, fileName) - if err != nil { - t.Fatal(err) - } - - if want, got := "102471", netStats["TcpExt"]["DelayedACKs"]; want != got { - t.Errorf("want netstat TCP DelayedACKs %s, got %s", want, got) - } +func (c testNetStatCollector) Collect(ch chan<- prometheus.Metric) { + c.c.Update(ch) +} - if want, got := "2786264347", netStats["IpExt"]["OutOctets"]; want != got { - t.Errorf("want netstat IP OutOctets %s, got %s", want, got) - } +func (c testNetStatCollector) Describe(ch chan<- *prometheus.Desc) { + prometheus.DescribeByCollect(c, ch) } -func testSNMPStats(t *testing.T, fileName string) { - file, err := os.Open(fileName) - if err != nil { - t.Fatal(err) - } - defer file.Close() +func NewTestNetStatCollector(t *testing.T, logger *slog.Logger) prometheus.Collector { + t.Helper() - snmpStats, err := parseNetStats(file, fileName) + c, err := NewNetStatCollector(logger) if err != nil { t.Fatal(err) } - - if want, got := "9", snmpStats["Udp"]["RcvbufErrors"]; want != got { - t.Errorf("want netstat Udp RcvbufErrors %s, got %s", want, got) - } - - if want, got := "8", snmpStats["Udp"]["SndbufErrors"]; want != got { - t.Errorf("want netstat Udp SndbufErrors %s, got %s", want, got) - } + return testNetStatCollector{c: c} } -func testSNMP6Stats(t *testing.T, fileName string) { - file, err := os.Open(fileName) - if err != nil { - t.Fatal(err) - } - defer file.Close() - - snmp6Stats, err := parseSNMP6Stats(file) - if err != nil { +func TestNetStats(t *testing.T) { + if _, err := kingpin.CommandLine.Parse([]string{}); err != nil { t.Fatal(err) } - - if want, got := "460", snmp6Stats["Ip6"]["InOctets"]; want != got { - t.Errorf("want netstat IPv6 InOctets %s, got %s", want, got) - } - - if want, got := "8", snmp6Stats["Icmp6"]["OutMsgs"]; want != got { - t.Errorf("want netstat ICPM6 OutMsgs %s, got %s", want, got) - } - - if want, got := "9", snmp6Stats["Udp6"]["RcvbufErrors"]; want != got { - t.Errorf("want netstat Udp6 RcvbufErrors %s, got %s", want, got) - } - - if want, got := "8", snmp6Stats["Udp6"]["SndbufErrors"]; want != got { - t.Errorf("want netstat Udp6 SndbufErrors %s, got %s", want, got) + *procPath = "fixtures/proc" + + logger := slog.New(slog.NewTextHandler(io.Discard, nil)) + c := NewTestNetStatCollector(t, logger) + + expected := ` +# HELP node_netstat_Icmp6_InErrors Statistic Icmp6InErrors. +# TYPE node_netstat_Icmp6_InErrors untyped +node_netstat_Icmp6_InErrors 0 +# HELP node_netstat_Icmp6_InMsgs Statistic Icmp6InMsgs. +# TYPE node_netstat_Icmp6_InMsgs untyped +node_netstat_Icmp6_InMsgs 0 +# HELP node_netstat_Icmp6_OutMsgs Statistic Icmp6OutMsgs. +# TYPE node_netstat_Icmp6_OutMsgs untyped +node_netstat_Icmp6_OutMsgs 8 +# HELP node_netstat_Icmp_InErrors Statistic IcmpInErrors. +# TYPE node_netstat_Icmp_InErrors untyped +node_netstat_Icmp_InErrors 0 +# HELP node_netstat_Icmp_InMsgs Statistic IcmpInMsgs. +# TYPE node_netstat_Icmp_InMsgs untyped +node_netstat_Icmp_InMsgs 104 +# HELP node_netstat_Icmp_OutMsgs Statistic IcmpOutMsgs. +# TYPE node_netstat_Icmp_OutMsgs untyped +node_netstat_Icmp_OutMsgs 120 +# HELP node_netstat_Ip6_InOctets Statistic Ip6InOctets. +# TYPE node_netstat_Ip6_InOctets untyped +node_netstat_Ip6_InOctets 460 +# HELP node_netstat_Ip6_OutOctets Statistic Ip6OutOctets. +# TYPE node_netstat_Ip6_OutOctets untyped +node_netstat_Ip6_OutOctets 536 +# HELP node_netstat_IpExt_InOctets Statistic IpExtInOctets. +# TYPE node_netstat_IpExt_InOctets untyped +node_netstat_IpExt_InOctets 6.28639697e+09 +# HELP node_netstat_IpExt_OutOctets Statistic IpExtOutOctets. +# TYPE node_netstat_IpExt_OutOctets untyped +node_netstat_IpExt_OutOctets 2.786264347e+09 +# HELP node_netstat_Ip_Forwarding Statistic IpForwarding. +# TYPE node_netstat_Ip_Forwarding untyped +node_netstat_Ip_Forwarding 1 +# HELP node_netstat_TcpExt_ListenDrops Statistic TcpExtListenDrops. +# TYPE node_netstat_TcpExt_ListenDrops untyped +node_netstat_TcpExt_ListenDrops 0 +# HELP node_netstat_TcpExt_ListenOverflows Statistic TcpExtListenOverflows. +# TYPE node_netstat_TcpExt_ListenOverflows untyped +node_netstat_TcpExt_ListenOverflows 0 +# HELP node_netstat_TcpExt_SyncookiesFailed Statistic TcpExtSyncookiesFailed. +# TYPE node_netstat_TcpExt_SyncookiesFailed untyped +node_netstat_TcpExt_SyncookiesFailed 2 +# HELP node_netstat_TcpExt_SyncookiesRecv Statistic TcpExtSyncookiesRecv. +# TYPE node_netstat_TcpExt_SyncookiesRecv untyped +node_netstat_TcpExt_SyncookiesRecv 0 +# HELP node_netstat_TcpExt_SyncookiesSent Statistic TcpExtSyncookiesSent. +# TYPE node_netstat_TcpExt_SyncookiesSent untyped +node_netstat_TcpExt_SyncookiesSent 0 +# HELP node_netstat_TcpExt_TCPOFOQueue Statistic TcpExtTCPOFOQueue. +# TYPE node_netstat_TcpExt_TCPOFOQueue untyped +node_netstat_TcpExt_TCPOFOQueue 42 +# HELP node_netstat_TcpExt_TCPRcvQDrop Statistic TcpExtTCPRcvQDrop. +# TYPE node_netstat_TcpExt_TCPRcvQDrop untyped +node_netstat_TcpExt_TCPRcvQDrop 131 +# HELP node_netstat_TcpExt_TCPTimeouts Statistic TcpExtTCPTimeouts. +# TYPE node_netstat_TcpExt_TCPTimeouts untyped +node_netstat_TcpExt_TCPTimeouts 115 +# HELP node_netstat_Tcp_ActiveOpens Statistic TcpActiveOpens. +# TYPE node_netstat_Tcp_ActiveOpens untyped +node_netstat_Tcp_ActiveOpens 3556 +# HELP node_netstat_Tcp_CurrEstab Statistic TcpCurrEstab. +# TYPE node_netstat_Tcp_CurrEstab untyped +node_netstat_Tcp_CurrEstab 0 +# HELP node_netstat_Tcp_InErrs Statistic TcpInErrs. +# TYPE node_netstat_Tcp_InErrs untyped +node_netstat_Tcp_InErrs 5 +# HELP node_netstat_Tcp_InSegs Statistic TcpInSegs. +# TYPE node_netstat_Tcp_InSegs untyped +node_netstat_Tcp_InSegs 5.7252008e+07 +# HELP node_netstat_Tcp_OutRsts Statistic TcpOutRsts. +# TYPE node_netstat_Tcp_OutRsts untyped +node_netstat_Tcp_OutRsts 1003 +# HELP node_netstat_Tcp_OutSegs Statistic TcpOutSegs. +# TYPE node_netstat_Tcp_OutSegs untyped +node_netstat_Tcp_OutSegs 5.4915039e+07 +# HELP node_netstat_Tcp_PassiveOpens Statistic TcpPassiveOpens. +# TYPE node_netstat_Tcp_PassiveOpens untyped +node_netstat_Tcp_PassiveOpens 230 +# HELP node_netstat_Tcp_RetransSegs Statistic TcpRetransSegs. +# TYPE node_netstat_Tcp_RetransSegs untyped +node_netstat_Tcp_RetransSegs 227 +# HELP node_netstat_Udp6_InDatagrams Statistic Udp6InDatagrams. +# TYPE node_netstat_Udp6_InDatagrams untyped +node_netstat_Udp6_InDatagrams 0 +# HELP node_netstat_Udp6_InErrors Statistic Udp6InErrors. +# TYPE node_netstat_Udp6_InErrors untyped +node_netstat_Udp6_InErrors 0 +# HELP node_netstat_Udp6_NoPorts Statistic Udp6NoPorts. +# TYPE node_netstat_Udp6_NoPorts untyped +node_netstat_Udp6_NoPorts 0 +# HELP node_netstat_Udp6_OutDatagrams Statistic Udp6OutDatagrams. +# TYPE node_netstat_Udp6_OutDatagrams untyped +node_netstat_Udp6_OutDatagrams 0 +# HELP node_netstat_Udp6_RcvbufErrors Statistic Udp6RcvbufErrors. +# TYPE node_netstat_Udp6_RcvbufErrors untyped +node_netstat_Udp6_RcvbufErrors 9 +# HELP node_netstat_Udp6_SndbufErrors Statistic Udp6SndbufErrors. +# TYPE node_netstat_Udp6_SndbufErrors untyped +node_netstat_Udp6_SndbufErrors 8 +# HELP node_netstat_UdpLite6_InErrors Statistic UdpLite6InErrors. +# TYPE node_netstat_UdpLite6_InErrors untyped +node_netstat_UdpLite6_InErrors 0 +# HELP node_netstat_UdpLite_InErrors Statistic UdpLiteInErrors. +# TYPE node_netstat_UdpLite_InErrors untyped +node_netstat_UdpLite_InErrors 0 +# HELP node_netstat_Udp_InDatagrams Statistic UdpInDatagrams. +# TYPE node_netstat_Udp_InDatagrams untyped +node_netstat_Udp_InDatagrams 88542 +# HELP node_netstat_Udp_InErrors Statistic UdpInErrors. +# TYPE node_netstat_Udp_InErrors untyped +node_netstat_Udp_InErrors 0 +# HELP node_netstat_Udp_NoPorts Statistic UdpNoPorts. +# TYPE node_netstat_Udp_NoPorts untyped +node_netstat_Udp_NoPorts 120 +# HELP node_netstat_Udp_OutDatagrams Statistic UdpOutDatagrams. +# TYPE node_netstat_Udp_OutDatagrams untyped +node_netstat_Udp_OutDatagrams 53028 +# HELP node_netstat_Udp_RcvbufErrors Statistic UdpRcvbufErrors. +# TYPE node_netstat_Udp_RcvbufErrors untyped +node_netstat_Udp_RcvbufErrors 9 +# HELP node_netstat_Udp_SndbufErrors Statistic UdpSndbufErrors. +# TYPE node_netstat_Udp_SndbufErrors untyped +node_netstat_Udp_SndbufErrors 8 +` + + if err := testutil.CollectAndCompare(c, strings.NewReader(expected)); err != nil { + t.Errorf("unexpected collecting result:\n%s", err) } } diff --git a/go.mod b/go.mod index 7fa9aaa664..051e8f2be2 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/prometheus/client_model v0.6.2 github.com/prometheus/common v0.70.1 github.com/prometheus/exporter-toolkit v0.19.0 - github.com/prometheus/procfs v0.21.1 + github.com/prometheus/procfs v0.22.0 github.com/safchain/ethtool v0.7.0 golang.org/x/sys v0.47.0 howett.net/plist v1.0.1 diff --git a/go.sum b/go.sum index b6f9aef455..b165d23162 100644 --- a/go.sum +++ b/go.sum @@ -84,8 +84,8 @@ github.com/prometheus/common v0.70.1 h1:1HvjP4D5oL3t8RsPlwxA9onvvStjtIHYE5XuuwOi github.com/prometheus/common v0.70.1/go.mod h1:VdFUQDMZK3VLkurFUVhia6uys/0suUp86TJz5qbJRhc= github.com/prometheus/exporter-toolkit v0.19.0 h1:JljWCzE5naAiZ7Ukeb8PwjNbU+WwISuW0ktgdXMnMhc= github.com/prometheus/exporter-toolkit v0.19.0/go.mod h1:kOoEK/7wbe2Ns33l7wYHOXDZAZ/XGLyJqoGwmJxK+QU= -github.com/prometheus/procfs v0.21.1 h1:GljZCt+zSTS+NZq88cyQ1LjZ+RCHp3uVuabBWA5+OJI= -github.com/prometheus/procfs v0.21.1/go.mod h1:aB55Cww9pdSJVHk0hUf0inxWyyjPogFIjmHKYgMKmtY= +github.com/prometheus/procfs v0.22.0 h1:6q9+/JL9IKAPbCmBrv9n5O5Ty3NKnciV5X7YGw0oics= +github.com/prometheus/procfs v0.22.0/go.mod h1:CvmFr/GVhIjIvWJZW3tgkODBQMRIf0EyWMQLHCHab58= github.com/safchain/ethtool v0.7.0 h1:rlJzfDetsVvT61uz8x1YIcFn12akMfuPulHtZjtb7Is= github.com/safchain/ethtool v0.7.0/go.mod h1:MenQKEjXdfkjD3mp2QdCk8B/hwvkrlOTm/FD4gTpFxQ= github.com/siebenmann/go-kstat v0.0.0-20210513183136-173c9b0a9973 h1:GfSdC6wKfTGcgCS7BtzF5694Amne1pGCSTY252WhlEY= From 23f11778eb77985d8429d61c43f43330484d2b0f Mon Sep 17 00:00:00 2001 From: dongjiang Date: Mon, 31 Aug 2026 22:27:47 +0800 Subject: [PATCH 29/87] ump prometheus/procfs to v0.22.0 (#3799) Signed-off-by: dongjiang From a4e08d1d9a152f67ef781469eade6b0bf431994d Mon Sep 17 00:00:00 2001 From: Sai Pisey <130427660+SaiPisey2@users.noreply.github.com> Date: Mon, 31 Aug 2026 20:56:54 +0530 Subject: [PATCH 30/87] fix(e2e): resolve the Darwin fixture path on bash 3.2 (#3798) * fix(e2e): resolve the Darwin fixture path on bash 3.2 The per-OS fixture path was built with "${fixture_metrics::-4}". A negative substring length needs bash 4.2, and macOS still ships bash 3.2, where the expansion fails, fixture_metrics keeps pointing at the Linux fixture, and ./end-to-end-test.sh -u run on a Mac overwrites collector/fixtures/e2e-output.txt with Darwin output. "${fixture_metrics%.txt}" is equivalent and works on both. Also strip node_thermal_temperature_celsius along with the other non-deterministic metrics. Its sensor names and values are per-machine, so a developer running the suite on real hardware sees the whole sensor list as a diff. The CI runner reports no thermal sensors, so this makes no difference there. Signed-off-by: SaiPisey2 * Apply suggestion from @SuperQ Signed-off-by: Ben Kochie --------- Signed-off-by: SaiPisey2 Signed-off-by: Ben Kochie Co-authored-by: Ben Kochie --- end-to-end-test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/end-to-end-test.sh b/end-to-end-test.sh index b439cea556..661d2d4cc8 100755 --- a/end-to-end-test.sh +++ b/end-to-end-test.sh @@ -279,7 +279,7 @@ generated_metrics="${tmpdir}/e2e-output.txt" for os in freebsd openbsd netbsd solaris dragonfly darwin; do if [ "${GOHOSTOS}" = "${os}" ]; then generated_metrics="${tmpdir}/e2e-output-${GOHOSTOS}.txt" - fixture_metrics="${fixture_metrics::-4}-${GOHOSTOS}.txt" + fixture_metrics="${fixture_metrics%.txt}-${GOHOSTOS}.txt" fi done @@ -390,6 +390,7 @@ non_deterministic_metrics=$(cat << METRICS node_network_receive_bytes_total node_network_receive_multicast_total node_network_transmit_multicast_total + node_thermal_temperature_celsius node_zfs_abdstats_linear_count_total node_zfs_abdstats_linear_data_bytes node_zfs_abdstats_scatter_chunk_waste_bytes From 4397d50b24606091deea04390c4add73f33bf001 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 04:10:55 +0200 Subject: [PATCH 31/87] build(deps): bump the promci group with 3 updates (#3801) Bumps the promci group with 3 updates: [prometheus/promci-setup](https://github.com/prometheus/promci-setup), [prometheus/promci-artifacts/save](https://github.com/prometheus/promci-artifacts) and [prometheus/promci-artifacts/restore](https://github.com/prometheus/promci-artifacts). Updates `prometheus/promci-setup` from 0.2.1 to 0.2.2 - [Release notes](https://github.com/prometheus/promci-setup/releases) - [Commits](https://github.com/prometheus/promci-setup/compare/3e5cd31b34b8ae19efa8f071c5e3cdb44884a7f8...55bd31fe92710532260eb57c554f2697363285c5) Updates `prometheus/promci-artifacts/save` from 0.1.0 to 0.1.1 - [Release notes](https://github.com/prometheus/promci-artifacts/releases) - [Commits](https://github.com/prometheus/promci-artifacts/compare/f9a587dbc0b2c78a0c54f8ad1cde71ea29a4b76f...9ca3252d07f230d5f923452b4df5697eba4a5bee) Updates `prometheus/promci-artifacts/restore` from 0.1.0 to 0.1.1 - [Release notes](https://github.com/prometheus/promci-artifacts/releases) - [Commits](https://github.com/prometheus/promci-artifacts/compare/f9a587dbc0b2c78a0c54f8ad1cde71ea29a4b76f...9ca3252d07f230d5f923452b4df5697eba4a5bee) --- updated-dependencies: - dependency-name: prometheus/promci-setup dependency-version: 0.2.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: promci - dependency-name: prometheus/promci-artifacts/save dependency-version: 0.1.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: promci - dependency-name: prometheus/promci-artifacts/restore dependency-version: 0.1.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: promci ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 74d39c96d5..0d09da0aa0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - - uses: prometheus/promci-setup@3e5cd31b34b8ae19efa8f071c5e3cdb44884a7f8 # v0.2.1 + - uses: prometheus/promci-setup@55bd31fe92710532260eb57c554f2697363285c5 # v0.2.2 - name: Crossbuild run: ~/go/bin/promu crossbuild -v --parallelism 3 --parallelism-thread ${{ matrix.thread }} - name: CGO crossbuild @@ -80,7 +80,7 @@ jobs: if [[ -f "$(pwd)/.build/darwin-amd64/node_exporter" ]]; then ~/go/bin/promu codesign "$(pwd)/.build/darwin-amd64/node_exporter" fi - - uses: prometheus/promci-artifacts/save@f9a587dbc0b2c78a0c54f8ad1cde71ea29a4b76f # v0.1.0 + - uses: prometheus/promci-artifacts/save@9ca3252d07f230d5f923452b4df5697eba4a5bee # v0.1.1 with: directory: .build @@ -95,7 +95,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - - uses: prometheus/promci-artifacts/restore@f9a587dbc0b2c78a0c54f8ad1cde71ea29a4b76f # v0.1.0 + - uses: prometheus/promci-artifacts/restore@9ca3252d07f230d5f923452b4df5697eba4a5bee # v0.1.1 - name: Build docker image run: | if [[ "${{ github.ref }}" == refs/tags/* ]]; then From 7a1db0aef87588d267841edf5fa956a420e0a61e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 04:11:15 +0200 Subject: [PATCH 32/87] build(deps): bump vmactions/dragonflybsd-vm from 1.3.1 to 1.3.3 (#3802) Bumps [vmactions/dragonflybsd-vm](https://github.com/vmactions/dragonflybsd-vm) from 1.3.1 to 1.3.3. - [Release notes](https://github.com/vmactions/dragonflybsd-vm/releases) - [Commits](https://github.com/vmactions/dragonflybsd-vm/compare/bc8ccbaa091ce3624c93f2dc328ae48129b07580...7cd7c9b7f2b06e8e03d2337a9476995f3c112acf) --- updated-dependencies: - dependency-name: vmactions/dragonflybsd-vm dependency-version: 1.3.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bsd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 9ba0346063..0629b8149e 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -184,7 +184,7 @@ jobs: with: persist-credentials: false - name: test-e2e - uses: vmactions/dragonflybsd-vm@bc8ccbaa091ce3624c93f2dc328ae48129b07580 # v1.3.1 + uses: vmactions/dragonflybsd-vm@7cd7c9b7f2b06e8e03d2337a9476995f3c112acf # v1.3.3 with: copyback: false envs: 'GO_VERSION' From 28215ec9b5e2a2718d01e6de48bcb8c6fdf22328 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 04:11:37 +0200 Subject: [PATCH 33/87] build(deps): bump vmactions/freebsd-vm from 1.5.0 to 1.5.5 (#3803) Bumps [vmactions/freebsd-vm](https://github.com/vmactions/freebsd-vm) from 1.5.0 to 1.5.5. - [Release notes](https://github.com/vmactions/freebsd-vm/releases) - [Commits](https://github.com/vmactions/freebsd-vm/compare/5a72679103d223925653750faa878a143340fbd0...f0552d3b69211736abd97f02ff3d4674c56b73b1) --- updated-dependencies: - dependency-name: vmactions/freebsd-vm dependency-version: 1.5.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bsd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 0629b8149e..f5cec11ed6 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -26,7 +26,7 @@ jobs: with: persist-credentials: false - name: test-e2e - uses: vmactions/freebsd-vm@5a72679103d223925653750faa878a143340fbd0 # v1.5.0 + uses: vmactions/freebsd-vm@f0552d3b69211736abd97f02ff3d4674c56b73b1 # v1.5.5 with: release: "15.0" copyback: false From 17ddd77c59ba27e1508e9f7894b1e55b44d6aed3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 04:11:50 +0200 Subject: [PATCH 34/87] build(deps): bump vmactions/solaris-vm from 1.3.8 to 1.3.9 (#3804) Bumps [vmactions/solaris-vm](https://github.com/vmactions/solaris-vm) from 1.3.8 to 1.3.9. - [Release notes](https://github.com/vmactions/solaris-vm/releases) - [Commits](https://github.com/vmactions/solaris-vm/compare/315163f088b66e55bbcc45928bd224d4973b2312...96d8d976f9e67d82ec6c7e8ce9c1060731f9e21c) --- updated-dependencies: - dependency-name: vmactions/solaris-vm dependency-version: 1.3.9 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bsd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index f5cec11ed6..16f3de6df2 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -238,7 +238,7 @@ jobs: with: persist-credentials: false - name: test-e2e - uses: vmactions/solaris-vm@315163f088b66e55bbcc45928bd224d4973b2312 # v1.3.8 + uses: vmactions/solaris-vm@96d8d976f9e67d82ec6c7e8ce9c1060731f9e21c # v1.3.9 with: copyback: false envs: 'GO_VERSION' From 125a02099cde708ee9c99fddcc29a2703e92c576 Mon Sep 17 00:00:00 2001 From: Maharacha Date: Mon, 21 Sep 2026 15:12:05 +0200 Subject: [PATCH 35/87] collector/diskstats: add device-mapper backing device info metric (#3676) * collector/diskstats: add device-mapper backing device info metric --------- Signed-off-by: Joakim Nyman --- collector/diskstats_linux.go | 28 ++++++++++++++ collector/diskstats_linux_test.go | 11 ++++++ collector/fixtures/e2e-64k-page-output.txt | 11 ++++++ collector/fixtures/e2e-output.txt | 11 ++++++ collector/fixtures/sys.ttar | 45 ++++++++++++++++++++++ 5 files changed, 106 insertions(+) diff --git a/collector/diskstats_linux.go b/collector/diskstats_linux.go index 3794349725..a871e5ec86 100644 --- a/collector/diskstats_linux.go +++ b/collector/diskstats_linux.go @@ -17,9 +17,11 @@ package collector import ( "bufio" + "errors" "fmt" "log/slog" "os" + "sort" "strconv" "strings" @@ -74,6 +76,7 @@ type diskstatsCollector struct { descs []typedDesc filesystemInfoDesc typedDesc deviceMapperInfoDesc typedDesc + deviceMapperBackingDesc typedDesc ataDescs map[string]typedDesc logger *slog.Logger getUdevDeviceProperties func(uint32, uint32) (udevInfo, error) @@ -224,6 +227,13 @@ func NewDiskstatsCollector(logger *slog.Logger) (Collector, error) { nil, ), valueType: prometheus.GaugeValue, }, + deviceMapperBackingDesc: typedDesc{ + desc: prometheus.NewDesc(prometheus.BuildFQName(namespace, diskSubsystem, "device_mapper_backing_device_info"), + "Info about the underlying block devices of a device mapper device.", + []string{"device", "backing_device"}, + nil, + ), valueType: prometheus.GaugeValue, + }, ataDescs: map[string]typedDesc{ udevIDATAWriteCache: { desc: prometheus.NewDesc(prometheus.BuildFQName(namespace, diskSubsystem, "ata_write_cache"), @@ -351,6 +361,7 @@ func (c *diskstatsCollector) Update(ch chan<- prometheus.Metric) error { info[udevDMLVName], info[udevDMLVLayer], ) + c.updateDeviceMapperBackingDevices(ch, dev) } if ata := info[udevIDATA]; ata != "" { @@ -397,6 +408,23 @@ func rotationalLabel(fs blockdevice.FS, dev string) string { return "0" } +func (c *diskstatsCollector) updateDeviceMapperBackingDevices(ch chan<- prometheus.Metric, dev string) { + underlying, err := c.fs.SysBlockDeviceUnderlyingDevices(dev) + if err != nil { + if errors.Is(err, os.ErrNotExist) { + c.logger.Debug("Failed to get device mapper backing devices", "device", dev, "err", err) + } + return + } + + sort.Strings(underlying.DeviceNames) + for _, backingDevice := range underlying.DeviceNames { + ch <- c.deviceMapperBackingDesc.mustNewConstMetric(1.0, dev, + backingDevice, + ) + } +} + func getUdevDeviceProperties(major, minor uint32) (udevInfo, error) { filename := udevDataFilePath(fmt.Sprintf("b%d:%d", major, minor)) diff --git a/collector/diskstats_linux_test.go b/collector/diskstats_linux_test.go index 44f86c35bf..f261acbaa4 100644 --- a/collector/diskstats_linux_test.go +++ b/collector/diskstats_linux_test.go @@ -71,6 +71,17 @@ node_disk_ata_write_cache{device="sdc"} 1 node_disk_ata_write_cache_enabled{device="sda"} 0 node_disk_ata_write_cache_enabled{device="sdb"} 1 node_disk_ata_write_cache_enabled{device="sdc"} 0 +# HELP node_disk_device_mapper_backing_device_info Info about the underlying block devices of a device mapper device. +# TYPE node_disk_device_mapper_backing_device_info gauge +node_disk_device_mapper_backing_device_info{backing_device="dm-0",device="dm-1"} 1 +node_disk_device_mapper_backing_device_info{backing_device="dm-0",device="dm-2"} 1 +node_disk_device_mapper_backing_device_info{backing_device="dm-0",device="dm-3"} 1 +node_disk_device_mapper_backing_device_info{backing_device="dm-0",device="dm-4"} 1 +node_disk_device_mapper_backing_device_info{backing_device="nvme0n1p3",device="dm-0"} 1 +node_disk_device_mapper_backing_device_info{backing_device="sdi",device="dm-5"} 1 +node_disk_device_mapper_backing_device_info{backing_device="sdj",device="dm-5"} 1 +node_disk_device_mapper_backing_device_info{backing_device="sdk",device="dm-5"} 1 +node_disk_device_mapper_backing_device_info{backing_device="sdl",device="dm-5"} 1 # HELP node_disk_device_mapper_info Info about disk device mapper. # TYPE node_disk_device_mapper_info gauge node_disk_device_mapper_info{device="dm-0",lv_layer="",lv_name="",name="nvme0n1_crypt",uuid="CRYPT-LUKS2-jolaulot80fy9zsiobkxyxo7y2dqeho2-nvme0n1_crypt",vg_name=""} 1 diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index 7b8e4be5e4..c435e16f27 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -1035,6 +1035,17 @@ node_disk_ata_write_cache{device="sdc"} 1 node_disk_ata_write_cache_enabled{device="sda"} 0 node_disk_ata_write_cache_enabled{device="sdb"} 1 node_disk_ata_write_cache_enabled{device="sdc"} 0 +# HELP node_disk_device_mapper_backing_device_info Info about the underlying block devices of a device mapper device. +# TYPE node_disk_device_mapper_backing_device_info gauge +node_disk_device_mapper_backing_device_info{backing_device="dm-0",device="dm-1"} 1 +node_disk_device_mapper_backing_device_info{backing_device="dm-0",device="dm-2"} 1 +node_disk_device_mapper_backing_device_info{backing_device="dm-0",device="dm-3"} 1 +node_disk_device_mapper_backing_device_info{backing_device="dm-0",device="dm-4"} 1 +node_disk_device_mapper_backing_device_info{backing_device="nvme0n1p3",device="dm-0"} 1 +node_disk_device_mapper_backing_device_info{backing_device="sdi",device="dm-5"} 1 +node_disk_device_mapper_backing_device_info{backing_device="sdj",device="dm-5"} 1 +node_disk_device_mapper_backing_device_info{backing_device="sdk",device="dm-5"} 1 +node_disk_device_mapper_backing_device_info{backing_device="sdl",device="dm-5"} 1 # HELP node_disk_device_mapper_info Info about disk device mapper. # TYPE node_disk_device_mapper_info gauge node_disk_device_mapper_info{device="dm-0",lv_layer="",lv_name="",name="nvme0n1_crypt",uuid="CRYPT-LUKS2-jolaulot80fy9zsiobkxyxo7y2dqeho2-nvme0n1_crypt",vg_name=""} 1 diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index 2e2a42b0e5..344131f17b 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -1057,6 +1057,17 @@ node_disk_ata_write_cache{device="sdc"} 1 node_disk_ata_write_cache_enabled{device="sda"} 0 node_disk_ata_write_cache_enabled{device="sdb"} 1 node_disk_ata_write_cache_enabled{device="sdc"} 0 +# HELP node_disk_device_mapper_backing_device_info Info about the underlying block devices of a device mapper device. +# TYPE node_disk_device_mapper_backing_device_info gauge +node_disk_device_mapper_backing_device_info{backing_device="dm-0",device="dm-1"} 1 +node_disk_device_mapper_backing_device_info{backing_device="dm-0",device="dm-2"} 1 +node_disk_device_mapper_backing_device_info{backing_device="dm-0",device="dm-3"} 1 +node_disk_device_mapper_backing_device_info{backing_device="dm-0",device="dm-4"} 1 +node_disk_device_mapper_backing_device_info{backing_device="nvme0n1p3",device="dm-0"} 1 +node_disk_device_mapper_backing_device_info{backing_device="sdi",device="dm-5"} 1 +node_disk_device_mapper_backing_device_info{backing_device="sdj",device="dm-5"} 1 +node_disk_device_mapper_backing_device_info{backing_device="sdk",device="dm-5"} 1 +node_disk_device_mapper_backing_device_info{backing_device="sdl",device="dm-5"} 1 # HELP node_disk_device_mapper_info Info about disk device mapper. # TYPE node_disk_device_mapper_info gauge node_disk_device_mapper_info{device="dm-0",lv_layer="",lv_name="",name="nvme0n1_crypt",uuid="CRYPT-LUKS2-jolaulot80fy9zsiobkxyxo7y2dqeho2-nvme0n1_crypt",vg_name=""} 1 diff --git a/collector/fixtures/sys.ttar b/collector/fixtures/sys.ttar index 06f38954f9..aa08e991c6 100644 --- a/collector/fixtures/sys.ttar +++ b/collector/fixtures/sys.ttar @@ -5,6 +5,51 @@ Mode: 755 Directory: sys/block Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-0/slaves +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-0/slaves/nvme0n1p3 +SymlinkTo: ../nvme0n1p3 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-1/slaves +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-1/slaves/dm-0 +SymlinkTo: ../dm-0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-2 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-2/slaves +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-2/slaves/dm-0 +SymlinkTo: ../dm-0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-3 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-3/slaves +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-3/slaves/dm-0 +SymlinkTo: ../dm-0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-4 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-4/slaves +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-4/slaves/dm-0 +SymlinkTo: ../dm-0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: sys/block/md0 Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 46c4a3c6705a39b3d1aabcb747fdc05f659caa0c Mon Sep 17 00:00:00 2001 From: Rene Treffer Date: Fri, 25 Sep 2026 14:54:04 +0200 Subject: [PATCH 36/87] e2e: only test disk0 in the Darwin end-to-end test (#3825) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Darwin end-to-end test scrapes the real macos-latest runner and diffs the result against collector/fixtures/e2e-output-darwin.txt. We no longer see disk4 on the nodes and that breaks the e2e tests. This PR removes the usage of disk4 and the related fixtures: -node_disk_read_errors_total{device="disk4"} 0 -node_disk_read_retries_total{device="disk4"} 0 -node_disk_write_errors_total{device="disk4"} 0 -node_disk_write_retries_total{device="disk4"} 0 This PR also adds a dump of the attached interfaces and disks so we can more easily discover issues in the future. Signed-off-by: René Treffer --- .github/workflows/bsd.yml | 6 +++++- collector/fixtures/e2e-output-darwin.txt | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 16f3de6df2..6f8de39813 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -330,11 +330,15 @@ jobs: echo "::group::Print environment information" uname -a + sw_vers + sysctl hw.memsize hw.ncpu + diskutil list + ifconfig -l echo "GOOS: $(go env GOOS)" echo "GOARCH: $(go env GOARCH)" echo "::endgroup::" echo "::group::Run End-to-End Tests" git config --global --add safe.directory $(pwd) - make test-e2e E2E_EXTRA_FLAGS='--collector.diskstats.device-include=disk[04]' + make test-e2e E2E_EXTRA_FLAGS='--collector.diskstats.device-include=disk0' echo "::endgroup::" diff --git a/collector/fixtures/e2e-output-darwin.txt b/collector/fixtures/e2e-output-darwin.txt index cf29fb473c..61b369977a 100644 --- a/collector/fixtures/e2e-output-darwin.txt +++ b/collector/fixtures/e2e-output-darwin.txt @@ -94,19 +94,15 @@ node_buddyinfo_blocks{node="0",size="9",zone="Normal"} 0 # HELP node_disk_read_errors_total The total number of read errors. # TYPE node_disk_read_errors_total counter node_disk_read_errors_total{device="disk0"} 0 -node_disk_read_errors_total{device="disk4"} 0 # HELP node_disk_read_retries_total The total number of read retries. # TYPE node_disk_read_retries_total counter node_disk_read_retries_total{device="disk0"} 0 -node_disk_read_retries_total{device="disk4"} 0 # HELP node_disk_write_errors_total The total number of write errors. # TYPE node_disk_write_errors_total counter node_disk_write_errors_total{device="disk0"} 0 -node_disk_write_errors_total{device="disk4"} 0 # HELP node_disk_write_retries_total The total number of write retries. # TYPE node_disk_write_retries_total counter node_disk_write_retries_total{device="disk0"} 0 -node_disk_write_retries_total{device="disk4"} 0 # HELP node_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, goversion from which node_exporter was built, and the goos and goarch for the build. # TYPE node_exporter_build_info gauge # HELP node_memory_swap_total_bytes Memory information field swap_total_bytes. From 60ce437b9c737c3b9a9619df457ae68a067d3cfc Mon Sep 17 00:00:00 2001 From: Frederic <1665799+Finomosec@users.noreply.github.com> Date: Fri, 25 Sep 2026 15:15:09 +0200 Subject: [PATCH 37/87] bcache: Fix btree_read_average_duration_seconds unit (#3828) The kernel reports btree_read_average_duration_us in microseconds, but the value was scaled as nanoseconds, making the metric 1000x too small. Signed-off-by: Finomosec <1665799+Finomosec@users.noreply.github.com> Co-authored-by: Ben Kochie --- collector/bcache_linux.go | 4 +++- collector/fixtures/e2e-64k-page-output.txt | 2 +- collector/fixtures/e2e-output.txt | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/collector/bcache_linux.go b/collector/bcache_linux.go index 90366cc32a..a32a1754a2 100644 --- a/collector/bcache_linux.go +++ b/collector/bcache_linux.go @@ -214,10 +214,12 @@ func (c *bcacheCollector) updateBcacheStats(ch chan<- prometheus.Metric, s *bcac value: float64(s.Bcache.Internal.BtreeNodes), metricType: prometheus.GaugeValue, }, + // procfs names the field NanoSeconds, but it holds the raw value of + // btree_read_average_duration_us, which the kernel reports in microseconds. { name: "btree_read_average_duration_seconds", desc: "Average btree read duration.", - value: float64(s.Bcache.Internal.BtreeReadAverageDurationNanoSeconds) * 1e-9, + value: float64(s.Bcache.Internal.BtreeReadAverageDurationNanoSeconds) * 1e-6, metricType: prometheus.GaugeValue, }, { diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index c435e16f27..5d84335eb1 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -74,7 +74,7 @@ node_bcache_btree_cache_size_bytes{uuid="deaddd54-c735-46d5-868e-f331c5fd7c74"} node_bcache_btree_nodes{uuid="deaddd54-c735-46d5-868e-f331c5fd7c74"} 0 # HELP node_bcache_btree_read_average_duration_seconds Average btree read duration. # TYPE node_bcache_btree_read_average_duration_seconds gauge -node_bcache_btree_read_average_duration_seconds{uuid="deaddd54-c735-46d5-868e-f331c5fd7c74"} 1.305e-06 +node_bcache_btree_read_average_duration_seconds{uuid="deaddd54-c735-46d5-868e-f331c5fd7c74"} 0.001305 # HELP node_bcache_bypassed_bytes_total Amount of IO (both reads and writes) that has bypassed the cache. # TYPE node_bcache_bypassed_bytes_total counter node_bcache_bypassed_bytes_total{backing_device="bdev0",uuid="deaddd54-c735-46d5-868e-f331c5fd7c74"} 0 diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index 344131f17b..cfdeede26d 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -74,7 +74,7 @@ node_bcache_btree_cache_size_bytes{uuid="deaddd54-c735-46d5-868e-f331c5fd7c74"} node_bcache_btree_nodes{uuid="deaddd54-c735-46d5-868e-f331c5fd7c74"} 0 # HELP node_bcache_btree_read_average_duration_seconds Average btree read duration. # TYPE node_bcache_btree_read_average_duration_seconds gauge -node_bcache_btree_read_average_duration_seconds{uuid="deaddd54-c735-46d5-868e-f331c5fd7c74"} 1.305e-06 +node_bcache_btree_read_average_duration_seconds{uuid="deaddd54-c735-46d5-868e-f331c5fd7c74"} 0.001305 # HELP node_bcache_bypassed_bytes_total Amount of IO (both reads and writes) that has bypassed the cache. # TYPE node_bcache_bypassed_bytes_total counter node_bcache_bypassed_bytes_total{backing_device="bdev0",uuid="deaddd54-c735-46d5-868e-f331c5fd7c74"} 0 From db91fc56191c321b7d257107cf18d76fb5649536 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Oct 2026 10:19:55 +0200 Subject: [PATCH 38/87] build(deps): bump vmactions/freebsd-vm from 1.5.5 to 1.5.8 (#3839) Bumps [vmactions/freebsd-vm](https://github.com/vmactions/freebsd-vm) from 1.5.5 to 1.5.8. - [Release notes](https://github.com/vmactions/freebsd-vm/releases) - [Commits](https://github.com/vmactions/freebsd-vm/compare/f0552d3b69211736abd97f02ff3d4674c56b73b1...a2f9a41fa97f6848b8c3b791087dfcdaa5b473ff) --- updated-dependencies: - dependency-name: vmactions/freebsd-vm dependency-version: 1.5.8 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bsd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 6f8de39813..6d72a9ce8b 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -26,7 +26,7 @@ jobs: with: persist-credentials: false - name: test-e2e - uses: vmactions/freebsd-vm@f0552d3b69211736abd97f02ff3d4674c56b73b1 # v1.5.5 + uses: vmactions/freebsd-vm@a2f9a41fa97f6848b8c3b791087dfcdaa5b473ff # v1.5.8 with: release: "15.0" copyback: false From 193b1075959de84386eb80687be5f9feacbfd556 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Oct 2026 10:20:16 +0200 Subject: [PATCH 39/87] build(deps): bump vmactions/solaris-vm from 1.3.9 to 1.4.1 (#3840) Bumps [vmactions/solaris-vm](https://github.com/vmactions/solaris-vm) from 1.3.9 to 1.4.1. - [Release notes](https://github.com/vmactions/solaris-vm/releases) - [Commits](https://github.com/vmactions/solaris-vm/compare/96d8d976f9e67d82ec6c7e8ce9c1060731f9e21c...87d3c436511cef802cd1637f86f73b1a97715c8c) --- updated-dependencies: - dependency-name: vmactions/solaris-vm dependency-version: 1.4.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bsd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 6d72a9ce8b..016095fd46 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -238,7 +238,7 @@ jobs: with: persist-credentials: false - name: test-e2e - uses: vmactions/solaris-vm@96d8d976f9e67d82ec6c7e8ce9c1060731f9e21c # v1.3.9 + uses: vmactions/solaris-vm@87d3c436511cef802cd1637f86f73b1a97715c8c # v1.4.1 with: copyback: false envs: 'GO_VERSION' From 5a57d244ab25c8f216aec51b96cf15818b71bddd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Oct 2026 10:21:24 +0200 Subject: [PATCH 40/87] build(deps): bump vmactions/dragonflybsd-vm from 1.3.3 to 1.3.4 (#3841) Bumps [vmactions/dragonflybsd-vm](https://github.com/vmactions/dragonflybsd-vm) from 1.3.3 to 1.3.4. - [Release notes](https://github.com/vmactions/dragonflybsd-vm/releases) - [Commits](https://github.com/vmactions/dragonflybsd-vm/compare/7cd7c9b7f2b06e8e03d2337a9476995f3c112acf...4ab776fa9f914fbea72f13715b451e77e7ef5c41) --- updated-dependencies: - dependency-name: vmactions/dragonflybsd-vm dependency-version: 1.3.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bsd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 016095fd46..c9cedc683e 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -184,7 +184,7 @@ jobs: with: persist-credentials: false - name: test-e2e - uses: vmactions/dragonflybsd-vm@7cd7c9b7f2b06e8e03d2337a9476995f3c112acf # v1.3.3 + uses: vmactions/dragonflybsd-vm@4ab776fa9f914fbea72f13715b451e77e7ef5c41 # v1.3.4 with: copyback: false envs: 'GO_VERSION' From 36c267f5afcd92485f1b892d417b4533c8e89389 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Oct 2026 10:22:08 +0200 Subject: [PATCH 41/87] build(deps): bump the promci group with 2 updates (#3837) Bumps the promci group with 2 updates: [prometheus/promci/publish_main](https://github.com/prometheus/promci) and [prometheus/promci/publish_release](https://github.com/prometheus/promci). Updates `prometheus/promci/publish_main` from 0.9.0 to 0.10.0 - [Release notes](https://github.com/prometheus/promci/releases) - [Commits](https://github.com/prometheus/promci/compare/370e8c15dcec50043cbe66f2f34633d9efc0a190...872d318d090d73df349cb6ed90aadd072ca478f7) Updates `prometheus/promci/publish_release` from 0.9.0 to 0.10.0 - [Release notes](https://github.com/prometheus/promci/releases) - [Commits](https://github.com/prometheus/promci/compare/370e8c15dcec50043cbe66f2f34633d9efc0a190...872d318d090d73df349cb6ed90aadd072ca478f7) --- updated-dependencies: - dependency-name: prometheus/promci/publish_main dependency-version: 0.10.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: promci - dependency-name: prometheus/promci/publish_release dependency-version: 0.10.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: promci ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d09da0aa0..8429bf89c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,7 +121,7 @@ jobs: needs: [test_go, test_go_arm, build] if: github.event_name == 'push' && github.event.ref == 'refs/heads/master' steps: - - uses: prometheus/promci/publish_main@370e8c15dcec50043cbe66f2f34633d9efc0a190 # v0.9.0 + - uses: prometheus/promci/publish_main@872d318d090d73df349cb6ed90aadd072ca478f7 # v0.10.0 with: docker_hub_login: ${{ secrets.docker_hub_login }} docker_hub_password: ${{ secrets.docker_hub_password }} @@ -138,7 +138,7 @@ jobs: needs: [test_go, test_go_arm, build] if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') steps: - - uses: prometheus/promci/publish_release@370e8c15dcec50043cbe66f2f34633d9efc0a190 # v0.9.0 + - uses: prometheus/promci/publish_release@872d318d090d73df349cb6ed90aadd072ca478f7 # v0.10.0 with: docker_hub_login: ${{ secrets.docker_hub_login }} docker_hub_password: ${{ secrets.docker_hub_password }} From f31a5589b66df692bdb3315f2271afc0c40b98e2 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Wed, 7 Oct 2026 10:19:53 +0200 Subject: [PATCH 42/87] Update FreeBSD release (#3844) * Update FreeBSD release Use lastest major version for FreeBSD. Signed-off-by: Ben Kochie * Fix FreeBSD end-to-end test Add `node_zfs_arcstats_c_min_bytes` to non-deterministic list. Signed-off-by: Ben Kochie --------- Signed-off-by: Ben Kochie --- .github/workflows/bsd.yml | 2 +- collector/fixtures/e2e-output-freebsd.txt | 3 --- end-to-end-test.sh | 1 + 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index c9cedc683e..95890f0e15 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -28,7 +28,7 @@ jobs: - name: test-e2e uses: vmactions/freebsd-vm@a2f9a41fa97f6848b8c3b791087dfcdaa5b473ff # v1.5.8 with: - release: "15.0" + release: "15" copyback: false envs: 'GO_VERSION GNU_TAR_VERSION' usesh: true diff --git a/collector/fixtures/e2e-output-freebsd.txt b/collector/fixtures/e2e-output-freebsd.txt index cfa355a8ad..edb677760d 100644 --- a/collector/fixtures/e2e-output-freebsd.txt +++ b/collector/fixtures/e2e-output-freebsd.txt @@ -258,9 +258,6 @@ node_xfrm_out_state_proto_error_packets_total 4542 # HELP node_xfrm_out_state_seq_error_packets_total Sequence error i.e. Sequence number overflow # TYPE node_xfrm_out_state_seq_error_packets_total counter node_xfrm_out_state_seq_error_packets_total 543 -# HELP node_zfs_arcstats_c_min_bytes ZFS ARC minimum size -# TYPE node_zfs_arcstats_c_min_bytes gauge -node_zfs_arcstats_c_min_bytes 1.99743232e+08 # HELP node_zfs_arcstats_mfu_ghost_size ZFS ARC MFU ghost size # TYPE node_zfs_arcstats_mfu_ghost_size gauge node_zfs_arcstats_mfu_ghost_size 0 diff --git a/end-to-end-test.sh b/end-to-end-test.sh index 661d2d4cc8..3b0fc1a09c 100755 --- a/end-to-end-test.sh +++ b/end-to-end-test.sh @@ -400,6 +400,7 @@ non_deterministic_metrics=$(cat << METRICS node_zfs_arcstats_anon_bytes node_zfs_arcstats_c_bytes node_zfs_arcstats_c_max_bytes + node_zfs_arcstats_c_min_bytes node_zfs_arcstats_data_bytes node_zfs_arcstats_demand_data_hits_total node_zfs_arcstats_demand_data_misses_total From 021765660415af58f716e0e21357444284480f5d Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Wed, 7 Oct 2026 10:29:22 +0200 Subject: [PATCH 43/87] Use upstream default DOCKER_ARCHS (#3845) Use the default DOCKER_ARCHS from Makefile.common. Signed-off-by: Ben Kochie --- Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Makefile b/Makefile index 63f3991bba..891d54ce65 100644 --- a/Makefile +++ b/Makefile @@ -14,9 +14,6 @@ # Ensure that 'all' is the default target otherwise it will be the first target from Makefile.common. all:: -# Needs to be defined before including Makefile.common to auto-generate targets -DOCKER_ARCHS ?= amd64 arm64 armv7 ppc64le riscv64 s390x - include Makefile.common PROMTOOL_VERSION ?= 2.30.0 From 0af7b7abbafc9f10b908b97f26dc561c57cf1cd1 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Wed, 7 Oct 2026 10:29:59 +0200 Subject: [PATCH 44/87] Update Go (#3843) * Update Go build to 1.27.x. * Enable `gofumpt` formatter. * Sync golangci-lint from Prometheus. * Apply lint/format fixes. Signed-off-by: Ben Kochie --- .github/workflows/bsd.yml | 2 +- .github/workflows/ci.yml | 8 ++--- .github/workflows/golangci-lint.yml | 4 +-- .golangci.yml | 6 ++-- .promu-cgo.yml | 2 +- .promu.yml | 2 +- Makefile.common | 7 ++++- collector/arp_linux.go | 10 +++---- collector/bcache_linux.go | 5 +--- collector/boot_time_solaris.go | 3 +- collector/btrfs_linux.go | 3 +- collector/buddyinfo.go | 10 +++---- collector/cpu_aix.go | 2 +- collector/cpu_common.go | 10 +++---- collector/cpu_dragonfly.go | 2 +- collector/cpu_linux.go | 1 - collector/cpu_linux_test.go | 13 ++++---- collector/cpu_netbsd.go | 6 ++-- collector/cpu_openbsd.go | 1 + collector/cpu_vulnerabilities_linux.go | 12 ++++---- collector/diskstats_darwin.go | 2 +- collector/diskstats_linux.go | 2 +- collector/diskstats_linux_test.go | 8 ++--- collector/ethtool_linux.go | 6 ++-- collector/filefd_linux.go | 2 +- collector/filesystem_linux.go | 8 +++-- collector/helper_linux.go | 4 +-- collector/hwmon_linux.go | 3 +- collector/infiniband_linux.go | 6 ++-- collector/interrupts_linux.go | 4 +-- collector/interrupts_linux_test.go | 1 - collector/interrupts_openbsd.go | 4 +-- collector/interrupts_openbsd_amd64.go | 2 +- collector/kernel_hung_linux.go | 10 +++---- collector/loadavg_solaris.go | 3 -- collector/logind_linux_test.go | 1 - collector/mdadm_linux.go | 1 - collector/meminfo_numa_linux.go | 4 +-- collector/mountstats_linux.go | 6 ++-- collector/netclass_rtnl_linux.go | 3 +- collector/netdev_darwin.go | 2 +- collector/netdev_openbsd_amd64.go | 1 - collector/netstat_freebsd.go | 4 --- collector/netstat_freebsd_test.go | 1 - collector/netstat_linux.go | 2 +- collector/os_release.go | 21 +++++++++---- collector/pcidevice_linux.go | 14 +++++++-- collector/powersupplyclass.go | 4 +-- collector/powersupplyclass_darwin.go | 4 +-- collector/powersupplyclass_linux.go | 3 +- collector/pressure_linux.go | 4 +-- collector/processes_linux.go | 1 + collector/processes_linux_test.go | 1 - collector/rapl_linux.go | 5 +--- collector/slabinfo_linux.go | 3 +- collector/softirqs_linux.go | 4 +-- collector/swap_linux.go | 6 ++-- collector/sysctl_bsd.go | 1 - collector/systemd_linux_test.go | 3 +- collector/tapestats_linux.go | 6 ++-- collector/tcpstat_linux_test.go | 1 - collector/thermal_darwin.go | 6 ++-- collector/thermal_darwin_arm64.go | 6 ++-- collector/thermal_zone_linux.go | 6 ++-- collector/timex.go | 2 +- collector/udp_queues_linux.go | 1 - collector/uname_bsd.go | 2 +- collector/vmstat_linux.go | 4 +-- collector/wifi_linux.go | 4 +-- collector/xfs_linux.go | 4 +-- collector/zfs_linux.go | 10 +++---- collector/zfs_linux_test.go | 41 ++------------------------ collector/zoneinfo_linux.go | 3 +- node_exporter.go | 2 +- node_exporter_test.go | 8 ++--- 75 files changed, 160 insertions(+), 219 deletions(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 95890f0e15..5ce96a5f32 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -13,7 +13,7 @@ permissions: env: GNU_TAR_VERSION: "1.35" - GO_VERSION: "1.26.0" + GO_VERSION: "1.27.1" # To spin up one of the VMs below, see the "Debug Shell" section here: https://github.com/vmactions jobs: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8429bf89c9..43aaf68b61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: container: # Whenever the Go version is updated here, .promu.yml and .promu-cgo.yml # should also be updated. - image: quay.io/prometheus/golang-builder:1.26-base + image: quay.io/prometheus/golang-builder:1.27-base steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -33,7 +33,7 @@ jobs: persist-credentials: false - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: - go-version: 1.26.x + go-version: 1.27.x - run: uname -a - run: make test-e2e @@ -43,7 +43,7 @@ jobs: container: # Whenever the Go version is updated here, .promu.yml and .promu-cgo.yml # should also be updated. - image: quay.io/prometheus/golang-builder:1.26-base + image: quay.io/prometheus/golang-builder:1.27-base steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: @@ -89,7 +89,7 @@ jobs: runs-on: ubuntu-latest needs: [test_go, build] env: - DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.26-base + DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.27-base REPO_PATH: github.com/prometheus/node_exporter steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 45704a9544..a2d392e188 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -30,9 +30,9 @@ jobs: with: persist-credentials: false - name: Install Go - uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: - go-version: 1.26.x + go-version: 1.27.x - name: Install snmp_exporter/generator dependencies run: sudo apt-get update && sudo apt-get -y install libsnmp-dev if: github.repository == 'prometheus/snmp_exporter' diff --git a/.golangci.yml b/.golangci.yml index 4cb6899c98..4cd685f728 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -31,10 +31,12 @@ linters: path: _test.go formatters: enable: + - gofumpt - goimports - exclusions: - generated: lax settings: + gofumpt: + extra: + group-params: true goimports: local-prefixes: - github.com/prometheus/node_exporter diff --git a/.promu-cgo.yml b/.promu-cgo.yml index aa40105c4f..8de883c699 100644 --- a/.promu-cgo.yml +++ b/.promu-cgo.yml @@ -1,7 +1,7 @@ go: # Whenever the Go version is updated here, .circle/config.yml and # .promu.yml should also be updated. - version: 1.25 + version: 1.27 cgo: true repository: path: github.com/prometheus/node_exporter diff --git a/.promu.yml b/.promu.yml index d0d602b6a6..9c03a2f5d7 100644 --- a/.promu.yml +++ b/.promu.yml @@ -1,7 +1,7 @@ go: # Whenever the Go version is updated here, .circle/config.yml and # .promu-cgo.yml should also be updated. - version: 1.26 + version: 1.27 repository: path: github.com/prometheus/node_exporter build: diff --git a/Makefile.common b/Makefile.common index cd54cb419c..5e0edd1a5b 100644 --- a/Makefile.common +++ b/Makefile.common @@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_ SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v2.12.2 +GOLANGCI_LINT_VERSION ?= v2.13.1 GOLANGCI_FMT_OPTS ?= # golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64. # windows isn't included here because of the path separator being different. @@ -247,6 +247,11 @@ common-docker-repo-name: .PHONY: common-docker $(BUILD_DOCKER_ARCHS) common-docker: $(BUILD_DOCKER_ARCHS) + +.PHONY: common-docker-current-arch +common-docker-current-arch: + $(MAKE) common-docker-$(GOHOSTARCH) + # DOCKER_ARCHS holds promu architecture names, which are not OCI platform strings. $(BUILD_DOCKER_ARCHS): common-docker-%: @for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \ diff --git a/collector/arp_linux.go b/collector/arp_linux.go index 84d8920ad5..9278d46110 100644 --- a/collector/arp_linux.go +++ b/collector/arp_linux.go @@ -42,12 +42,10 @@ func init() { registerCollector("arp", defaultEnabled, NewARPCollector) } -var ( - arpEntries = prometheus.NewDesc( - prometheus.BuildFQName(namespace, "arp", "entries"), - "ARP entries by device", - []string{"device"}, nil, - ) +var arpEntries = prometheus.NewDesc( + prometheus.BuildFQName(namespace, "arp", "entries"), + "ARP entries by device", + []string{"device"}, nil, ) // NewARPCollector returns a new Collector exposing ARP stats. diff --git a/collector/bcache_linux.go b/collector/bcache_linux.go index a32a1754a2..4fc647667e 100644 --- a/collector/bcache_linux.go +++ b/collector/bcache_linux.go @@ -24,9 +24,7 @@ import ( "github.com/prometheus/procfs/bcache" ) -var ( - priorityStats = kingpin.Flag("collector.bcache.priorityStats", "Expose expensive priority stats.").Bool() -) +var priorityStats = kingpin.Flag("collector.bcache.priorityStats", "Expose expensive priority stats.").Bool() func init() { registerCollector("bcache", defaultEnabled, NewBcacheCollector) @@ -152,7 +150,6 @@ func bcachePeriodStatsToMetric(ps *bcache.PeriodStats, labelValue string) []bcac // UpdateBcacheStats collects statistics for one bcache ID. func (c *bcacheCollector) updateBcacheStats(ch chan<- prometheus.Metric, s *bcache.Stats) { - const ( subsystem = "bcache" ) diff --git a/collector/boot_time_solaris.go b/collector/boot_time_solaris.go index 4b2ef4577c..345eea90d9 100644 --- a/collector/boot_time_solaris.go +++ b/collector/boot_time_solaris.go @@ -38,7 +38,8 @@ func newBootTimeCollector(logger *slog.Logger) (Collector, error) { prometheus.BuildFQName(namespace, "", "boot_time_seconds"), "Unix time of last boot, including microseconds.", nil, nil, - ), prometheus.GaugeValue}, + ), prometheus.GaugeValue, + }, logger: logger, }, nil } diff --git a/collector/btrfs_linux.go b/collector/btrfs_linux.go index bc6fb6048d..b25b08b6dc 100644 --- a/collector/btrfs_linux.go +++ b/collector/btrfs_linux.go @@ -68,7 +68,7 @@ func (c *btrfsCollector) Update(ch chan<- prometheus.Metric) error { for _, s := range stats { // match up procfs and ioctl info by filesystem UUID (without dashes) - var fsUUID = strings.ReplaceAll(s.UUID, "-", "") + fsUUID := strings.ReplaceAll(s.UUID, "-", "") ioctlStats := ioctlStatsMap[fsUUID] c.updateBtrfsStats(ch, s, ioctlStats) } @@ -176,7 +176,6 @@ func (c *btrfsCollector) getIoctlDeviceStats(fs *dennwc.FS, fsInfo *dennwc.Info) for i := uint64(0); i <= fsInfo.MaxID; i++ { deviceInfo, err := fs.GetDevInfo(i) - if err != nil { if errno, ok := err.(syscall.Errno); ok && errno == syscall.ENODEV { // Device IDs do not consistently start at 0, nor are ranges contiguous, so we expect this. diff --git a/collector/buddyinfo.go b/collector/buddyinfo.go index 82c58c32f2..4afdbda416 100644 --- a/collector/buddyinfo.go +++ b/collector/buddyinfo.go @@ -37,12 +37,10 @@ func init() { registerCollector("buddyinfo", defaultDisabled, NewBuddyinfoCollector) } -var ( - buddyinfoBlocks = prometheus.NewDesc( - prometheus.BuildFQName(namespace, buddyInfoSubsystem, "blocks"), - "Count of free blocks according to size.", - []string{"node", "zone", "size"}, nil, - ) +var buddyinfoBlocks = prometheus.NewDesc( + prometheus.BuildFQName(namespace, buddyInfoSubsystem, "blocks"), + "Count of free blocks according to size.", + []string{"node", "zone", "size"}, nil, ) // NewBuddyinfoCollector returns a new Collector exposing buddyinfo stats. diff --git a/collector/cpu_aix.go b/collector/cpu_aix.go index 1368f1b368..8782ec37b3 100644 --- a/collector/cpu_aix.go +++ b/collector/cpu_aix.go @@ -20,6 +20,7 @@ package collector #include // For errno */ import "C" + import ( "fmt" "log/slog" @@ -82,7 +83,6 @@ func NewCpuCollector(logger *slog.Logger) (Collector, error) { } pconfig, err := perfstat.PartitionStat() - if err != nil { return nil, err } diff --git a/collector/cpu_common.go b/collector/cpu_common.go index cb34facbfa..eceffe21c7 100644 --- a/collector/cpu_common.go +++ b/collector/cpu_common.go @@ -23,10 +23,8 @@ const ( cpuCollectorSubsystem = "cpu" ) -var ( - nodeCPUSecondsDesc = prometheus.NewDesc( - prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "seconds_total"), - "Seconds the CPUs spent in each mode.", - []string{"cpu", "mode"}, nil, - ) +var nodeCPUSecondsDesc = prometheus.NewDesc( + prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "seconds_total"), + "Seconds the CPUs spent in each mode.", + []string{"cpu", "mode"}, nil, ) diff --git a/collector/cpu_dragonfly.go b/collector/cpu_dragonfly.go index 3571f436d5..4ae34f1641 100644 --- a/collector/cpu_dragonfly.go +++ b/collector/cpu_dragonfly.go @@ -122,7 +122,7 @@ func getDragonFlyCPUTimes() ([]float64, error) { // Expose CPU stats using sysctl. func (c *statCollector) Update(ch chan<- prometheus.Metric) error { - var fieldsCount = 5 + fieldsCount := 5 cpuTimes, err := getDragonFlyCPUTimes() if err != nil { return err diff --git a/collector/cpu_linux.go b/collector/cpu_linux.go index 3b65a5734a..a4bbab01dc 100644 --- a/collector/cpu_linux.go +++ b/collector/cpu_linux.go @@ -410,7 +410,6 @@ func (c *cpuCollector) updateStat(ch chan<- prometheus.Metric) error { // updateCPUStats updates the internal cache of CPU stats. func (c *cpuCollector) updateCPUStats(newStats map[int64]procfs.CPUStat) { - // Acquire a lock to update the stats. c.cpuStatsMutex.Lock() defer c.cpuStatsMutex.Unlock() diff --git a/collector/cpu_linux_test.go b/collector/cpu_linux_test.go index 6d4bc4506d..04b823c583 100644 --- a/collector/cpu_linux_test.go +++ b/collector/cpu_linux_test.go @@ -53,7 +53,8 @@ func TestCPU(t *testing.T) { Steal: 100.0, Guest: 100.0, GuestNice: 100.0, - }} + }, + } c := makeTestCPUCollector(firstCPUStat) want := map[int64]procfs.CPUStat{ @@ -68,7 +69,8 @@ func TestCPU(t *testing.T) { Steal: 101.0, Guest: 101.0, GuestNice: 101.0, - }} + }, + } c.updateCPUStats(want) got := c.cpuStats if !reflect.DeepEqual(want, got) { @@ -88,7 +90,8 @@ func TestCPU(t *testing.T) { Steal: 99.9, Guest: 99.9, GuestNice: 99.9, - }} + }, + } c.updateCPUStats(jumpBack) got = c.cpuStats if reflect.DeepEqual(jumpBack, got) { @@ -108,7 +111,8 @@ func TestCPU(t *testing.T) { Steal: 102.0, Guest: 102.0, GuestNice: 102.0, - }} + }, + } c.updateCPUStats(resetIdle) got = c.cpuStats if !reflect.DeepEqual(resetIdle, got) { @@ -198,5 +202,4 @@ func TestCPUOffline(t *testing.T) { if !reflect.DeepEqual(want, got) { t.Fatalf("should have %v CPU Stat: got %v", want, got) } - } diff --git a/collector/cpu_netbsd.go b/collector/cpu_netbsd.go index 49051a6efd..35f0155d87 100644 --- a/collector/cpu_netbsd.go +++ b/collector/cpu_netbsd.go @@ -73,7 +73,7 @@ type sysmonProperty []sysmonValues type sysmonProperties map[string]sysmonProperty func _IOC(inout uint, group byte, num uint, len uintptr) uint { - return ((inout) | ((uint(len) & _IOCPARM_MASK) << _IOCPARM_SHIFT) | (uint(group) << _IOCGROUP_SHIFT) | (num)) + return (inout | ((uint(len) & _IOCPARM_MASK) << _IOCPARM_SHIFT) | (uint(group) << _IOCGROUP_SHIFT) | num) } func _IOWR(group byte, num uint, len uintptr) uint { @@ -128,7 +128,6 @@ func sortFilterSysmonProperties(props sysmonProperties, prefix string) []string } func convertTemperatures(prop sysmonProperty, res map[int]float64) error { - for _, val := range prop { if val.State == "invalid" || val.State == "unknown" || val.State == "" { continue @@ -137,14 +136,13 @@ func convertTemperatures(prop sysmonProperty, res map[int]float64) error { re := regexp.MustCompile("^cpu([0-9]+) temperature$") core := re.FindStringSubmatch(val.Description)[1] ncore, _ := strconv.Atoi(core) - temperature := ((float64(uint64(val.CurValue))) / 1000000) - 273.15 + temperature := (float64(uint64(val.CurValue)) / 1000000) - 273.15 res[ncore] = temperature } return nil } func getCPUTemperatures() (map[int]float64, error) { - res := make(map[int]float64) // Read all properties diff --git a/collector/cpu_openbsd.go b/collector/cpu_openbsd.go index 2c8ce9a81f..3c8e64e0e9 100644 --- a/collector/cpu_openbsd.go +++ b/collector/cpu_openbsd.go @@ -33,6 +33,7 @@ const ( CP_IDLE CPUSTATES ) + const ( CP_USER_O63 = iota CP_NICE_O63 diff --git a/collector/cpu_vulnerabilities_linux.go b/collector/cpu_vulnerabilities_linux.go index 155253b5f4..217e5e7a4a 100644 --- a/collector/cpu_vulnerabilities_linux.go +++ b/collector/cpu_vulnerabilities_linux.go @@ -25,13 +25,11 @@ const ( cpuVulnerabilitiesCollectorSubsystem = "cpu_vulnerabilities" ) -var ( - vulnerabilityDesc = prometheus.NewDesc( - prometheus.BuildFQName(namespace, cpuVulnerabilitiesCollectorSubsystem, "info"), - "Details of each CPU vulnerability reported by sysfs. The value of the series is an int encoded state of the vulnerability. The same state is stored as a string in the label", - []string{"codename", "state", "mitigation"}, - nil, - ) +var vulnerabilityDesc = prometheus.NewDesc( + prometheus.BuildFQName(namespace, cpuVulnerabilitiesCollectorSubsystem, "info"), + "Details of each CPU vulnerability reported by sysfs. The value of the series is an int encoded state of the vulnerability. The same state is stored as a string in the label", + []string{"codename", "state", "mitigation"}, + nil, ) type cpuVulnerabilitiesCollector struct{} diff --git a/collector/diskstats_darwin.go b/collector/diskstats_darwin.go index abcf854083..3fc2ced9d1 100644 --- a/collector/diskstats_darwin.go +++ b/collector/diskstats_darwin.go @@ -43,7 +43,7 @@ func init() { // NewDiskstatsCollector returns a new Collector exposing disk device stats. func NewDiskstatsCollector(logger *slog.Logger) (Collector, error) { - var diskLabelNames = []string{"device"} + diskLabelNames := []string{"device"} deviceFilter, err := newDiskstatsDeviceFilter(logger) if err != nil { diff --git a/collector/diskstats_linux.go b/collector/diskstats_linux.go index a871e5ec86..3e388dc7f0 100644 --- a/collector/diskstats_linux.go +++ b/collector/diskstats_linux.go @@ -89,7 +89,7 @@ func init() { // NewDiskstatsCollector returns a new Collector exposing disk device stats. // Docs from https://www.kernel.org/doc/Documentation/iostats.txt func NewDiskstatsCollector(logger *slog.Logger) (Collector, error) { - var diskLabelNames = []string{"device"} + diskLabelNames := []string{"device"} fs, err := blockdevice.NewFS(*procPath, *sysPath) if err != nil { return nil, fmt.Errorf("failed to open sysfs: %w", err) diff --git a/collector/diskstats_linux_test.go b/collector/diskstats_linux_test.go index f261acbaa4..f7891f27e4 100644 --- a/collector/diskstats_linux_test.go +++ b/collector/diskstats_linux_test.go @@ -367,21 +367,21 @@ func TestRotationalLabel(t *testing.T) { tempSys := t.TempDir() // Create a valid rotational=1 file (HDD). - err := os.MkdirAll(filepath.Join(tempSys, "block/sda/queue"), 0755) + err := os.MkdirAll(filepath.Join(tempSys, "block/sda/queue"), 0o755) if err != nil { t.Fatal(err) } - err = os.WriteFile(filepath.Join(tempSys, "block/sda/queue/rotational"), []byte("1\n"), 0644) + err = os.WriteFile(filepath.Join(tempSys, "block/sda/queue/rotational"), []byte("1\n"), 0o644) if err != nil { t.Fatal(err) } // Create a rotational=0 file (SSD). - err = os.MkdirAll(filepath.Join(tempSys, "block/sdb/queue"), 0755) + err = os.MkdirAll(filepath.Join(tempSys, "block/sdb/queue"), 0o755) if err != nil { t.Fatal(err) } - err = os.WriteFile(filepath.Join(tempSys, "block/sdb/queue/rotational"), []byte("0\n"), 0644) + err = os.WriteFile(filepath.Join(tempSys, "block/sdb/queue/rotational"), []byte("0\n"), 0o644) if err != nil { t.Fatal(err) } diff --git a/collector/ethtool_linux.go b/collector/ethtool_linux.go index e4d86bcd8c..f0ed3162a6 100644 --- a/collector/ethtool_linux.go +++ b/collector/ethtool_linux.go @@ -228,7 +228,7 @@ func NewEthtoolCollector(logger *slog.Logger) (Collector, error) { // updatePortCapabilities generates metrics for autonegotiate, pause and asymmetricpause. // The bit offsets here correspond to ethtool_link_mode_bit_indices in linux/include/uapi/linux/ethtool.h // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/ethtool.h -func (c *ethtoolCollector) updatePortCapabilities(ch chan<- prometheus.Metric, prefix string, device string, linkModes uint32) { +func (c *ethtoolCollector) updatePortCapabilities(ch chan<- prometheus.Metric, prefix, device string, linkModes uint32) { var ( autonegotiate = 0.0 pause = 0.0 @@ -263,14 +263,13 @@ func (c *ethtoolCollector) updatePortInfo(ch chan<- prometheus.Metric, device st if linkModes&(1<.", name), @@ -160,7 +160,6 @@ func getPowerSupplyClassInfo(ignore *regexp.Regexp) (sysfs.PowerSupplyClass, err return nil, err } powerSupplyClass, err := fs.PowerSupplyClass() - if err != nil { return powerSupplyClass, fmt.Errorf("error obtaining power_supply class info: %w", err) } diff --git a/collector/pressure_linux.go b/collector/pressure_linux.go index 659c4b3768..568fc61c11 100644 --- a/collector/pressure_linux.go +++ b/collector/pressure_linux.go @@ -33,9 +33,7 @@ const ( psiResourceIRQ = "irq" ) -var ( - psiResources = []string{psiResourceCPU, psiResourceIO, psiResourceMemory, psiResourceIRQ} -) +var psiResources = []string{psiResourceCPU, psiResourceIO, psiResourceMemory, psiResourceIRQ} type pressureStatsCollector struct { cpu *prometheus.Desc diff --git a/collector/processes_linux.go b/collector/processes_linux.go index eff5cf06b5..bb99c525db 100644 --- a/collector/processes_linux.go +++ b/collector/processes_linux.go @@ -82,6 +82,7 @@ func NewProcessStatCollector(logger *slog.Logger) (Collector, error) { logger: logger, }, nil } + func (c *processCollector) Update(ch chan<- prometheus.Metric) error { pids, states, threads, threadStates, err := c.getAllocatedThreads() if err != nil { diff --git a/collector/processes_linux_test.go b/collector/processes_linux_test.go index 4b20ef8d63..b1c0c8fbd0 100644 --- a/collector/processes_linux_test.go +++ b/collector/processes_linux_test.go @@ -42,7 +42,6 @@ func TestReadProcessStatus(t *testing.T) { t.Fatalf("Current threads: %d Shouldn't be less than wanted %d", threads, want) } if states == nil { - t.Fatalf("Process states cannot be nil %v:", states) } maxPid, err := readUintFromFile(procFilePath("sys/kernel/pid_max")) diff --git a/collector/rapl_linux.go b/collector/rapl_linux.go index 92c402d539..0cd49c6493 100644 --- a/collector/rapl_linux.go +++ b/collector/rapl_linux.go @@ -40,14 +40,11 @@ func init() { registerCollector(raplCollectorSubsystem, defaultEnabled, NewRaplCollector) } -var ( - raplZoneLabel = kingpin.Flag("collector.rapl.enable-zone-label", "Enables service unit metric unit_start_time_seconds").Bool() -) +var raplZoneLabel = kingpin.Flag("collector.rapl.enable-zone-label", "Enables service unit metric unit_start_time_seconds").Bool() // NewRaplCollector returns a new Collector exposing RAPL metrics. func NewRaplCollector(logger *slog.Logger) (Collector, error) { fs, err := sysfs.NewFS(*sysPath) - if err != nil { return nil, err } diff --git a/collector/slabinfo_linux.go b/collector/slabinfo_linux.go index 48bbf2abfe..bcb06509cd 100644 --- a/collector/slabinfo_linux.go +++ b/collector/slabinfo_linux.go @@ -47,7 +47,8 @@ func NewSlabinfoCollector(logger *slog.Logger) (Collector, error) { return nil, fmt.Errorf("failed to open procfs: %w", err) } - return &slabinfoCollector{logger: logger, + return &slabinfoCollector{ + logger: logger, fs: fs, subsystem: "slabinfo", labels: []string{"slab"}, diff --git a/collector/softirqs_linux.go b/collector/softirqs_linux.go index 0c64751049..294b539766 100644 --- a/collector/softirqs_linux.go +++ b/collector/softirqs_linux.go @@ -22,9 +22,7 @@ import ( "github.com/prometheus/client_golang/prometheus" ) -var ( - softirqLabelNames = []string{"cpu", "type"} -) +var softirqLabelNames = []string{"cpu", "type"} func (c *softirqsCollector) Update(ch chan<- prometheus.Metric) (err error) { softirqs, err := c.fs.Softirqs() diff --git a/collector/swap_linux.go b/collector/swap_linux.go index 9a275e1614..18894de392 100644 --- a/collector/swap_linux.go +++ b/collector/swap_linux.go @@ -68,8 +68,10 @@ func (c *swapCollector) getSwapInfo() ([]SwapsEntry, error) { metrics := make([]SwapsEntry, 0, len(swaps)) for _, swap := range swaps { - metrics = append(metrics, SwapsEntry{Device: swap.Filename, Type: swap.Type, - Priority: swap.Priority, Size: swap.Size, Used: swap.Used}) + metrics = append(metrics, SwapsEntry{ + Device: swap.Filename, Type: swap.Type, + Priority: swap.Priority, Size: swap.Size, Used: swap.Used, + }) } return metrics, nil diff --git a/collector/sysctl_bsd.go b/collector/sysctl_bsd.go index e3c8dc5cf4..23a818a8ef 100644 --- a/collector/sysctl_bsd.go +++ b/collector/sysctl_bsd.go @@ -111,5 +111,4 @@ func (b bsdSysctl) getCLong() (float64, error) { C.sizeof_long, C.sizeof_int, ) - } diff --git a/collector/systemd_linux_test.go b/collector/systemd_linux_test.go index 98668ed6be..cc273d8580 100644 --- a/collector/systemd_linux_test.go +++ b/collector/systemd_linux_test.go @@ -101,6 +101,7 @@ func TestSystemdIgnoreFilter(t *testing.T) { } } } + func TestSystemdIgnoreFilterDefaultKeepsAll(t *testing.T) { logger := slog.New(slog.NewTextHandler(io.Discard, nil)) c, err := NewSystemdCollector(logger) @@ -132,7 +133,7 @@ func TestSystemdSummary(t *testing.T) { } } -func testSummaryHelper(t *testing.T, state string, actual float64, expected float64) { +func testSummaryHelper(t *testing.T, state string, actual, expected float64) { if actual != expected { t.Errorf("Summary mode didn't count %s jobs correctly. Actual: %f, expected: %f", state, actual, expected) } diff --git a/collector/tapestats_linux.go b/collector/tapestats_linux.go index e195ce1c51..4ed617f7c8 100644 --- a/collector/tapestats_linux.go +++ b/collector/tapestats_linux.go @@ -26,9 +26,7 @@ import ( "github.com/prometheus/procfs/sysfs" ) -var ( - ignoredTapeDevices = kingpin.Flag("collector.tapestats.ignored-devices", "Regexp of devices to ignore for tapestats.").Default("^$").String() -) +var ignoredTapeDevices = kingpin.Flag("collector.tapestats.ignored-devices", "Regexp of devices to ignore for tapestats.").Default("^$").String() type tapestatsCollector struct { ignoredDevicesPattern *regexp.Regexp @@ -53,7 +51,7 @@ func init() { // NewTapestatsCollector returns a new Collector exposing tape device stats. // Docs from https://www.kernel.org/doc/html/latest/scsi/st.html#sysfs-and-statistics-for-tape-devices func NewTapestatsCollector(logger *slog.Logger) (Collector, error) { - var tapeLabelNames = []string{"device"} + tapeLabelNames := []string{"device"} fs, err := sysfs.NewFS(*sysPath) if err != nil { diff --git a/collector/tcpstat_linux_test.go b/collector/tcpstat_linux_test.go index 8a56af9ccd..f4259a78d9 100644 --- a/collector/tcpstat_linux_test.go +++ b/collector/tcpstat_linux_test.go @@ -84,5 +84,4 @@ func Test_parseTCPStats(t *testing.T) { if want, got := 22, int(tcpStats[tcpRxQueuedBytes]); want != got { t.Errorf("want tcpstat number of bytes in rx queue %d, got %d", want, got) } - } diff --git a/collector/thermal_darwin.go b/collector/thermal_darwin.go index c55b9b2845..fabd0e50a8 100644 --- a/collector/thermal_darwin.go +++ b/collector/thermal_darwin.go @@ -113,13 +113,13 @@ func (c *thermCollector) Update(ch chan<- prometheus.Metric) error { if err != nil { return err } - if value, ok := cpuPowerStatus[(string(C.kIOPMCPUPowerLimitSchedulerTimeKey))]; ok { + if value, ok := cpuPowerStatus[string(C.kIOPMCPUPowerLimitSchedulerTimeKey)]; ok { ch <- c.cpuSchedulerLimit.mustNewConstMetric(float64(value) / 100.0) } - if value, ok := cpuPowerStatus[(string(C.kIOPMCPUPowerLimitProcessorCountKey))]; ok { + if value, ok := cpuPowerStatus[string(C.kIOPMCPUPowerLimitProcessorCountKey)]; ok { ch <- c.cpuAvailableCPU.mustNewConstMetric(float64(value)) } - if value, ok := cpuPowerStatus[(string(C.kIOPMCPUPowerLimitProcessorSpeedKey))]; ok { + if value, ok := cpuPowerStatus[string(C.kIOPMCPUPowerLimitProcessorSpeedKey)]; ok { ch <- c.cpuSpeedLimit.mustNewConstMetric(float64(value) / 100.0) } diff --git a/collector/thermal_darwin_arm64.go b/collector/thermal_darwin_arm64.go index 24558a1c9d..85a76eea4e 100644 --- a/collector/thermal_darwin_arm64.go +++ b/collector/thermal_darwin_arm64.go @@ -104,7 +104,7 @@ func (c *thermCollector) updateTemperatures(ch chan<- prometheus.Metric) error { for i := 0; i < int(count); i++ { service := C.CFArrayGetValueAtIndex(services, C.CFIndex(i)) - event := C.IOHIDServiceClientCopyEvent((C.IOHIDServiceClientRef)(service), C.kIOHIDEventTypeTemperature, 0, 0) + event := C.IOHIDServiceClientCopyEvent(C.IOHIDServiceClientRef(service), C.kIOHIDEventTypeTemperature, 0, 0) if event == nil { continue } @@ -118,10 +118,10 @@ func (c *thermCollector) updateTemperatures(ch chan<- prometheus.Metric) error { continue } - nameRef := C.IOHIDServiceClientCopyProperty((C.IOHIDServiceClientRef)(service), cfProdKey) + nameRef := C.IOHIDServiceClientCopyProperty(C.IOHIDServiceClientRef(service), cfProdKey) name := "Unknown" if nameRef != 0 { - name = cfStringToString((C.CFStringRef)(nameRef)) + name = cfStringToString(C.CFStringRef(nameRef)) C.CFRelease(C.CFTypeRef(nameRef)) } diff --git a/collector/thermal_zone_linux.go b/collector/thermal_zone_linux.go index c7c58c29b3..ea6c53252a 100644 --- a/collector/thermal_zone_linux.go +++ b/collector/thermal_zone_linux.go @@ -26,8 +26,10 @@ import ( "github.com/prometheus/procfs/sysfs" ) -const coolingDevice = "cooling_device" -const thermalZone = "thermal_zone" +const ( + coolingDevice = "cooling_device" + thermalZone = "thermal_zone" +) type thermalZoneCollector struct { fs sysfs.FS diff --git a/collector/timex.go b/collector/timex.go index 6494726ef7..ddb8e66c9c 100644 --- a/collector/timex.go +++ b/collector/timex.go @@ -163,7 +163,7 @@ func NewTimexCollector(logger *slog.Logger) (Collector, error) { func (c *timexCollector) Update(ch chan<- prometheus.Metric) error { var syncStatus float64 var divisor float64 - var timex = new(unix.Timex) + timex := new(unix.Timex) status, err := unix.Adjtimex(timex) if err != nil { diff --git a/collector/udp_queues_linux.go b/collector/udp_queues_linux.go index 0ebd930098..e29a0f3189 100644 --- a/collector/udp_queues_linux.go +++ b/collector/udp_queues_linux.go @@ -55,7 +55,6 @@ func NewUDPqueuesCollector(logger *slog.Logger) (Collector, error) { } func (c *udpQueuesCollector) Update(ch chan<- prometheus.Metric) error { - s4, errIPv4 := c.fs.NetUDPSummary() if errIPv4 == nil { ch <- prometheus.MustNewConstMetric(c.desc, prometheus.GaugeValue, float64(s4.TxQueueLength), "tx", "v4") diff --git a/collector/uname_bsd.go b/collector/uname_bsd.go index 07f7aca063..dc14b26068 100644 --- a/collector/uname_bsd.go +++ b/collector/uname_bsd.go @@ -43,7 +43,7 @@ func getUname() (uname, error) { // parseHostNameAndDomainName for FreeBSD,OpenBSD,Darwin. // Attempts to emulate what happens in the Linux uname calls since these OS doesn't have a Domainname. -func parseHostNameAndDomainName(utsname unix.Utsname) (hostname string, domainname string) { +func parseHostNameAndDomainName(utsname unix.Utsname) (hostname, domainname string) { nodename := unix.ByteSliceToString(utsname.Nodename[:]) split := strings.SplitN(nodename, ".", 2) diff --git a/collector/vmstat_linux.go b/collector/vmstat_linux.go index 987aebe9eb..3303135a23 100644 --- a/collector/vmstat_linux.go +++ b/collector/vmstat_linux.go @@ -32,9 +32,7 @@ const ( vmStatSubsystem = "vmstat" ) -var ( - vmStatFields = kingpin.Flag("collector.vmstat.fields", "Regexp of fields to return for vmstat collector.").Default("^(oom_kill|pgpg|pswp|pg.*fault).*").String() -) +var vmStatFields = kingpin.Flag("collector.vmstat.fields", "Regexp of fields to return for vmstat collector.").Default("^(oom_kill|pgpg|pswp|pg.*fault).*").String() type vmStatCollector struct { fieldPattern *regexp.Regexp diff --git a/collector/wifi_linux.go b/collector/wifi_linux.go index 8f482c76ce..a79fc76baa 100644 --- a/collector/wifi_linux.go +++ b/collector/wifi_linux.go @@ -32,9 +32,7 @@ type wifiCollector struct { logger *slog.Logger } -var ( - collectorWifi = kingpin.Flag("collector.wifi.fixtures", "test fixtures to use for wifi collector metrics").Default("").String() -) +var collectorWifi = kingpin.Flag("collector.wifi.fixtures", "test fixtures to use for wifi collector metrics").Default("").String() func init() { registerCollector("wifi", defaultDisabled, NewWifiCollector) diff --git a/collector/xfs_linux.go b/collector/xfs_linux.go index b5157849bc..b156a15dea 100644 --- a/collector/xfs_linux.go +++ b/collector/xfs_linux.go @@ -66,9 +66,7 @@ func (c *xfsCollector) updateXFSStats(ch chan<- prometheus.Metric, s *xfs.Stats) subsystem = "xfs" ) - var ( - labels = []string{"device"} - ) + labels := []string{"device"} // Metric names and descriptions are sourced from: // http://xfs.org/index.php/Runtime_Stats. diff --git a/collector/zfs_linux.go b/collector/zfs_linux.go index 9e968f73fe..dca4d6051c 100644 --- a/collector/zfs_linux.go +++ b/collector/zfs_linux.go @@ -171,7 +171,7 @@ func (c *zfsCollector) updatePoolStats(ch chan<- prometheus.Metric) error { return errZFSNotAvailable } - err = c.parsePoolObjsetFile(file, zpoolPath, func(poolName string, datasetName string, s zfsSysctl, v uint64) { + err = c.parsePoolObjsetFile(file, zpoolPath, func(poolName, datasetName string, s zfsSysctl, v uint64) { ch <- c.constPoolObjsetMetric(poolName, datasetName, s, v) }) file.Close() @@ -198,7 +198,7 @@ func (c *zfsCollector) updatePoolStats(ch chan<- prometheus.Metric) error { return errZFSNotAvailable } - err = c.parsePoolStateFile(file, zpoolPath, func(poolName string, stateName string, isActive uint64) { + err = c.parsePoolStateFile(file, zpoolPath, func(poolName, stateName string, isActive uint64) { ch <- c.constPoolStateMetric(poolName, stateName, isActive) }) @@ -262,7 +262,7 @@ func (c *zfsCollector) parsePoolProcfsFile(reader io.Reader, zpoolPath string, h line := strings.Fields(scanner.Text()) if !parseLine && len(line) >= 12 && line[0] == "nread" { - //Start parsing from here. + // Start parsing from here. parseLine = true fields = make([]string, len(line)) copy(fields, line) @@ -398,7 +398,7 @@ func (c *zfsCollector) constPoolMetric(poolName string, sysctl zfsSysctl, value ) } -func (c *zfsCollector) constPoolObjsetMetric(poolName string, datasetName string, sysctl zfsSysctl, value uint64) prometheus.Metric { +func (c *zfsCollector) constPoolObjsetMetric(poolName, datasetName string, sysctl zfsSysctl, value uint64) prometheus.Metric { metricName := sysctl.metricName() return prometheus.MustNewConstMetric( @@ -415,7 +415,7 @@ func (c *zfsCollector) constPoolObjsetMetric(poolName string, datasetName string ) } -func (c *zfsCollector) constPoolStateMetric(poolName string, stateName string, isActive uint64) prometheus.Metric { +func (c *zfsCollector) constPoolStateMetric(poolName, stateName string, isActive uint64) prometheus.Metric { return prometheus.MustNewConstMetric( prometheus.NewDesc( prometheus.BuildFQName(namespace, "zfs_zpool", "state"), diff --git a/collector/zfs_linux_test.go b/collector/zfs_linux_test.go index 29b9ede2d3..150f4a0ab0 100644 --- a/collector/zfs_linux_test.go +++ b/collector/zfs_linux_test.go @@ -35,7 +35,6 @@ func TestArcstatsParsing(t *testing.T) { handlerCalled := false err = c.parseProcfsFile(arcstatsFile, "arcstats", func(s zfsSysctl, v any) { - if s == zfsSysctl("kstat.zfs.misc.arcstats.hits") { if v.(uint64) != 8772612 { t.Fatalf("Incorrect value parsed from procfs data") @@ -72,7 +71,6 @@ func TestZfetchstatsParsing(t *testing.T) { handlerCalled := false err = c.parseProcfsFile(zfetchstatsFile, "zfetchstats", func(s zfsSysctl, v any) { - if s != zfsSysctl("kstat.zfs.misc.zfetchstats.hits") { return } @@ -82,9 +80,7 @@ func TestZfetchstatsParsing(t *testing.T) { if v.(uint64) != 7067992 { t.Fatalf("Incorrect value parsed from procfs data") } - }) - if err != nil { t.Fatal(err) } @@ -108,7 +104,6 @@ func TestZilParsing(t *testing.T) { handlerCalled := false err = c.parseProcfsFile(zilFile, "zil", func(s zfsSysctl, v any) { - if s != zfsSysctl("kstat.zfs.misc.zil.zil_commit_count") { return } @@ -118,9 +113,7 @@ func TestZilParsing(t *testing.T) { if v.(uint64) != 10 { t.Fatalf("Incorrect value parsed from procfs data") } - }) - if err != nil { t.Fatal(err) } @@ -144,7 +137,6 @@ func TestVdevCacheStatsParsing(t *testing.T) { handlerCalled := false err = c.parseProcfsFile(vdevCacheStatsFile, "vdev_cache_stats", func(s zfsSysctl, v any) { - if s != zfsSysctl("kstat.zfs.misc.vdev_cache_stats.delegations") { return } @@ -154,9 +146,7 @@ func TestVdevCacheStatsParsing(t *testing.T) { if v.(uint64) != 40 { t.Fatalf("Incorrect value parsed from procfs data") } - }) - if err != nil { t.Fatal(err) } @@ -180,7 +170,6 @@ func TestXuioStatsParsing(t *testing.T) { handlerCalled := false err = c.parseProcfsFile(xuioStatsFile, "xuio_stats", func(s zfsSysctl, v any) { - if s != zfsSysctl("kstat.zfs.misc.xuio_stats.onloan_read_buf") { return } @@ -190,9 +179,7 @@ func TestXuioStatsParsing(t *testing.T) { if v.(uint64) != 32 { t.Fatalf("Incorrect value parsed from procfs data") } - }) - if err != nil { t.Fatal(err) } @@ -216,7 +203,6 @@ func TestFmParsing(t *testing.T) { handlerCalled := false err = c.parseProcfsFile(fmFile, "fm", func(s zfsSysctl, v any) { - if s != zfsSysctl("kstat.zfs.misc.fm.erpt-dropped") { return } @@ -226,9 +212,7 @@ func TestFmParsing(t *testing.T) { if v.(uint64) != 18 { t.Fatalf("Incorrect value parsed from procfs data") } - }) - if err != nil { t.Fatal(err) } @@ -252,7 +236,6 @@ func TestDmuTxParsing(t *testing.T) { handlerCalled := false err = c.parseProcfsFile(dmuTxFile, "dmu_tx", func(s zfsSysctl, v any) { - if s != zfsSysctl("kstat.zfs.misc.dmu_tx.dmu_tx_assigned") { return } @@ -262,9 +245,7 @@ func TestDmuTxParsing(t *testing.T) { if v.(uint64) != 3532844 { t.Fatalf("Incorrect value parsed from procfs data") } - }) - if err != nil { t.Fatal(err) } @@ -302,7 +283,6 @@ func TestZpoolParsing(t *testing.T) { if v != 1884160 && v != 2826240 { t.Fatalf("Incorrect value parsed from procfs data %v", v) } - }) file.Close() if err != nil { @@ -347,7 +327,7 @@ func TestZpoolObjsetParsingWithSpace(t *testing.T) { } handlerCalled = false - err = c.parsePoolObjsetFile(file, test.path, func(_ string, datasetName string, _ zfsSysctl, _ uint64) { + err = c.parsePoolObjsetFile(file, test.path, func(_, datasetName string, _ zfsSysctl, _ uint64) { handlerCalled = true if test.expectedDataset != datasetName { t.Fatalf("Incorrectly parsed dataset name: expected: '%s', got: '%s'", test.expectedDataset, datasetName) @@ -381,7 +361,7 @@ func TestZpoolObjsetParsing(t *testing.T) { t.Fatal(err) } - err = c.parsePoolObjsetFile(file, zpoolPath, func(_ string, _ string, s zfsSysctl, v uint64) { + err = c.parsePoolObjsetFile(file, zpoolPath, func(_, _ string, s zfsSysctl, v uint64) { if s != zfsSysctl("kstat.zfs.misc.objset.writes") { return } @@ -391,7 +371,6 @@ func TestZpoolObjsetParsing(t *testing.T) { if v != 0 && v != 4 && v != 10 { t.Fatalf("Incorrect value parsed from procfs data %v", v) } - }) file.Close() if err != nil { @@ -417,7 +396,6 @@ func TestAbdstatsParsing(t *testing.T) { handlerCalled := false err = c.parseProcfsFile(abdstatsFile, "abdstats", func(s zfsSysctl, v any) { - if s != zfsSysctl("kstat.zfs.misc.abdstats.linear_data_size") { return } @@ -427,9 +405,7 @@ func TestAbdstatsParsing(t *testing.T) { if v.(uint64) != 223232 { t.Fatalf("Incorrect value parsed from procfs abdstats data") } - }) - if err != nil { t.Fatal(err) } @@ -453,7 +429,6 @@ func TestDbufstatsParsing(t *testing.T) { handlerCalled := false err = c.parseProcfsFile(dbufstatsFile, "dbufstats", func(s zfsSysctl, v any) { - if s != zfsSysctl("kstat.zfs.misc.dbufstats.hash_hits") { return } @@ -463,9 +438,7 @@ func TestDbufstatsParsing(t *testing.T) { if v.(uint64) != 108807 { t.Fatalf("Incorrect value parsed from procfs dbufstats data") } - }) - if err != nil { t.Fatal(err) } @@ -489,7 +462,6 @@ func TestDnodestatsParsing(t *testing.T) { handlerCalled := false err = c.parseProcfsFile(dnodestatsFile, "dnodestats", func(s zfsSysctl, v any) { - if s != zfsSysctl("kstat.zfs.misc.dnodestats.dnode_hold_alloc_hits") { return } @@ -499,9 +471,7 @@ func TestDnodestatsParsing(t *testing.T) { if v.(uint64) != 37617 { t.Fatalf("Incorrect value parsed from procfs dnodestats data") } - }) - if err != nil { t.Fatal(err) } @@ -525,7 +495,6 @@ func TestVdevMirrorstatsParsing(t *testing.T) { handlerCalled := false err = c.parseProcfsFile(vdevMirrorStatsFile, "vdev_mirror_stats", func(s zfsSysctl, v any) { - if s != zfsSysctl("kstat.zfs.misc.vdev_mirror_stats.preferred_not_found") { return } @@ -535,9 +504,7 @@ func TestVdevMirrorstatsParsing(t *testing.T) { if v.(uint64) != 94 { t.Fatalf("Incorrect value parsed from procfs vdev_mirror_stats data") } - }) - if err != nil { t.Fatal(err) } @@ -565,7 +532,7 @@ func TestPoolStateParsing(t *testing.T) { t.Fatal(err) } - err = c.parsePoolStateFile(file, zpoolPath, func(poolName string, stateName string, isActive uint64) { + err = c.parsePoolStateFile(file, zpoolPath, func(poolName, stateName string, isActive uint64) { handlerCalled = true if poolName == "pool1" { @@ -592,7 +559,6 @@ func TestPoolStateParsing(t *testing.T) { t.Fatalf("Incorrect parsed value for suspended state") } } - }) file.Close() if err != nil { @@ -602,5 +568,4 @@ func TestPoolStateParsing(t *testing.T) { if !handlerCalled { t.Fatal("Zpool parsing handler was not called for some expected sysctls") } - } diff --git a/collector/zoneinfo_linux.go b/collector/zoneinfo_linux.go index 0b40fd3c59..78091b1959 100644 --- a/collector/zoneinfo_linux.go +++ b/collector/zoneinfo_linux.go @@ -92,6 +92,7 @@ func (c *zoneinfoCollector) Update(ch chan<- prometheus.Metric) error { } return nil } + func createGaugeMetricDescriptions() map[string]*prometheus.Desc { return map[string]*prometheus.Desc{ "NrFreePages": prometheus.NewDesc( @@ -199,8 +200,8 @@ func createGaugeMetricDescriptions() map[string]*prometheus.Desc { "Number of shmem pages (included tmpfs/GEM pages)", []string{"node", "zone"}, nil), } - } + func createCounterMetricDescriptions() map[string]*prometheus.Desc { return map[string]*prometheus.Desc{ "NrDirtied": prometheus.NewDesc( diff --git a/node_exporter.go b/node_exporter.go index ac990dee29..fe3ece57f3 100644 --- a/node_exporter.go +++ b/node_exporter.go @@ -96,7 +96,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { // In exclude mode, filtered collectors = enabled - excludeed. f := []string{} for _, c := range h.enabledCollectors { - if (slices.Index(excludes, c)) == -1 { + if slices.Index(excludes, c) == -1 { f = append(f, c) } } diff --git a/node_exporter_test.go b/node_exporter_test.go index 0d6b41e4d5..4938475e7b 100644 --- a/node_exporter_test.go +++ b/node_exporter_test.go @@ -26,9 +26,7 @@ import ( "github.com/prometheus/procfs" ) -var ( - binary = filepath.Join(os.Getenv("GOPATH"), "bin/node_exporter") -) +var binary = filepath.Join(os.Getenv("GOPATH"), "bin/node_exporter") const ( address = "localhost:19100" @@ -91,10 +89,10 @@ func TestHandlingOfDuplicatedMetrics(t *testing.T) { defer os.RemoveAll(dir) content := []byte("dummy_metric 1\n") - if err := os.WriteFile(filepath.Join(dir, "a.prom"), content, 0600); err != nil { + if err := os.WriteFile(filepath.Join(dir, "a.prom"), content, 0o600); err != nil { t.Fatal(err) } - if err := os.WriteFile(filepath.Join(dir, "b.prom"), content, 0600); err != nil { + if err := os.WriteFile(filepath.Join(dir, "b.prom"), content, 0o600); err != nil { t.Fatal(err) } From baf644aaa87148ab0068cd334730a6c9737cfb46 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Wed, 7 Oct 2026 11:35:50 +0200 Subject: [PATCH 45/87] Bump vmactions/netbsd-vm (#3847) Update vmactions/netbsd-vm and update fixtures. Signed-off-by: Ben Kochie --- .github/workflows/bsd.yml | 2 +- collector/fixtures/e2e-output-netbsd.txt | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 5ce96a5f32..9cd2f91901 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -133,7 +133,7 @@ jobs: with: persist-credentials: false - name: test-e2e - uses: vmactions/netbsd-vm@e7ac71b97abbe8437cec8859a5acf72dfa6a8be0 # v1.4.5 + uses: vmactions/netbsd-vm@c8a0d7ddb84619a7a8cc4e652efa7950b3fd9f92 # v1.5.2 with: copyback: false envs: 'GO_VERSION GNU_TAR_VERSION' diff --git a/collector/fixtures/e2e-output-netbsd.txt b/collector/fixtures/e2e-output-netbsd.txt index 2419e8578d..6cc7882e9f 100644 --- a/collector/fixtures/e2e-output-netbsd.txt +++ b/collector/fixtures/e2e-output-netbsd.txt @@ -178,8 +178,12 @@ node_xfrm_out_state_proto_error_packets_total 4542 # HELP node_xfrm_out_state_seq_error_packets_total Sequence error i.e. Sequence number overflow # TYPE node_xfrm_out_state_seq_error_packets_total counter node_xfrm_out_state_seq_error_packets_total 543 +# HELP process_max_fds Maximum number of open file descriptors. +# TYPE process_max_fds gauge # HELP process_open_fds Number of open file descriptors. # TYPE process_open_fds gauge +# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes. +# TYPE process_virtual_memory_max_bytes gauge # HELP promhttp_metric_handler_errors_total Total number of internal errors encountered by the promhttp metric handler. # TYPE promhttp_metric_handler_errors_total counter promhttp_metric_handler_errors_total{cause="encoding"} 0 From 25fbb7c67ee365afe89e42c3986964d5a2140bc8 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Wed, 7 Oct 2026 11:53:50 +0200 Subject: [PATCH 46/87] Bump minimum Go version (#3846) * Bump minimum Go version Update to Go 1.26 and fix linting issues. Signed-off-by: Ben Kochie * Bump promtool version. Signed-off-by: Ben Kochie --------- Signed-off-by: Ben Kochie --- .github/workflows/ci.yml | 4 ++-- Makefile | 2 +- collector/netstat_descs_drift_test.go | 3 +-- go.mod | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43aaf68b61..861450dbdc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,8 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - - run: go mod download - - run: make + - run: make GO_ONLY=1 SKIP_GOLANGCI_LINT=1 + - run: git diff --exit-code test_go_arm: name: Go ARM tests diff --git a/Makefile b/Makefile index 891d54ce65..9f04802144 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ all:: include Makefile.common -PROMTOOL_VERSION ?= 2.30.0 +PROMTOOL_VERSION ?= 3.15.0 PROMTOOL_URL ?= https://github.com/prometheus/prometheus/releases/download/v$(PROMTOOL_VERSION)/prometheus-$(PROMTOOL_VERSION).$(GO_BUILD_PLATFORM).tar.gz PROMTOOL ?= $(FIRST_GOPATH)/bin/promtool E2E_EXTRA_FLAGS ?= diff --git a/collector/netstat_descs_drift_test.go b/collector/netstat_descs_drift_test.go index 8be8ee72b7..d79d7310b9 100644 --- a/collector/netstat_descs_drift_test.go +++ b/collector/netstat_descs_drift_test.go @@ -49,8 +49,7 @@ func TestNetStatDescsInSync(t *testing.T) { s6.Ip6, s6.Icmp6, s6.Udp6, s6.UdpLite6, } { tt := reflect.TypeOf(v) - for i := 0; i < tt.NumField(); i++ { - f := tt.Field(i) + for f := range tt.Fields() { if f.Type != reflect.TypeFor[*float64]() { continue } diff --git a/go.mod b/go.mod index 051e8f2be2..85357dcfb4 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/prometheus/node_exporter -go 1.25.0 +go 1.26.0 require ( github.com/alecthomas/kingpin/v2 v2.4.0 From 15f45ee82a4cfbc235b7fa93126e21d35e1ef863 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Oct 2026 12:03:41 +0200 Subject: [PATCH 47/87] build(deps): bump the prometheus group across 1 directory with 3 updates (#3835) Bumps the prometheus group with 3 updates in the / directory: [github.com/prometheus/client_model](https://github.com/prometheus/client_model), [github.com/prometheus/common](https://github.com/prometheus/common) and [github.com/prometheus/exporter-toolkit](https://github.com/prometheus/exporter-toolkit). Updates `github.com/prometheus/client_model` from 0.6.2 to 0.6.3 - [Release notes](https://github.com/prometheus/client_model/releases) - [Commits](https://github.com/prometheus/client_model/compare/v0.6.2...v0.6.3) Updates `github.com/prometheus/common` from 0.70.1 to 0.72.0 - [Release notes](https://github.com/prometheus/common/releases) - [Changelog](https://github.com/prometheus/common/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/common/compare/v0.70.1...v0.72.0) Updates `github.com/prometheus/exporter-toolkit` from 0.19.0 to 0.20.0 - [Release notes](https://github.com/prometheus/exporter-toolkit/releases) - [Commits](https://github.com/prometheus/exporter-toolkit/compare/v0.19.0...v0.20.0) --- updated-dependencies: - dependency-name: github.com/prometheus/client_model dependency-version: 0.6.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: prometheus - dependency-name: github.com/prometheus/common dependency-version: 0.72.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prometheus - dependency-name: github.com/prometheus/exporter-toolkit dependency-version: 0.20.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prometheus ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 20 ++++++++++---------- go.sum | 49 ++++++++++++++++++++++++------------------------- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/go.mod b/go.mod index 85357dcfb4..7e263d62a8 100644 --- a/go.mod +++ b/go.mod @@ -22,12 +22,12 @@ require ( github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 github.com/prometheus-community/go-runit v0.1.0 github.com/prometheus/client_golang v1.24.1 - github.com/prometheus/client_model v0.6.2 - github.com/prometheus/common v0.70.1 - github.com/prometheus/exporter-toolkit v0.19.0 + github.com/prometheus/client_model v0.6.3 + github.com/prometheus/common v0.72.0 + github.com/prometheus/exporter-toolkit v0.20.0 github.com/prometheus/procfs v0.22.0 github.com/safchain/ethtool v0.7.0 - golang.org/x/sys v0.47.0 + golang.org/x/sys v0.48.0 howett.net/plist v1.0.1 ) @@ -53,11 +53,11 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - golang.org/x/crypto v0.54.0 // indirect - golang.org/x/net v0.57.0 // indirect - golang.org/x/oauth2 v0.36.0 // indirect - golang.org/x/sync v0.22.0 // indirect - golang.org/x/text v0.40.0 // indirect + golang.org/x/crypto v0.57.0 // indirect + golang.org/x/net v0.59.0 // indirect + golang.org/x/oauth2 v0.37.0 // indirect + golang.org/x/sync v0.23.0 // indirect + golang.org/x/text v0.42.0 // indirect golang.org/x/time v0.15.0 // indirect - google.golang.org/protobuf v1.36.11 // indirect + google.golang.org/protobuf v1.36.12 // indirect ) diff --git a/go.sum b/go.sum index b165d23162..447b61d477 100644 --- a/go.sum +++ b/go.sum @@ -17,7 +17,6 @@ github.com/coreos/go-systemd/v22 v22.7.0/go.mod h1:xNUYtjHu2EDXbsxz1i41wouACIwT7 github.com/cyphar/filepath-securejoin v0.6.1 h1:5CeZ1jPXEiYt3+Z6zqprSAgSWiggmpVyciv8syjIpVE= github.com/cyphar/filepath-securejoin v0.6.1/go.mod h1:A8hd4EnAeyujCJRrICiOWqjS1AX0a9kM5XL+NwKoYSc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dennwc/btrfs v0.0.0-20260222081608-edfb8b9e4f55 h1:VAnGuI8RNnP8vHqCn8X1O63TexAv+QjMqffBdkLbYKU= github.com/dennwc/btrfs v0.0.0-20260222081608-edfb8b9e4f55/go.mod h1:Kn6RQo4OP1ZEoLB3uldDJabFcf72VgDRInxEqLEo8OE= @@ -70,7 +69,6 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/opencontainers/selinux v1.15.1 h1:ERxeh5caJvCzNAKdI8WQbJmB1LDTn4BuaAg8wihLBpA= github.com/opencontainers/selinux v1.15.1/go.mod h1:LenyElirjUHszfxrjuFqC85HIeXZKumHcKMQtnaDlQQ= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= @@ -78,12 +76,12 @@ github.com/prometheus-community/go-runit v0.1.0 h1:uTWEj/Fn2RoLdfg/etSqwzgYNOYPr github.com/prometheus-community/go-runit v0.1.0/go.mod h1:AvJ9Jo3gAFu2lbM4+qfjdpq30FfiLDJZKbQ015u08IQ= github.com/prometheus/client_golang v1.24.1 h1:JnJkREXzWxUdCuPFpIWZiPispT9xVV59uiuyR2bPlnU= github.com/prometheus/client_golang v1.24.1/go.mod h1:F+oSRECHg4sse5ucfYpYDeIv/hu68Zo0uoHKetWnzcE= -github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= -github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.70.1 h1:1HvjP4D5oL3t8RsPlwxA9onvvStjtIHYE5XuuwOi/PY= -github.com/prometheus/common v0.70.1/go.mod h1:VdFUQDMZK3VLkurFUVhia6uys/0suUp86TJz5qbJRhc= -github.com/prometheus/exporter-toolkit v0.19.0 h1:JljWCzE5naAiZ7Ukeb8PwjNbU+WwISuW0ktgdXMnMhc= -github.com/prometheus/exporter-toolkit v0.19.0/go.mod h1:kOoEK/7wbe2Ns33l7wYHOXDZAZ/XGLyJqoGwmJxK+QU= +github.com/prometheus/client_model v0.6.3 h1:O0jaTVAYNxTHYInEPFJt5I3+sN8zqBtVMPTB1qyxiEo= +github.com/prometheus/client_model v0.6.3/go.mod h1:gpN5P9S7Rr6Yr92PiQ+Ixvhf6JZEkF1dnxsYL2aPBEM= +github.com/prometheus/common v0.72.0 h1:tAYsE+sPJxIncDAobm4H5aQjmox9ZxEIIqPbiffa8G4= +github.com/prometheus/common v0.72.0/go.mod h1:77NWqAQ2tXT7BIK40qjJdw5Acrsrg1TlHAnsQi3i6mk= +github.com/prometheus/exporter-toolkit v0.20.0 h1:hz3g2aPcq3mXlQSt1MGjj2rwVk1wtRalF+/FjYxFRkI= +github.com/prometheus/exporter-toolkit v0.20.0/go.mod h1:gIIY0Mw0ci1wgYscdeMqVh6FUPYJca549eOkE39nU64= github.com/prometheus/procfs v0.22.0 h1:6q9+/JL9IKAPbCmBrv9n5O5Ty3NKnciV5X7YGw0oics= github.com/prometheus/procfs v0.22.0/go.mod h1:CvmFr/GVhIjIvWJZW3tgkODBQMRIf0EyWMQLHCHab58= github.com/safchain/ethtool v0.7.0 h1:rlJzfDetsVvT61uz8x1YIcFn12akMfuPulHtZjtb7Is= @@ -99,8 +97,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= +github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= @@ -111,28 +109,29 @@ go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= -golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw= -golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk= -golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE= -golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU= -golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= -golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= -golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= -golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= +go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= +golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M= +golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA= +golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues= +golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= +golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98= +golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58= +golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= +golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211031064116-611d5d643895/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= -golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs= -golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY= +golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= +golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= +golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= -google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= -google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= +google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= howett.net/plist v1.0.1 h1:37GdZ8tP09Q35o9ych3ehygcsL+HqKSwzctveSlarvM= howett.net/plist v1.0.1/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= From 1271bc244266457fd225dcef9b8a33641b582c64 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Oct 2026 15:19:56 +0200 Subject: [PATCH 48/87] build(deps): bump github.com/beevik/ntp from 1.5.0 to 1.6.0 (#3836) Bumps [github.com/beevik/ntp](https://github.com/beevik/ntp) from 1.5.0 to 1.6.0. - [Release notes](https://github.com/beevik/ntp/releases) - [Changelog](https://github.com/beevik/ntp/blob/main/RELEASE_NOTES.md) - [Commits](https://github.com/beevik/ntp/compare/v1.5.0...v1.6.0) --- updated-dependencies: - dependency-name: github.com/beevik/ntp dependency-version: 1.6.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 7e263d62a8..8f3434538c 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.26.0 require ( github.com/alecthomas/kingpin/v2 v2.4.0 - github.com/beevik/ntp v1.5.0 + github.com/beevik/ntp v1.6.0 github.com/coreos/go-systemd/v22 v22.7.0 github.com/dennwc/btrfs v0.0.0-20260222081608-edfb8b9e4f55 github.com/ema/qdisc v1.0.0 diff --git a/go.sum b/go.sum index 447b61d477..ebedae9a58 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjH github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE= github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b h1:mimo19zliBX/vSQ6PWWSL9lK8qwHozUj03+zLoEB8O0= github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b/go.mod h1:fvzegU4vN3H1qMT+8wDmzjAcDONcgo2/SZ/TyfdUOFs= -github.com/beevik/ntp v1.5.0 h1:y+uj/JjNwlY2JahivxYvtmv4ehfi3h74fAuABB9ZSM4= -github.com/beevik/ntp v1.5.0/go.mod h1:mJEhBrwT76w9D+IfOEGvuzyuudiW9E52U2BaTrMOYow= +github.com/beevik/ntp v1.6.0 h1:bW359Vvw6bicGhKsVi+ZDLMsMYzb2ohUpLaF/Juv0k8= +github.com/beevik/ntp v1.6.0/go.mod h1:VTAbDFySkuc8cQiAYHhXslAHjJdenICebskhYqBWC4k= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= From 638ec72c3ae829810b0617b6ba21626752a50237 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Sat, 10 Oct 2026 08:49:03 +0200 Subject: [PATCH 49/87] Update common Prometheus files (#3809) Signed-off-by: prombot --- .github/workflows/approve-workflows.yml | 2 +- Makefile.common | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/approve-workflows.yml b/.github/workflows/approve-workflows.yml index f372012f2b..697118dfc1 100644 --- a/.github/workflows/approve-workflows.yml +++ b/.github/workflows/approve-workflows.yml @@ -22,6 +22,6 @@ jobs: contents: read pull-requests: write steps: - - uses: prometheus/promci/approve_workflows@370e8c15dcec50043cbe66f2f34633d9efc0a190 # v0.9.0 + - uses: prometheus/promci/approve_workflows@872d318d090d73df349cb6ed90aadd072ca478f7 # v0.10.0 with: github_token: ${{ github.token }} diff --git a/Makefile.common b/Makefile.common index 5e0edd1a5b..efc2730c16 100644 --- a/Makefile.common +++ b/Makefile.common @@ -61,7 +61,7 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_ SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v2.13.1 +GOLANGCI_LINT_VERSION ?= v2.14.0 GOLANGCI_FMT_OPTS ?= # golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64. # windows isn't included here because of the path separator being different. From 1a5616a59965a6a1ad06b167330395433c59e04e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Oct 2026 10:05:54 +0200 Subject: [PATCH 50/87] build(deps): bump github.com/prometheus/client_golang from 1.24.1 to 1.25.0 in the prometheus group (#3854) Bumps the prometheus group with 1 update: [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang). Updates `github.com/prometheus/client_golang` from 1.24.1 to 1.25.0 - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/v1.25.0/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.24.1...v1.25.0) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-version: 1.25.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prometheus ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 8f3434538c..8056bf3e1f 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/opencontainers/selinux v1.15.1 github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 github.com/prometheus-community/go-runit v0.1.0 - github.com/prometheus/client_golang v1.24.1 + github.com/prometheus/client_golang v1.25.0 github.com/prometheus/client_model v0.6.3 github.com/prometheus/common v0.72.0 github.com/prometheus/exporter-toolkit v0.20.0 diff --git a/go.sum b/go.sum index ebedae9a58..0f70f1f822 100644 --- a/go.sum +++ b/go.sum @@ -43,8 +43,8 @@ github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2E github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jsimonetti/rtnetlink/v2 v2.2.0 h1:/KfZ310gOAFrXXol5VwnFEt+ucldD/0dsSRZwpHCP9w= github.com/jsimonetti/rtnetlink/v2 v2.2.0/go.mod h1:lbjDHxC+5RJ08lzPeA90Ls2pEoId3F08MoEMlhfHxeI= -github.com/klauspost/compress v1.19.1 h1:VsB4HPswih7mmZ8WleSFQ75c/Ui1M4trX5oAsJnhSlk= -github.com/klauspost/compress v1.19.1/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= +github.com/klauspost/compress v1.20.1 h1:T7kKElXUMXrUJ2E9QhQhxFtcK5rPyLdsGZvdbLMPdiQ= +github.com/klauspost/compress v1.20.1/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lufia/iostat v1.2.1 h1:tnCdZBIglgxD47RyD55kfWQcJMGzO+1QBziSQfesf2k= @@ -74,8 +74,8 @@ github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus-community/go-runit v0.1.0 h1:uTWEj/Fn2RoLdfg/etSqwzgYNOYPrARx1BHUN052tGA= github.com/prometheus-community/go-runit v0.1.0/go.mod h1:AvJ9Jo3gAFu2lbM4+qfjdpq30FfiLDJZKbQ015u08IQ= -github.com/prometheus/client_golang v1.24.1 h1:JnJkREXzWxUdCuPFpIWZiPispT9xVV59uiuyR2bPlnU= -github.com/prometheus/client_golang v1.24.1/go.mod h1:F+oSRECHg4sse5ucfYpYDeIv/hu68Zo0uoHKetWnzcE= +github.com/prometheus/client_golang v1.25.0 h1:cDtW1TcFsMi1RJc8khwCKB4VhzwV04aKqbYtNOXuiK0= +github.com/prometheus/client_golang v1.25.0/go.mod h1:j2X/4/kaQHLPnmyEU8zjmkndo1T317VpCIQEml8LTKk= github.com/prometheus/client_model v0.6.3 h1:O0jaTVAYNxTHYInEPFJt5I3+sN8zqBtVMPTB1qyxiEo= github.com/prometheus/client_model v0.6.3/go.mod h1:gpN5P9S7Rr6Yr92PiQ+Ixvhf6JZEkF1dnxsYL2aPBEM= github.com/prometheus/common v0.72.0 h1:tAYsE+sPJxIncDAobm4H5aQjmox9ZxEIIqPbiffa8G4= From ec12b97885625a7ade058c60f1419e5cda8f6edc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Oct 2026 14:49:05 +0200 Subject: [PATCH 51/87] build(deps): bump github.com/prometheus/common (#3856) Bumps the prometheus group with 1 update: [github.com/prometheus/common](https://github.com/prometheus/common). Updates `github.com/prometheus/common` from 0.72.0 to 0.72.1 - [Release notes](https://github.com/prometheus/common/releases) - [Changelog](https://github.com/prometheus/common/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/common/compare/v0.72.0...v0.72.1) --- updated-dependencies: - dependency-name: github.com/prometheus/common dependency-version: 0.72.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: prometheus ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 12 ++++++------ go.sum | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index 8056bf3e1f..943fb173c3 100644 --- a/go.mod +++ b/go.mod @@ -23,11 +23,11 @@ require ( github.com/prometheus-community/go-runit v0.1.0 github.com/prometheus/client_golang v1.25.0 github.com/prometheus/client_model v0.6.3 - github.com/prometheus/common v0.72.0 + github.com/prometheus/common v0.72.1 github.com/prometheus/exporter-toolkit v0.20.0 github.com/prometheus/procfs v0.22.0 github.com/safchain/ethtool v0.7.0 - golang.org/x/sys v0.48.0 + golang.org/x/sys v0.49.0 howett.net/plist v1.0.1 ) @@ -53,11 +53,11 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.yaml.in/yaml/v2 v2.4.4 // indirect - golang.org/x/crypto v0.57.0 // indirect - golang.org/x/net v0.59.0 // indirect + golang.org/x/crypto v0.58.0 // indirect + golang.org/x/net v0.61.0 // indirect golang.org/x/oauth2 v0.37.0 // indirect - golang.org/x/sync v0.23.0 // indirect - golang.org/x/text v0.42.0 // indirect + golang.org/x/sync v0.24.0 // indirect + golang.org/x/text v0.43.0 // indirect golang.org/x/time v0.15.0 // indirect google.golang.org/protobuf v1.36.12 // indirect ) diff --git a/go.sum b/go.sum index 0f70f1f822..12ea361f53 100644 --- a/go.sum +++ b/go.sum @@ -78,8 +78,8 @@ github.com/prometheus/client_golang v1.25.0 h1:cDtW1TcFsMi1RJc8khwCKB4VhzwV04aKq github.com/prometheus/client_golang v1.25.0/go.mod h1:j2X/4/kaQHLPnmyEU8zjmkndo1T317VpCIQEml8LTKk= github.com/prometheus/client_model v0.6.3 h1:O0jaTVAYNxTHYInEPFJt5I3+sN8zqBtVMPTB1qyxiEo= github.com/prometheus/client_model v0.6.3/go.mod h1:gpN5P9S7Rr6Yr92PiQ+Ixvhf6JZEkF1dnxsYL2aPBEM= -github.com/prometheus/common v0.72.0 h1:tAYsE+sPJxIncDAobm4H5aQjmox9ZxEIIqPbiffa8G4= -github.com/prometheus/common v0.72.0/go.mod h1:77NWqAQ2tXT7BIK40qjJdw5Acrsrg1TlHAnsQi3i6mk= +github.com/prometheus/common v0.72.1 h1:ZAiQed/nk8IIcsdzb2TlJu23NEUDyDLQ9TXTN2WRK6Y= +github.com/prometheus/common v0.72.1/go.mod h1:1IoBY4IRaJnhs2ESjNzjilP1cJ/P8pimGoomq7zRXrA= github.com/prometheus/exporter-toolkit v0.20.0 h1:hz3g2aPcq3mXlQSt1MGjj2rwVk1wtRalF+/FjYxFRkI= github.com/prometheus/exporter-toolkit v0.20.0/go.mod h1:gIIY0Mw0ci1wgYscdeMqVh6FUPYJca549eOkE39nU64= github.com/prometheus/procfs v0.22.0 h1:6q9+/JL9IKAPbCmBrv9n5O5Ty3NKnciV5X7YGw0oics= @@ -111,20 +111,20 @@ go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= -golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M= -golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA= -golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues= -golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= +golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54= +golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w= +golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw= +golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98= golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58= -golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= -golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= +golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211031064116-611d5d643895/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= -golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= -golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= +golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= +golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= +golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= From 37ec35f6981b68c0d7c4191a802d8026064d1866 Mon Sep 17 00:00:00 2001 From: Arun Srinivasan Date: Thu, 15 Oct 2026 23:16:19 +0530 Subject: [PATCH 52/87] collector: add tainted collector for /proc/sys/kernel/tainted (#3745) * collector: add tainted collector for /proc/sys/kernel/tainted Signed-off-by: Arun S * go.mod: bump procfs to pick up KernelTainted() (#844) Signed-off-by: Arun S * go.mod: bump procfs to pick up linux build tag fix (#847) Signed-off-by: Arun S * collector/tainted: use year-less copyright header Co-authored-by: Cursor Signed-off-by: Arun S * collector/tainted: address review feedback and document collector Store procfs.FS on the collector instead of opening it each scrape. Add matching !notainted build tag on the implementation file. Document the tainted collector and node_kernel_tainted metrics in README. Signed-off-by: Arun S * README: drop tainted collector section, keep table entry only Signed-off-by: Arun S * go.mod: align with master after merge (procfs v0.22.0, toolkit v0.19.0) Fixes build and BSD e2e failures caused by stale dependency versions left over from a bad merge. Signed-off-by: Arun S Co-authored-by: Cursor --------- Signed-off-by: Arun S Signed-off-by: Arun Srinivasan Co-authored-by: Arun S Co-authored-by: Cursor --- README.md | 1 + collector/fixtures/proc/sys/kernel/tainted | 1 + collector/tainted_linux.go | 79 ++++++++++++++++ collector/tainted_linux_test.go | 103 +++++++++++++++++++++ 4 files changed, 184 insertions(+) create mode 100644 collector/fixtures/proc/sys/kernel/tainted create mode 100644 collector/tainted_linux.go create mode 100644 collector/tainted_linux_test.go diff --git a/README.md b/README.md index 713663132b..4a10a4b6c5 100644 --- a/README.md +++ b/README.md @@ -218,6 +218,7 @@ softirqs | Exposes detailed softirq statistics from `/proc/softirqs`. | Linux sysctl | Expose sysctl values from `/proc/sys`. Use `--collector.sysctl.include(-info)` to configure. | Linux swap | Expose swap information from `/proc/swaps`. | Linux systemd | Exposes service and system status from [systemd](http://www.freedesktop.org/wiki/Software/systemd/). | Linux +tainted | Exposes kernel taint flags from `/proc/sys/kernel/tainted`. | Linux tcpstat | Exposes TCP connection status information from `/proc/net/tcp` and `/proc/net/tcp6`. (Warning: the current version has potential performance issues in high load situations.) | Linux wifi | Exposes WiFi device and station statistics. | Linux xfrm | Exposes statistics from `/proc/net/xfrm_stat` | Linux diff --git a/collector/fixtures/proc/sys/kernel/tainted b/collector/fixtures/proc/sys/kernel/tainted new file mode 100644 index 0000000000..63fce6863a --- /dev/null +++ b/collector/fixtures/proc/sys/kernel/tainted @@ -0,0 +1 @@ +12288 diff --git a/collector/tainted_linux.go b/collector/tainted_linux.go new file mode 100644 index 0000000000..3ab3f25c6e --- /dev/null +++ b/collector/tainted_linux.go @@ -0,0 +1,79 @@ +// Copyright The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !notainted + +package collector + +import ( + "fmt" + "log/slog" + "strconv" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/procfs" +) + +type taintedCollector struct { + fs procfs.FS + logger *slog.Logger + desc *prometheus.Desc +} + +func init() { + registerCollector("tainted", defaultDisabled, NewTaintedCollector) +} + +// NewTaintedCollector returns a Collector exposing kernel taint flags from +// /proc/sys/kernel/tainted as a labelled gauge. +// See https://www.kernel.org/doc/html/latest/admin-guide/tainted-kernels.html +func NewTaintedCollector(logger *slog.Logger) (Collector, error) { + fs, err := procfs.NewFS(*procPath) + if err != nil { + return nil, fmt.Errorf("failed to open procfs: %w", err) + } + return &taintedCollector{ + fs: fs, + logger: logger, + desc: prometheus.NewDesc( + prometheus.BuildFQName(namespace, "kernel", "tainted"), + "Taint flags set on the running Linux kernel, as reported by /proc/sys/kernel/tainted. "+ + "Value is 1 if the flag is set, 0 otherwise. "+ + "See https://www.kernel.org/doc/html/latest/admin-guide/tainted-kernels.html for flag meanings.", + []string{"bit", "flag"}, + nil, + ), + }, nil +} + +func (c *taintedCollector) Update(ch chan<- prometheus.Metric) error { + tainted, err := c.fs.KernelTainted() + if err != nil { + return fmt.Errorf("couldn't read kernel tainted state: %w", err) + } + + for _, b := range tainted.Bits { + var val float64 + if b.Set { + val = 1.0 + } + ch <- prometheus.MustNewConstMetric( + c.desc, + prometheus.GaugeValue, + val, + strconv.Itoa(b.Index), + b.Flag, + ) + } + return nil +} diff --git a/collector/tainted_linux_test.go b/collector/tainted_linux_test.go new file mode 100644 index 0000000000..0ce7e3b621 --- /dev/null +++ b/collector/tainted_linux_test.go @@ -0,0 +1,103 @@ +// Copyright The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !notainted + +package collector + +import ( + "io" + "log/slog" + "testing" + + "github.com/prometheus/client_golang/prometheus" +) + +func TestTaintedCollector(t *testing.T) { + *procPath = "fixtures/proc" + + logger := slog.New(slog.NewTextHandler(io.Discard, nil)) + c, err := NewTaintedCollector(logger) + if err != nil { + t.Fatalf("failed to create tainted collector: %v", err) + } + + reg := prometheus.NewPedanticRegistry() + reg.MustRegister(&taintedCollectorWrapper{c.(*taintedCollector)}) + + mfs, err := reg.Gather() + if err != nil { + t.Fatalf("gather failed: %v", err) + } + if len(mfs) != 1 { + t.Fatalf("expected 1 metric family, got %d", len(mfs)) + } + + mf := mfs[0] + if got := mf.GetName(); got != "node_kernel_tainted" { + t.Errorf("metric name: want node_kernel_tainted, got %s", got) + } + + // Expect one series per known taint bit (20 defined by the kernel). + const wantBits = 20 + if got := len(mf.GetMetric()); got != wantBits { + t.Errorf("metric count: want %d, got %d", wantBits, got) + } + + // Build bit → value map for assertion. + // Fixture is 12288 = bit 12 (O) + bit 13 (E). + // Build flag → value map for assertion (labels: bit, flag). + flagVals := make(map[string]float64) + for _, m := range mf.GetMetric() { + // Each metric has exactly 2 labels: bit and flag. + for _, lp := range m.GetLabel() { + if lp.GetName() == "flag" { + flagVals[lp.GetValue()] = m.GetGauge().GetValue() + } + } + } + + // Fixture is 12288 = bit 12 (O) + bit 13 (E). + for _, tc := range []struct { + flag string + want float64 + }{ + {"O", 1}, // Externally-built (out-of-tree) module — set + {"E", 1}, // Unsigned module — set + {"L", 0}, // Soft lockup — must be clear + {"P", 0}, + {"T", 0}, + } { + got, ok := flagVals[tc.flag] + if !ok { + t.Errorf("flag %q not found in metrics", tc.flag) + continue + } + if got != tc.want { + t.Errorf("flag %q: want %.0f, got %.0f", tc.flag, tc.want, got) + } + } +} + +// taintedCollectorWrapper adapts taintedCollector to prometheus.Collector. +type taintedCollectorWrapper struct { + c *taintedCollector +} + +func (w *taintedCollectorWrapper) Describe(ch chan<- *prometheus.Desc) { + ch <- w.c.desc +} + +func (w *taintedCollectorWrapper) Collect(ch chan<- prometheus.Metric) { + _ = w.c.Update(ch) +} From 153881bdaea0f106486eb43a6d2272f5f8a05619 Mon Sep 17 00:00:00 2001 From: Rene Treffer Date: Tue, 20 Oct 2026 10:39:09 +0200 Subject: [PATCH 53/87] Add resctrl collector (#3797) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add resctrl collector Expose the Linux resctrl monitoring counters (Intel RDT, AMD PQoS, ARM MPAM): per L3 domain memory bandwidth (mbm_total_bytes, mbm_local_bytes) and last level cache occupancy (llc_occupancy). Parsing is done by the procfs resctrlfs package (procfs v0.22.0). The collector is disabled by default because the resctrl filesystem must be mounted first (mount -t resctrl resctrl /sys/fs/resctrl). The mountpoint is configurable via --collector.resctrl.path. Counters a CPU does not support (for example mbm_local_bytes on Arm MPAM) or that read "Unavailable" are skipped per sample. The hardware counters wrap; Prometheus treats the wrap as a counter reset, so no correction is applied. Signed-off-by: René Treffer * Describe steps needed to use the resctrl exporter Signed-off-by: René Treffer * Shorten resctrl documentation Signed-off-by: René Treffer --------- Signed-off-by: René Treffer --- README.md | 19 +++ collector/fixtures/e2e-64k-page-output.txt | 10 ++ collector/fixtures/e2e-output.txt | 10 ++ .../resctrl/mon_data/mon_L3_00/llc_occupancy | 1 + .../mon_data/mon_L3_00/mbm_local_bytes | 1 + .../mon_data/mon_L3_00/mbm_total_bytes | 1 + .../resctrl/mon_data/mon_L3_01/llc_occupancy | 1 + .../mon_data/mon_L3_01/mbm_local_bytes | 1 + .../mon_data/mon_L3_01/mbm_total_bytes | 1 + collector/resctrl_linux.go | 110 ++++++++++++++++++ collector/resctrl_linux_test.go | 91 +++++++++++++++ end-to-end-test.sh | 2 + 12 files changed, 248 insertions(+) create mode 100644 collector/fixtures/resctrl/mon_data/mon_L3_00/llc_occupancy create mode 100644 collector/fixtures/resctrl/mon_data/mon_L3_00/mbm_local_bytes create mode 100644 collector/fixtures/resctrl/mon_data/mon_L3_00/mbm_total_bytes create mode 100644 collector/fixtures/resctrl/mon_data/mon_L3_01/llc_occupancy create mode 100644 collector/fixtures/resctrl/mon_data/mon_L3_01/mbm_local_bytes create mode 100644 collector/fixtures/resctrl/mon_data/mon_L3_01/mbm_total_bytes create mode 100644 collector/resctrl_linux.go create mode 100644 collector/resctrl_linux_test.go diff --git a/README.md b/README.md index 4a10a4b6c5..1b73976b07 100644 --- a/README.md +++ b/README.md @@ -213,6 +213,7 @@ pcidevice | Exposes pci devices' information including their link status and par perf | Exposes perf based metrics (Warning: Metrics are dependent on kernel configuration and settings). | Linux processes | Exposes aggregate process statistics from `/proc`. | Linux qdisc | Exposes [queuing discipline](https://en.wikipedia.org/wiki/Network_scheduler#Linux_kernel) statistics | Linux +resctrl | Exposes Intel RDT / AMD PQoS / ARM MPAM memory bandwidth and cache occupancy monitoring counters from the resctrl filesystem root group (must be mounted, see [below](#resctrl-collector)). | Linux slabinfo | Exposes slab statistics from `/proc/slabinfo`. Note that permission of `/proc/slabinfo` is usually 0400, so set it appropriately. | Linux softirqs | Exposes detailed softirq statistics from `/proc/softirqs`. | Linux sysctl | Expose sysctl values from `/proc/sys`. Use `--collector.sysctl.include(-info)` to configure. | Linux @@ -271,6 +272,24 @@ found using [`perf list`](http://man7.org/linux/man-pages/man1/perf.1.html) or from debugfs. And example usage of this would be `--collector.perf.tracepoint="sched:sched_process_exec"`. +### Resctrl Collector + +The `resctrl` collector is disabled by default because the filesystem it reads is usually not mounted. +To enable it, first mount the filesystem and then start `node_exporter` with the collector enabled: +``` +mount -t resctrl resctrl /sys/fs/resctrl +node_exporter --collector.resctrl +``` + +From Linux 6.19 a CPU with assignable bandwidth monitoring counters comes up in `mbm_event` mode. +The classic mode (required by this collector) can be enabled with: + +``` +echo default > /sys/fs/resctrl/info/L3_MON/mbm_assign_mode # fails harmlessly on older kernels +``` + +See the [kernel documentation](https://docs.kernel.org/filesystems/resctrl.html) for more details. + ### Sysctl Collector The `sysctl` collector can be enabled with `--collector.sysctl`. It supports exposing numeric sysctl values diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index 5d84335eb1..18a34815ba 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -3719,6 +3719,15 @@ node_rapl_core_joules_total{index="0",path="collector/fixtures/sys/class/powerca # HELP node_rapl_package_joules_total Current RAPL package value in joules # TYPE node_rapl_package_joules_total counter node_rapl_package_joules_total{index="0",path="collector/fixtures/sys/class/powercap/intel-rapl:0"} 240422.366267 +# HELP node_resctrl_llc_occupancy_bytes Last level cache bytes occupied in this domain. +# TYPE node_resctrl_llc_occupancy_bytes gauge +node_resctrl_llc_occupancy_bytes{domain="0"} 4.4040192e+07 +node_resctrl_llc_occupancy_bytes{domain="1"} 8.388608e+06 +# HELP node_resctrl_memory_bandwidth_bytes_total Bytes moved between the last level cache and memory. scope=total includes remote sockets, scope=local is memory attached to this domain. +# TYPE node_resctrl_memory_bandwidth_bytes_total counter +node_resctrl_memory_bandwidth_bytes_total{domain="0",scope="local"} 2.10196273664e+11 +node_resctrl_memory_bandwidth_bytes_total{domain="0",scope="total"} 3.15294410752e+11 +node_resctrl_memory_bandwidth_bytes_total{domain="1",scope="total"} 1.05098136832e+11 # HELP node_schedstat_running_seconds_total Number of seconds CPU spent running a process. # TYPE node_schedstat_running_seconds_total counter node_schedstat_running_seconds_total{cpu="0"} 2.045936778163039e+06 @@ -3779,6 +3788,7 @@ node_scrape_collector_success{collector="pressure"} 1 node_scrape_collector_success{collector="processes"} 1 node_scrape_collector_success{collector="qdisc"} 1 node_scrape_collector_success{collector="rapl"} 1 +node_scrape_collector_success{collector="resctrl"} 1 node_scrape_collector_success{collector="schedstat"} 1 node_scrape_collector_success{collector="slabinfo"} 1 node_scrape_collector_success{collector="sockstat"} 1 diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index cfdeede26d..0c91a90300 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -3741,6 +3741,15 @@ node_rapl_core_joules_total{index="0",path="collector/fixtures/sys/class/powerca # HELP node_rapl_package_joules_total Current RAPL package value in joules # TYPE node_rapl_package_joules_total counter node_rapl_package_joules_total{index="0",path="collector/fixtures/sys/class/powercap/intel-rapl:0"} 240422.366267 +# HELP node_resctrl_llc_occupancy_bytes Last level cache bytes occupied in this domain. +# TYPE node_resctrl_llc_occupancy_bytes gauge +node_resctrl_llc_occupancy_bytes{domain="0"} 4.4040192e+07 +node_resctrl_llc_occupancy_bytes{domain="1"} 8.388608e+06 +# HELP node_resctrl_memory_bandwidth_bytes_total Bytes moved between the last level cache and memory. scope=total includes remote sockets, scope=local is memory attached to this domain. +# TYPE node_resctrl_memory_bandwidth_bytes_total counter +node_resctrl_memory_bandwidth_bytes_total{domain="0",scope="local"} 2.10196273664e+11 +node_resctrl_memory_bandwidth_bytes_total{domain="0",scope="total"} 3.15294410752e+11 +node_resctrl_memory_bandwidth_bytes_total{domain="1",scope="total"} 1.05098136832e+11 # HELP node_schedstat_running_seconds_total Number of seconds CPU spent running a process. # TYPE node_schedstat_running_seconds_total counter node_schedstat_running_seconds_total{cpu="0"} 2.045936778163039e+06 @@ -3801,6 +3810,7 @@ node_scrape_collector_success{collector="pressure"} 1 node_scrape_collector_success{collector="processes"} 1 node_scrape_collector_success{collector="qdisc"} 1 node_scrape_collector_success{collector="rapl"} 1 +node_scrape_collector_success{collector="resctrl"} 1 node_scrape_collector_success{collector="schedstat"} 1 node_scrape_collector_success{collector="slabinfo"} 1 node_scrape_collector_success{collector="sockstat"} 1 diff --git a/collector/fixtures/resctrl/mon_data/mon_L3_00/llc_occupancy b/collector/fixtures/resctrl/mon_data/mon_L3_00/llc_occupancy new file mode 100644 index 0000000000..317ea811d9 --- /dev/null +++ b/collector/fixtures/resctrl/mon_data/mon_L3_00/llc_occupancy @@ -0,0 +1 @@ +44040192 diff --git a/collector/fixtures/resctrl/mon_data/mon_L3_00/mbm_local_bytes b/collector/fixtures/resctrl/mon_data/mon_L3_00/mbm_local_bytes new file mode 100644 index 0000000000..5cb8136235 --- /dev/null +++ b/collector/fixtures/resctrl/mon_data/mon_L3_00/mbm_local_bytes @@ -0,0 +1 @@ +210196273664 diff --git a/collector/fixtures/resctrl/mon_data/mon_L3_00/mbm_total_bytes b/collector/fixtures/resctrl/mon_data/mon_L3_00/mbm_total_bytes new file mode 100644 index 0000000000..d91f52ebae --- /dev/null +++ b/collector/fixtures/resctrl/mon_data/mon_L3_00/mbm_total_bytes @@ -0,0 +1 @@ +315294410752 diff --git a/collector/fixtures/resctrl/mon_data/mon_L3_01/llc_occupancy b/collector/fixtures/resctrl/mon_data/mon_L3_01/llc_occupancy new file mode 100644 index 0000000000..16edb4cc19 --- /dev/null +++ b/collector/fixtures/resctrl/mon_data/mon_L3_01/llc_occupancy @@ -0,0 +1 @@ +8388608 diff --git a/collector/fixtures/resctrl/mon_data/mon_L3_01/mbm_local_bytes b/collector/fixtures/resctrl/mon_data/mon_L3_01/mbm_local_bytes new file mode 100644 index 0000000000..ba54161f35 --- /dev/null +++ b/collector/fixtures/resctrl/mon_data/mon_L3_01/mbm_local_bytes @@ -0,0 +1 @@ +Unavailable diff --git a/collector/fixtures/resctrl/mon_data/mon_L3_01/mbm_total_bytes b/collector/fixtures/resctrl/mon_data/mon_L3_01/mbm_total_bytes new file mode 100644 index 0000000000..47cf3d0c1b --- /dev/null +++ b/collector/fixtures/resctrl/mon_data/mon_L3_01/mbm_total_bytes @@ -0,0 +1 @@ +105098136832 diff --git a/collector/resctrl_linux.go b/collector/resctrl_linux.go new file mode 100644 index 0000000000..9995950210 --- /dev/null +++ b/collector/resctrl_linux.go @@ -0,0 +1,110 @@ +// Copyright The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !noresctrl + +package collector + +import ( + "errors" + "log/slog" + "os" + + "github.com/alecthomas/kingpin/v2" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/procfs/resctrlfs" +) + +const resctrlSubsystem = "resctrl" + +// The resctrl filesystem exposes the cache and memory bandwidth monitoring of +// the CPU (Intel RDT, AMD PQoS, Arm MPAM), documented in +// https://docs.kernel.org/filesystems/resctrl.html and +// https://docs.kernel.org/arch/arm64/mpam.html. +// +// It is not mounted by default, hence this collector is disabled by default. +// Mount it with: +// +// mount -t resctrl resctrl /sys/fs/resctrl +var resctrlPath = kingpin.Flag("collector.resctrl.path", "resctrl filesystem mountpoint.").Default(resctrlfs.DefaultMountPoint).String() + +type resctrlCollector struct{} + +func init() { + registerCollector("resctrl", defaultDisabled, NewResctrlCollector) +} + +var ( + resctrlMemoryBandwidth = prometheus.NewDesc( + prometheus.BuildFQName(namespace, resctrlSubsystem, "memory_bandwidth_bytes_total"), + "Bytes moved between the last level cache and memory. scope=total includes remote sockets, scope=local is memory attached to this domain.", + []string{"domain", "scope"}, nil, + ) + resctrlLLCOccupancy = prometheus.NewDesc( + prometheus.BuildFQName(namespace, resctrlSubsystem, "llc_occupancy_bytes"), + "Last level cache bytes occupied in this domain.", + []string{"domain"}, nil, + ) +) + +// NewResctrlCollector returns a new Collector exposing resctrl monitoring counters. +func NewResctrlCollector(_ *slog.Logger) (Collector, error) { + return &resctrlCollector{}, nil +} + +func (c *resctrlCollector) Update(ch chan<- prometheus.Metric) error { + // The filesystem is opened on every scrape because it can be mounted and + // unmounted while node_exporter runs. + fs, err := resctrlfs.NewFS(*resctrlPath) + if err != nil { + if errors.Is(err, os.ErrNotExist) { + return ErrNoData + } + return err + } + + domains, err := fs.MonData() + if err != nil { + if errors.Is(err, os.ErrNotExist) { + return ErrNoData + } + return err + } + + found := false + for _, domain := range domains { + // The metrics describe the last level cache, so only L3 fits them. + if domain.Resource != "L3" { + continue + } + found = true + + // The bandwidth counters wrap. No correction is applied: Prometheus + // reads a wrap as a counter reset, which is the closest available + // approximation. + if v := domain.MBMTotalBytes; v != nil { + ch <- prometheus.MustNewConstMetric(resctrlMemoryBandwidth, prometheus.CounterValue, float64(*v), domain.ID, "total") + } + if v := domain.MBMLocalBytes; v != nil { + ch <- prometheus.MustNewConstMetric(resctrlMemoryBandwidth, prometheus.CounterValue, float64(*v), domain.ID, "local") + } + if v := domain.LLCOccupancy; v != nil { + ch <- prometheus.MustNewConstMetric(resctrlLLCOccupancy, prometheus.GaugeValue, float64(*v), domain.ID) + } + } + + if !found { + return ErrNoData + } + return nil +} diff --git a/collector/resctrl_linux_test.go b/collector/resctrl_linux_test.go new file mode 100644 index 0000000000..fd5598a92d --- /dev/null +++ b/collector/resctrl_linux_test.go @@ -0,0 +1,91 @@ +// Copyright The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !noresctrl + +package collector + +import ( + "io" + "log/slog" + "strings" + "testing" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/testutil" +) + +type testResctrlCollector struct { + rc Collector +} + +func (c testResctrlCollector) Collect(ch chan<- prometheus.Metric) { + c.rc.Update(ch) +} + +func (c testResctrlCollector) Describe(ch chan<- *prometheus.Desc) { + prometheus.DescribeByCollect(c, ch) +} + +func newTestResctrlCollector(logger *slog.Logger) (prometheus.Collector, error) { + rc, err := NewResctrlCollector(logger) + if err != nil { + return testResctrlCollector{}, err + } + return testResctrlCollector{rc}, nil +} + +func TestResctrlMetrics(t *testing.T) { + *resctrlPath = "fixtures/resctrl" + + // Domain 1 reports "Unavailable" for mbm_local_bytes, so that sample is + // absent. + testcase := `# HELP node_resctrl_llc_occupancy_bytes Last level cache bytes occupied in this domain. +# TYPE node_resctrl_llc_occupancy_bytes gauge +node_resctrl_llc_occupancy_bytes{domain="0"} 4.4040192e+07 +node_resctrl_llc_occupancy_bytes{domain="1"} 8.388608e+06 +# HELP node_resctrl_memory_bandwidth_bytes_total Bytes moved between the last level cache and memory. scope=total includes remote sockets, scope=local is memory attached to this domain. +# TYPE node_resctrl_memory_bandwidth_bytes_total counter +node_resctrl_memory_bandwidth_bytes_total{domain="0",scope="local"} 2.10196273664e+11 +node_resctrl_memory_bandwidth_bytes_total{domain="0",scope="total"} 3.15294410752e+11 +node_resctrl_memory_bandwidth_bytes_total{domain="1",scope="total"} 1.05098136832e+11 +` + + logger := slog.New(slog.NewTextHandler(io.Discard, nil)) + c, err := newTestResctrlCollector(logger) + if err != nil { + t.Fatal(err) + } + + if err := testutil.CollectAndCompare(c, strings.NewReader(testcase)); err != nil { + t.Fatal(err) + } +} + +func TestResctrlNotMounted(t *testing.T) { + *resctrlPath = t.TempDir() + + logger := slog.New(slog.NewTextHandler(io.Discard, nil)) + c, err := NewResctrlCollector(logger) + if err != nil { + t.Fatal(err) + } + + ch := make(chan prometheus.Metric, 16) + err = c.Update(ch) + close(ch) + + if err != ErrNoData { + t.Fatalf("expected ErrNoData, got %v", err) + } +} diff --git a/end-to-end-test.sh b/end-to-end-test.sh index 3b0fc1a09c..2c947d8446 100755 --- a/end-to-end-test.sh +++ b/end-to-end-test.sh @@ -74,6 +74,7 @@ enabled_collectors=$(cat << COLLECTORS processes qdisc rapl + resctrl schedstat slabinfo sockstat @@ -175,6 +176,7 @@ collector_flags=$(cat << FLAGS --collector.netdev.device-include=lo --collector.qdisc.device-include=(wlan0|eth0) --collector.qdisc.fixtures=collector/fixtures/qdisc/ + --collector.resctrl.path=collector/fixtures/resctrl --collector.stat.softirq --collector.sysctl.include-info=kernel.seccomp.actions_avail --collector.sysctl.include=fs.file-nr From 2354590e190621b5b2599c96392984491d595ee4 Mon Sep 17 00:00:00 2001 From: Sai Pisey <130427660+SaiPisey2@users.noreply.github.com> Date: Thu, 22 Oct 2026 01:02:57 +0530 Subject: [PATCH 54/87] fix(collector): keep collecting temperatures without CPU power status (#3767) * fix(collector): keep collecting temperatures without CPU power status Apple Silicon does not implement IOPMCopyCPUPowerStatus, so fetchCPUPowerStatus returns kIOReturnNotFound there. Update returned that error straight away, which aborted the collector before updateTemperatures ran, so no temperature metrics were collected at all. The error was also not ErrNoData, so it was logged at error level on every scrape. On an M5 Pro, Update emitted 0 metrics and failed, while updateTemperatures on its own returned 52 temperature metrics. Treat kIOReturnNotFound as a system that does not report CPU power status: skip the three CPU power metrics, log at debug level and carry on to the temperature sensors. Any other non-success return code is still returned as an error. Systems that do report CPU power status are unaffected. This does not make the CPU power metrics available on Apple Silicon, since the underlying API provides no data. It only stops their absence from suppressing the temperature metrics. Adds a regression test covering the case. Signed-off-by: SaiPisey2 * fix(collector): disambiguate colliding thermal sensor names Collecting temperatures on Apple Silicon surfaced a second problem that was previously unreachable, because Update returned before updateTemperatures ever ran. A sensor is labelled with its IOHID "Product" property, which is not unique. On an M5 Pro, 52 temperature-reporting services carry only 17 distinct product names, so the registry rejects the colliding samples and logs an error on every scrape. The collisions are of two kinds. Six "gas gauge battery" services are distinct sensors that merely share a name; they have distinct LocationIDs. The "PMU tdie*" services come in threes that share both the name and the LocationID, and report readings that differ by a few tenths of a degree, so they are separate sensing elements rather than the same one listed repeatedly. Dropping either kind loses readings. Following the approach taken for hwmon in #3646, read all sensors first, then qualify a name shared by several services with its location, falling back to the service registry ID when the location does not separate them either. Registry IDs are unique per service, which the OS guarantees and which held for every service observed here. Names that do not collide are left untouched. The endpoint now reports all 52 readings with unique label sets and no gather errors, where before the change 35 of them were rejected. Also update collector/fixtures/e2e-output-darwin.txt for node_scrape_collector_success{collector="thermal"}, which is now 1 because the collector no longer fails. resolveSensorNames is kept free of cgo so that the labelling rules are covered by table-driven tests, which matters because the CI runner reports no thermal sensors at all. Signed-off-by: SaiPisey2 * test(collector): satisfy the stricter linters in the thermal test Drop a no-op drain of an already closed channel and build the metric key with a strings.Builder. Signed-off-by: SaiPisey2 --------- Signed-off-by: SaiPisey2 --- collector/fixtures/e2e-output-darwin.txt | 2 +- collector/thermal_darwin.go | 34 ++++--- collector/thermal_darwin_arm64.go | 92 ++++++++++++++++- collector/thermal_darwin_arm64_test.go | 121 +++++++++++++++++++++++ collector/thermal_darwin_test.go | 89 +++++++++++++++++ 5 files changed, 322 insertions(+), 16 deletions(-) create mode 100644 collector/thermal_darwin_arm64_test.go create mode 100644 collector/thermal_darwin_test.go diff --git a/collector/fixtures/e2e-output-darwin.txt b/collector/fixtures/e2e-output-darwin.txt index 61b369977a..b9183e39ff 100644 --- a/collector/fixtures/e2e-output-darwin.txt +++ b/collector/fixtures/e2e-output-darwin.txt @@ -155,7 +155,7 @@ node_scrape_collector_success{collector="netdev"} 1 node_scrape_collector_success{collector="os"} 1 node_scrape_collector_success{collector="powersupplyclass"} 1 node_scrape_collector_success{collector="textfile"} 1 -node_scrape_collector_success{collector="thermal"} 0 +node_scrape_collector_success{collector="thermal"} 1 node_scrape_collector_success{collector="time"} 1 node_scrape_collector_success{collector="xfrm"} 1 # HELP node_textfile_mtime_seconds Unixtime mtime of textfiles successfully read. diff --git a/collector/thermal_darwin.go b/collector/thermal_darwin.go index fabd0e50a8..8b6ba72839 100644 --- a/collector/thermal_darwin.go +++ b/collector/thermal_darwin.go @@ -62,6 +62,11 @@ type thermCollector struct { const thermal = "thermal" +// errNoCPUPowerStatus is returned when the system does not report any CPU power +// status. Apple Silicon does not implement IOPMCopyCPUPowerStatus, so this is an +// expected condition on those systems rather than a failure. +var errNoCPUPowerStatus = errors.New("no CPU power status has been recorded") + func init() { registerCollector(thermal, defaultEnabled, NewThermCollector) } @@ -110,18 +115,25 @@ func NewThermCollector(logger *slog.Logger) (Collector, error) { func (c *thermCollector) Update(ch chan<- prometheus.Metric) error { cpuPowerStatus, err := fetchCPUPowerStatus() - if err != nil { + switch { + case err == nil: + if value, ok := cpuPowerStatus[string(C.kIOPMCPUPowerLimitSchedulerTimeKey)]; ok { + ch <- c.cpuSchedulerLimit.mustNewConstMetric(float64(value) / 100.0) + } + if value, ok := cpuPowerStatus[string(C.kIOPMCPUPowerLimitProcessorCountKey)]; ok { + ch <- c.cpuAvailableCPU.mustNewConstMetric(float64(value)) + } + if value, ok := cpuPowerStatus[string(C.kIOPMCPUPowerLimitProcessorSpeedKey)]; ok { + ch <- c.cpuSpeedLimit.mustNewConstMetric(float64(value) / 100.0) + } + case errors.Is(err, errNoCPUPowerStatus): + // Apple Silicon does not report CPU power status. The temperature + // sensors collected below are still available, so this must not abort + // the collector. + c.logger.Debug("No CPU power status reported by the system, skipping CPU power metrics") + default: return err } - if value, ok := cpuPowerStatus[string(C.kIOPMCPUPowerLimitSchedulerTimeKey)]; ok { - ch <- c.cpuSchedulerLimit.mustNewConstMetric(float64(value) / 100.0) - } - if value, ok := cpuPowerStatus[string(C.kIOPMCPUPowerLimitProcessorCountKey)]; ok { - ch <- c.cpuAvailableCPU.mustNewConstMetric(float64(value)) - } - if value, ok := cpuPowerStatus[string(C.kIOPMCPUPowerLimitProcessorSpeedKey)]; ok { - ch <- c.cpuSpeedLimit.mustNewConstMetric(float64(value) / 100.0) - } return c.updateTemperatures(ch) } @@ -135,7 +147,7 @@ func fetchCPUPowerStatus() (map[string]int, error) { }() if C.kIOReturnNotFound == cfDictRef.ret { - return nil, errors.New("no CPU power status has been recorded") + return nil, errNoCPUPowerStatus } if C.kIOReturnSuccess != cfDictRef.ret { diff --git a/collector/thermal_darwin_arm64.go b/collector/thermal_darwin_arm64.go index 85a76eea4e..bfbc52a338 100644 --- a/collector/thermal_darwin_arm64.go +++ b/collector/thermal_darwin_arm64.go @@ -39,10 +39,12 @@ CFArrayRef IOHIDEventSystemClientCopyServices(IOHIDEventSystemClientRef client); IOHIDEventRef IOHIDServiceClientCopyEvent(IOHIDServiceClientRef service, int64_t type, int32_t options, int64_t timestamp); double IOHIDEventGetFloatValue(IOHIDEventRef event, int32_t field); CFTypeRef IOHIDServiceClientCopyProperty(IOHIDServiceClientRef service, CFStringRef key); +uint64_t IOHIDServiceClientGetRegistryID(IOHIDServiceClientRef service); */ import "C" import ( + "strconv" "unsafe" "github.com/prometheus/client_golang/prometheus" @@ -50,6 +52,18 @@ import ( const absoluteZeroCelsius = -273.15 +// A thermal sensor is labelled with its IOHID "Product" property, which is not +// unique. Apple Silicon reports several services under one product name: some +// are distinct sensors that only share the name and can be told apart by their +// location, while others share the location too and differ only by the registry +// ID of the service. +type thermalSensor struct { + name string + location string + registryID string + temp float64 +} + func (c *thermCollector) updateTemperatures(ch chan<- prometheus.Metric) error { client := C.IOHIDEventSystemClientCreate(C.kCFAllocatorDefault) if client == nil { @@ -101,10 +115,18 @@ func (c *thermCollector) updateTemperatures(ch chan<- prometheus.Metric) error { cfProdKey := C.CFStringCreateWithCString(C.kCFAllocatorDefault, prodKey, C.kCFStringEncodingUTF8) defer C.CFRelease(C.CFTypeRef(cfProdKey)) + locKey := C.CString("LocationID") + defer C.free(unsafe.Pointer(locKey)) + cfLocKey := C.CFStringCreateWithCString(C.kCFAllocatorDefault, locKey, C.kCFStringEncodingUTF8) + defer C.CFRelease(C.CFTypeRef(cfLocKey)) + + // Read every sensor first, so that colliding product names can be detected + // before any metric is emitted. + sensors := make([]thermalSensor, 0, int(count)) for i := 0; i < int(count); i++ { - service := C.CFArrayGetValueAtIndex(services, C.CFIndex(i)) + service := C.IOHIDServiceClientRef(C.CFArrayGetValueAtIndex(services, C.CFIndex(i))) - event := C.IOHIDServiceClientCopyEvent(C.IOHIDServiceClientRef(service), C.kIOHIDEventTypeTemperature, 0, 0) + event := C.IOHIDServiceClientCopyEvent(service, C.kIOHIDEventTypeTemperature, 0, 0) if event == nil { continue } @@ -118,18 +140,80 @@ func (c *thermCollector) updateTemperatures(ch chan<- prometheus.Metric) error { continue } - nameRef := C.IOHIDServiceClientCopyProperty(C.IOHIDServiceClientRef(service), cfProdKey) + nameRef := C.IOHIDServiceClientCopyProperty(service, cfProdKey) name := "Unknown" if nameRef != 0 { name = cfStringToString(C.CFStringRef(nameRef)) C.CFRelease(C.CFTypeRef(nameRef)) } - ch <- c.temperature.mustNewConstMetric(float64(temp), name) + sensors = append(sensors, thermalSensor{ + name: name, + location: serviceNumberProperty(service, cfLocKey), + registryID: strconv.FormatUint(uint64(C.IOHIDServiceClientGetRegistryID(service)), 10), + temp: float64(temp), + }) } + + for i, label := range resolveSensorNames(sensors) { + ch <- c.temperature.mustNewConstMetric(sensors[i].temp, label) + } + return nil } +// resolveSensorNames returns the sensor label to report for each sensor, in the +// order the sensors were given. +// +// Emitting the same label set twice makes the registry reject the samples and +// fail the whole scrape. A product name shared by several services is therefore +// qualified with the service location, falling back to the registry ID, which is +// unique per service, when the location does not tell them apart either. +func resolveSensorNames(sensors []thermalSensor) []string { + nameCount := make(map[string]int, len(sensors)) + nameLocationCount := make(map[string]int, len(sensors)) + for _, s := range sensors { + nameCount[s.name]++ + nameLocationCount[s.name+"\x00"+s.location]++ + } + + labels := make([]string, 0, len(sensors)) + for _, s := range sensors { + label := s.name + if nameCount[s.name] > 1 { + suffix := s.location + if suffix == "" || nameLocationCount[s.name+"\x00"+s.location] > 1 { + suffix = s.registryID + } + label = s.name + "_" + suffix + } + labels = append(labels, label) + } + + return labels +} + +// serviceNumberProperty reads a numeric IOHID service property, returning an +// empty string when it is absent or not a number. +func serviceNumberProperty(service C.IOHIDServiceClientRef, key C.CFStringRef) string { + ref := C.IOHIDServiceClientCopyProperty(service, key) + if ref == 0 { + return "" + } + defer C.CFRelease(ref) + + if C.CFGetTypeID(ref) != C.CFNumberGetTypeID() { + return "" + } + + var value C.longlong + if C.CFNumberGetValue(C.CFNumberRef(ref), C.kCFNumberLongLongType, unsafe.Pointer(&value)) == 0 { + return "" + } + + return strconv.FormatInt(int64(value), 10) +} + func cfStringToString(s C.CFStringRef) string { p := C.CFStringGetCStringPtr(s, C.kCFStringEncodingUTF8) if p != nil { diff --git a/collector/thermal_darwin_arm64_test.go b/collector/thermal_darwin_arm64_test.go new file mode 100644 index 0000000000..ba3e867a8b --- /dev/null +++ b/collector/thermal_darwin_arm64_test.go @@ -0,0 +1,121 @@ +// Copyright The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !notherm && darwin && arm64 && cgo + +package collector + +import "testing" + +func TestResolveSensorNames(t *testing.T) { + for _, tc := range []struct { + name string + sensors []thermalSensor + want []string + }{ + { + name: "unique names are left alone", + sensors: []thermalSensor{{name: "NAND CH0 temp", location: "1", registryID: "10"}}, + want: []string{"NAND CH0 temp"}, + }, + { + // Several "gas gauge battery" services are distinct sensors that + // only share a product name. + name: "a shared name is qualified with the location", + sensors: []thermalSensor{ + {name: "gas gauge battery", location: "1413951555", registryID: "10"}, + {name: "gas gauge battery", location: "1413951574", registryID: "11"}, + }, + want: []string{"gas gauge battery_1413951555", "gas gauge battery_1413951574"}, + }, + { + // The PMU sensors report the same product name and the same + // location, so only the registry ID separates them. + name: "a shared location falls back to the registry ID", + sensors: []thermalSensor{ + {name: "PMU tdie2", location: "1414541922", registryID: "10"}, + {name: "PMU tdie2", location: "1414541922", registryID: "11"}, + {name: "PMU tdie2", location: "1414541922", registryID: "12"}, + }, + want: []string{"PMU tdie2_10", "PMU tdie2_11", "PMU tdie2_12"}, + }, + { + name: "a missing location falls back to the registry ID", + sensors: []thermalSensor{ + {name: "sensor", location: "", registryID: "10"}, + {name: "sensor", location: "", registryID: "11"}, + }, + want: []string{"sensor_10", "sensor_11"}, + }, + { + // Only the services that cannot be told apart by location fall back + // to the registry ID. + name: "location and registry ID are mixed within one name", + sensors: []thermalSensor{ + {name: "sensor", location: "1", registryID: "10"}, + {name: "sensor", location: "2", registryID: "11"}, + {name: "sensor", location: "2", registryID: "12"}, + }, + want: []string{"sensor_1", "sensor_11", "sensor_12"}, + }, + { + name: "no sensors", + sensors: nil, + want: []string{}, + }, + } { + t.Run(tc.name, func(t *testing.T) { + got := resolveSensorNames(tc.sensors) + if len(got) != len(tc.want) { + t.Fatalf("got %d labels, want %d: %q", len(got), len(tc.want), got) + } + for i := range tc.want { + if got[i] != tc.want[i] { + t.Errorf("label %d: got %q, want %q", i, got[i], tc.want[i]) + } + } + + seen := make(map[string]struct{}, len(got)) + for _, l := range got { + if _, dup := seen[l]; dup { + t.Errorf("duplicate label %q", l) + } + seen[l] = struct{}{} + } + }) + } +} + +// Every reading must be reported. Sensors sharing a product name are +// disambiguated rather than dropped. +func TestResolveSensorNamesKeepsEveryReading(t *testing.T) { + sensors := []thermalSensor{ + {name: "a", location: "1", registryID: "10"}, + {name: "a", location: "1", registryID: "11"}, + {name: "a", location: "2", registryID: "12"}, + {name: "b", location: "1", registryID: "13"}, + } + + got := resolveSensorNames(sensors) + if len(got) != len(sensors) { + t.Fatalf("got %d labels for %d sensors", len(got), len(sensors)) + } + + seen := make(map[string]struct{}, len(got)) + for _, l := range got { + if _, dup := seen[l]; dup { + t.Errorf("duplicate label %q", l) + } + seen[l] = struct{}{} + } +} diff --git a/collector/thermal_darwin_test.go b/collector/thermal_darwin_test.go new file mode 100644 index 0000000000..59bb5b2043 --- /dev/null +++ b/collector/thermal_darwin_test.go @@ -0,0 +1,89 @@ +// Copyright The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//go:build !notherm && darwin && cgo + +package collector + +import ( + "errors" + "io" + "log/slog" + "strings" + "testing" + + "github.com/prometheus/client_golang/prometheus" + dto "github.com/prometheus/client_model/go" +) + +// Apple Silicon does not implement IOPMCopyCPUPowerStatus, so fetchCPUPowerStatus +// reports errNoCPUPowerStatus there. That is an expected condition and must not +// abort the collector, otherwise the temperature sensors, which are read after +// the CPU power status, are never collected. +func TestThermalUpdateWithoutCPUPowerStatus(t *testing.T) { + logger := slog.New(slog.NewTextHandler(io.Discard, nil)) + + c, err := NewThermCollector(logger) + if err != nil { + t.Fatalf("failed to create collector: %v", err) + } + + ch := make(chan prometheus.Metric, 1024) + err = c.Update(ch) + close(ch) + + if errors.Is(err, errNoCPUPowerStatus) { + t.Fatal("Update returned errNoCPUPowerStatus; a system without CPU power status must still collect temperatures") + } + if err != nil { + t.Fatalf("Update failed: %v", err) + } +} + +// Several IOHID services report the same product name, so the collector must +// qualify the colliding ones. Duplicate label sets are rejected by the registry +// and fail the whole scrape. +func TestThermalTemperaturesAreUnique(t *testing.T) { + logger := slog.New(slog.NewTextHandler(io.Discard, nil)) + + c, err := NewThermCollector(logger) + if err != nil { + t.Fatalf("failed to create collector: %v", err) + } + + ch := make(chan prometheus.Metric, 4096) + if err := c.Update(ch); err != nil { + t.Fatalf("Update failed: %v", err) + } + close(ch) + + seen := make(map[string]struct{}) + for m := range ch { + var pb dto.Metric + if err := m.Write(&pb); err != nil { + t.Fatalf("cannot read metric: %v", err) + } + + var key strings.Builder + key.WriteString(m.Desc().String()) + for _, l := range pb.GetLabel() { + key.WriteString("," + l.GetName() + "=" + l.GetValue()) + } + + id := key.String() + if _, duplicate := seen[id]; duplicate { + t.Errorf("duplicate metric collected: %s", id) + } + seen[id] = struct{}{} + } +} From b9e296a911c8beaf89177362e75cc80bfa89eb7e Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Thu, 22 Oct 2026 08:16:35 +0100 Subject: [PATCH 55/87] chore: Document ErrNoData policy (#3864) Add some notes in the README and CONTRIBUTING docs about collectors that are unable to find _any_ data. This policy was decided in https://github.com/prometheus/node_exporter/issues/1323. Signed-off-by: Ben Kochie --- CONTRIBUTING.md | 5 +++++ README.md | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 46f65e80c6..1eee7e9d26 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,3 +46,8 @@ dedicated exporter instead or gather the metrics via the textfile collector. The Node Exporter tries to support the most common machine metrics. For more exotic metrics, use the textfile collector or a dedicated Exporter. + +Collectors should return `ErrNoData` when they can not find any metrics to collect. +This is intentional as it provides a means for users to differentiate between +the desired system configuration and the running configuration. For example if +a system has a piece of hardware but the driver fails to load. diff --git a/README.md b/README.md index 1b73976b07..673ad34153 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,15 @@ Collectors are enabled by providing a `--collector.` flag. Collectors that are enabled by default can be disabled by providing a `--no-collector.` flag. To enable only some specific collector(s), use `--collector.disable-defaults --collector. ...`. +There are two meta-monitoring metrics available for checking the status of collectors. + + node_scrape_collector_success + node_scrape_collector_duration_seconds + +Note that if a configured collector reads no data because it can't find a file in `/proc` or `/sys`, +the success status will be 0. This is intentional to provide a way to detect faild drivers and similar +problems. + ### Include & Exclude flags A few collectors can be configured to include or exclude certain patterns using dedicated flags. The exclude flags are used to indicate "all except", while the include flags are used to say "none except". Note that these flags are mutually exclusive on collectors that support both. From f37c4cdea9a60fe0cc9c348a8af6ef501ef0c187 Mon Sep 17 00:00:00 2001 From: scarlet-storm <12461256+scarlet-storm@users.noreply.github.com> Date: Sat, 24 Oct 2026 22:44:33 +0530 Subject: [PATCH 56/87] nvme: Update nvme collector to support api changes in procfs (#3865) * deps: bump prometheus/procfs from 0.22.0 to 0.23.0 * nvme: Update nvme metrics to support changes in procfs api New procfs api removes the namespace usage fields from the struct and adds a new method for fetching the used blocks. Update the nvme collector to support the changes. Also adds an option to disable nvme namespace usage metric. It is enabled by default and can be disabled if desired via the flag --no-collector.nvme.namespace-usage. A namespace without a nuse file is skipped with a debug message. A read error, for example EIO which can be returned when the controller is not live, is logged and the other namespaces are still collected. Assisted-by: Claude Code (Claude Sonnet 5.5) Signed-off-by: scarlet-storm <12461256+scarlet-storm@users.noreply.github.com> --------- Signed-off-by: scarlet-storm <12461256+scarlet-storm@users.noreply.github.com> --- collector/fixtures/e2e-64k-page-output.txt | 6 ++-- collector/fixtures/e2e-output.txt | 6 ++-- collector/nvme_linux.go | 32 ++++++++++++++++------ go.mod | 2 +- go.sum | 4 +-- 5 files changed, 33 insertions(+), 17 deletions(-) diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index 18a34815ba..1b74382203 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -3514,9 +3514,9 @@ node_nfsd_server_threads 8 # HELP node_nvme_info Non-numeric data from /sys/class/nvme/, value is always 1. # TYPE node_nvme_info gauge node_nvme_info{cntlid="1997",device="nvme0",firmware_revision="1B2QEXP7",model="Samsung SSD 970 PRO 512GB",serial="S680HF8N190894I",state="live"} 1 -# HELP node_nvme_namespace_capacity_bytes Capacity of the NVMe namespace in bytes. Computed as namespace_size * namespace_logical_block_size +# HELP node_nvme_namespace_capacity_bytes Capacity of the NVMe namespace in bytes. # TYPE node_nvme_namespace_capacity_bytes gauge -node_nvme_namespace_capacity_bytes{device="nvme0",nsid="1"} 1.6e+13 +node_nvme_namespace_capacity_bytes{device="nvme0",nsid="1"} 2e+12 # HELP node_nvme_namespace_info Information about NVMe namespaces. Value is always 1 # TYPE node_nvme_namespace_info gauge node_nvme_namespace_info{ana_state="optimized",device="nvme0",nsid="1"} 1 @@ -3525,7 +3525,7 @@ node_nvme_namespace_info{ana_state="optimized",device="nvme0",nsid="1"} 1 node_nvme_namespace_logical_block_size_bytes{device="nvme0",nsid="1"} 4096 # HELP node_nvme_namespace_size_bytes Size of the NVMe namespace in bytes. Available in /sys/class/nvme///size # TYPE node_nvme_namespace_size_bytes gauge -node_nvme_namespace_size_bytes{device="nvme0",nsid="1"} 1.6e+13 +node_nvme_namespace_size_bytes{device="nvme0",nsid="1"} 2e+12 # HELP node_nvme_namespace_used_bytes Used space of the NVMe namespace in bytes. Available in /sys/class/nvme///nuse # TYPE node_nvme_namespace_used_bytes gauge node_nvme_namespace_used_bytes{device="nvme0",nsid="1"} 2e+12 diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index 0c91a90300..4dd448d5c6 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -3536,9 +3536,9 @@ node_nfsd_server_threads 8 # HELP node_nvme_info Non-numeric data from /sys/class/nvme/, value is always 1. # TYPE node_nvme_info gauge node_nvme_info{cntlid="1997",device="nvme0",firmware_revision="1B2QEXP7",model="Samsung SSD 970 PRO 512GB",serial="S680HF8N190894I",state="live"} 1 -# HELP node_nvme_namespace_capacity_bytes Capacity of the NVMe namespace in bytes. Computed as namespace_size * namespace_logical_block_size +# HELP node_nvme_namespace_capacity_bytes Capacity of the NVMe namespace in bytes. # TYPE node_nvme_namespace_capacity_bytes gauge -node_nvme_namespace_capacity_bytes{device="nvme0",nsid="1"} 1.6e+13 +node_nvme_namespace_capacity_bytes{device="nvme0",nsid="1"} 2e+12 # HELP node_nvme_namespace_info Information about NVMe namespaces. Value is always 1 # TYPE node_nvme_namespace_info gauge node_nvme_namespace_info{ana_state="optimized",device="nvme0",nsid="1"} 1 @@ -3547,7 +3547,7 @@ node_nvme_namespace_info{ana_state="optimized",device="nvme0",nsid="1"} 1 node_nvme_namespace_logical_block_size_bytes{device="nvme0",nsid="1"} 4096 # HELP node_nvme_namespace_size_bytes Size of the NVMe namespace in bytes. Available in /sys/class/nvme///size # TYPE node_nvme_namespace_size_bytes gauge -node_nvme_namespace_size_bytes{device="nvme0",nsid="1"} 1.6e+13 +node_nvme_namespace_size_bytes{device="nvme0",nsid="1"} 2e+12 # HELP node_nvme_namespace_used_bytes Used space of the NVMe namespace in bytes. Available in /sys/class/nvme///nuse # TYPE node_nvme_namespace_used_bytes gauge node_nvme_namespace_used_bytes{device="nvme0",nsid="1"} 2e+12 diff --git a/collector/nvme_linux.go b/collector/nvme_linux.go index dff757c7bd..ef95ee608b 100644 --- a/collector/nvme_linux.go +++ b/collector/nvme_linux.go @@ -21,10 +21,13 @@ import ( "log/slog" "os" + "github.com/alecthomas/kingpin/v2" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/procfs/sysfs" ) +var nvmeNamespaceUsage = kingpin.Flag("collector.nvme.namespace-usage", "Expose namespace used bytes (reads nuse, which makes the kernel query the controller).").Default("true").Bool() + type nvmeCollector struct { fs sysfs.FS logger *slog.Logger @@ -49,7 +52,7 @@ var ( nvmeNamespaceCapacityBytes = prometheus.NewDesc( prometheus.BuildFQName(namespace, "nvme", "namespace_capacity_bytes"), - "Capacity of the NVMe namespace in bytes. Computed as namespace_size * namespace_logical_block_size", + "Capacity of the NVMe namespace in bytes.", []string{"device", "nsid"}, nil, ) @@ -139,13 +142,26 @@ func (c *nvmeCollector) Update(ch chan<- prometheus.Metric) error { ) // Namespace used space in bytes - ch <- prometheus.MustNewConstMetric( - nvmeNamespaceUsedBytes, - prometheus.GaugeValue, - float64(namespace.UsedBytes), - device.Name, - namespace.ID, - ) + if *nvmeNamespaceUsage { + usedBlocks, err := namespace.UsedBlocks() + if err != nil { + // The kernel queries the controller on read, so this can + // fail, e.g. with EIO if the controller is not live. + // Keep collecting the other namespaces. + c.logger.Warn("Could not read NVMe namespace usage", "device", device.Name, "namespace", namespace.Name, "err", err) + } else if usedBlocks == nil { + c.logger.Debug("NVMe namespace nuse file not present, skipping", "device", device.Name, "namespace", namespace.Name) + } else { + usedBytes := *usedBlocks * namespace.LogicalBlockSize + ch <- prometheus.MustNewConstMetric( + nvmeNamespaceUsedBytes, + prometheus.GaugeValue, + float64(usedBytes), + device.Name, + namespace.ID, + ) + } + } // Namespace logical block size in bytes ch <- prometheus.MustNewConstMetric( diff --git a/go.mod b/go.mod index 943fb173c3..0ece4bb32c 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,7 @@ require ( github.com/prometheus/client_model v0.6.3 github.com/prometheus/common v0.72.1 github.com/prometheus/exporter-toolkit v0.20.0 - github.com/prometheus/procfs v0.22.0 + github.com/prometheus/procfs v0.23.0 github.com/safchain/ethtool v0.7.0 golang.org/x/sys v0.49.0 howett.net/plist v1.0.1 diff --git a/go.sum b/go.sum index 12ea361f53..dac01056a1 100644 --- a/go.sum +++ b/go.sum @@ -82,8 +82,8 @@ github.com/prometheus/common v0.72.1 h1:ZAiQed/nk8IIcsdzb2TlJu23NEUDyDLQ9TXTN2WR github.com/prometheus/common v0.72.1/go.mod h1:1IoBY4IRaJnhs2ESjNzjilP1cJ/P8pimGoomq7zRXrA= github.com/prometheus/exporter-toolkit v0.20.0 h1:hz3g2aPcq3mXlQSt1MGjj2rwVk1wtRalF+/FjYxFRkI= github.com/prometheus/exporter-toolkit v0.20.0/go.mod h1:gIIY0Mw0ci1wgYscdeMqVh6FUPYJca549eOkE39nU64= -github.com/prometheus/procfs v0.22.0 h1:6q9+/JL9IKAPbCmBrv9n5O5Ty3NKnciV5X7YGw0oics= -github.com/prometheus/procfs v0.22.0/go.mod h1:CvmFr/GVhIjIvWJZW3tgkODBQMRIf0EyWMQLHCHab58= +github.com/prometheus/procfs v0.23.0 h1:ad+S6FTkzwaMgacKLM5h6bNKExS+DMH0YiUwXItH/o4= +github.com/prometheus/procfs v0.23.0/go.mod h1:3AVXO0FqLafyYFU/V/IQRZlC8Rgqz8Dm/x6pKLK+RIk= github.com/safchain/ethtool v0.7.0 h1:rlJzfDetsVvT61uz8x1YIcFn12akMfuPulHtZjtb7Is= github.com/safchain/ethtool v0.7.0/go.mod h1:MenQKEjXdfkjD3mp2QdCk8B/hwvkrlOTm/FD4gTpFxQ= github.com/siebenmann/go-kstat v0.0.0-20210513183136-173c9b0a9973 h1:GfSdC6wKfTGcgCS7BtzF5694Amne1pGCSTY252WhlEY= From 32d5bccdaff4ede0b0412af4536ce83ee7ab5f6e Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Mon, 26 Oct 2026 19:58:41 +0000 Subject: [PATCH 57/87] edac: Fix no data results (#3863) * edac: Fix no data results Return `ErrNoData` for the edac collector if it's enabled and no data is returned. This follows the collector policy of not returning succes for collectors that can't find their subsystems. Signed-off-by: Ben Kochie * Fixup BtreeReadAverageDurationMicroSeconds. Signed-off-by: Ben Kochie --------- Signed-off-by: Ben Kochie --- CHANGELOG.md | 2 ++ collector/bcache_linux.go | 4 +--- collector/edac_linux.go | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f6040344b..bd4f978795 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## master / unreleased +* [CHANGE] edac: Fix no data results #3863 + ## 1.12.1 / 2026-07-14 * [BUGFIX] perf: Fix perf profiler flag handling #3731 diff --git a/collector/bcache_linux.go b/collector/bcache_linux.go index 4fc647667e..6b7d20954e 100644 --- a/collector/bcache_linux.go +++ b/collector/bcache_linux.go @@ -211,12 +211,10 @@ func (c *bcacheCollector) updateBcacheStats(ch chan<- prometheus.Metric, s *bcac value: float64(s.Bcache.Internal.BtreeNodes), metricType: prometheus.GaugeValue, }, - // procfs names the field NanoSeconds, but it holds the raw value of - // btree_read_average_duration_us, which the kernel reports in microseconds. { name: "btree_read_average_duration_seconds", desc: "Average btree read duration.", - value: float64(s.Bcache.Internal.BtreeReadAverageDurationNanoSeconds) * 1e-6, + value: float64(s.Bcache.Internal.BtreeReadAverageDurationMicroSeconds) * 1e-6, metricType: prometheus.GaugeValue, }, { diff --git a/collector/edac_linux.go b/collector/edac_linux.go index f5f95c2075..c0d83540c0 100644 --- a/collector/edac_linux.go +++ b/collector/edac_linux.go @@ -102,6 +102,10 @@ func (c *edacCollector) Update(ch chan<- prometheus.Metric) error { if err != nil { return err } + if len(memControllers) == 0 { + c.logger.Debug("edac collector metrics are not available for this system") + return ErrNoData + } for _, controller := range memControllers { controllerMatch := edacMemControllerRE.FindStringSubmatch(controller) if controllerMatch == nil { From ba07136b4ad3d7da08e4a1a4275b06efefd718d5 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Wed, 28 Oct 2026 14:49:32 +0000 Subject: [PATCH 58/87] Skip ethtool tests in 32-bit (#3873) The ethtool collector is having issues running in 32-bit cross-compile test mode on GitHub Actions runners. Disable it with `noethtool` for the 32-bit cross compatibility test. Signed-off-by: Ben Kochie --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9f04802144..5a315ca351 100644 --- a/Makefile +++ b/Makefile @@ -93,7 +93,7 @@ test: collector/fixtures/sys/.unpacked collector/fixtures/udev/.unpacked .PHONY: test-32bit test-32bit: collector/fixtures/sys/.unpacked collector/fixtures/udev/.unpacked @echo ">> running tests in 32-bit mode" - @env GOARCH=$(GOARCH_CROSS) $(GO) test $(pkgs) + @env GOARCH=$(GOARCH_CROSS) $(GO) test -tags noethtool $(pkgs) .PHONY: skip-test-32bit skip-test-32bit: From ced20b37d5b96b9b4be5c738c03d7a2eecf0f4e5 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Thu, 29 Oct 2026 08:28:47 +0000 Subject: [PATCH 59/87] Fix Darwin fixture (#3874) Mark the Darwin `node_memory_total_bytes` metric as unstable as it depends on the size of the runner. Signed-off-by: Ben Kochie --- collector/fixtures/e2e-output-darwin.txt | 3 --- end-to-end-test.sh | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/collector/fixtures/e2e-output-darwin.txt b/collector/fixtures/e2e-output-darwin.txt index b9183e39ff..4b585f45d4 100644 --- a/collector/fixtures/e2e-output-darwin.txt +++ b/collector/fixtures/e2e-output-darwin.txt @@ -111,9 +111,6 @@ node_memory_swap_total_bytes 0 # HELP node_memory_swap_used_bytes Memory information field swap_used_bytes. # TYPE node_memory_swap_used_bytes gauge node_memory_swap_used_bytes 0 -# HELP node_memory_total_bytes Memory information field total_bytes. -# TYPE node_memory_total_bytes gauge -node_memory_total_bytes 7.516192768e+09 # HELP node_network_noproto_total Network device statistic noproto. # TYPE node_network_noproto_total counter node_network_noproto_total{device="lo0"} 0 diff --git a/end-to-end-test.sh b/end-to-end-test.sh index 2c947d8446..c50e746aac 100755 --- a/end-to-end-test.sh +++ b/end-to-end-test.sh @@ -368,6 +368,7 @@ non_deterministic_metrics=$(cat << METRICS node_memory_swapped_in_bytes_total node_memory_swapped_out_bytes_total node_memory_swap_size_bytes + node_memory_total_bytes node_memory_wired_bytes node_netstat_tcp_receive_packets_total node_netstat_tcp_transmit_packets_total From 4c3e3f3eee1fda41eacff23c5f7224c3eb7c18ab Mon Sep 17 00:00:00 2001 From: Arthur Silva Sens Date: Thu, 29 Oct 2026 09:19:02 -0300 Subject: [PATCH 60/87] test: use checked-in fixtures instead of writing static inputs (#3876) Signed-off-by: Arthur Silva Sens --- AGENTS.md | 2 + collector/diskstats_linux_test.go | 27 +- collector/fixtures/sys.ttar | 702 ++++++++++++------ .../textfile/duplicate_metrics/a.prom | 1 + .../textfile/duplicate_metrics/b.prom | 1 + .../fixtures/textfile/utf8_names/test.prom | 3 + collector/hwmon_linux_test.go | 124 +--- collector/textfile_test.go | 12 +- node_exporter_test.go | 16 +- 9 files changed, 476 insertions(+), 412 deletions(-) create mode 100644 collector/fixtures/textfile/duplicate_metrics/a.prom create mode 100644 collector/fixtures/textfile/duplicate_metrics/b.prom create mode 100644 collector/fixtures/textfile/utf8_names/test.prom diff --git a/AGENTS.md b/AGENTS.md index 144e10e532..3c3f28cac1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -17,6 +17,8 @@ - Lint/format shortcuts: `make format`, `make lint`, `make lint-fix`, `make yamllint`, `make unused`. ## Fixtures And Generated Outputs +- Tests that only read filesystem data must use checked-in fixtures instead of creating static input files with `os.WriteFile` or similar APIs. Extend existing fixture-driven test tables where possible. +- Parser tests accepting `io.Reader` should use in-memory readers. Reserve temporary filesystem setup for tests that require isolation or exercise filesystem changes; explain why checked-in fixtures are insufficient. - Do not edit unpacked `collector/fixtures/sys/` or `collector/fixtures/udev/` as source of truth; update `collector/fixtures/sys.ttar` and `collector/fixtures/udev.ttar` with `make update_fixtures`. - To refresh e2e metric golden files, run `make build tools` first, then `./end-to-end-test.sh -u`; it writes the appropriate `collector/fixtures/e2e-output*.txt`. - `end-to-end-test.sh` filters collector flags by OS/build context using `tools/tools match`, so an ignored flag in e2e may mean the collector is build-tag-gated for that platform rather than broken (see `Rules`). diff --git a/collector/diskstats_linux_test.go b/collector/diskstats_linux_test.go index f7891f27e4..d8190c0cf0 100644 --- a/collector/diskstats_linux_test.go +++ b/collector/diskstats_linux_test.go @@ -19,8 +19,6 @@ import ( "fmt" "io" "log/slog" - "os" - "path/filepath" "strings" "testing" @@ -363,30 +361,7 @@ node_disk_written_bytes_total{device="vda"} 1.0938236928e+11 // not exist (preserving backward compatibility with the previous // SysBlockDeviceQueueStats zero-value behaviour, issue #3282). func TestRotationalLabel(t *testing.T) { - tempProc := t.TempDir() - tempSys := t.TempDir() - - // Create a valid rotational=1 file (HDD). - err := os.MkdirAll(filepath.Join(tempSys, "block/sda/queue"), 0o755) - if err != nil { - t.Fatal(err) - } - err = os.WriteFile(filepath.Join(tempSys, "block/sda/queue/rotational"), []byte("1\n"), 0o644) - if err != nil { - t.Fatal(err) - } - - // Create a rotational=0 file (SSD). - err = os.MkdirAll(filepath.Join(tempSys, "block/sdb/queue"), 0o755) - if err != nil { - t.Fatal(err) - } - err = os.WriteFile(filepath.Join(tempSys, "block/sdb/queue/rotational"), []byte("0\n"), 0o644) - if err != nil { - t.Fatal(err) - } - - fs, err := blockdevice.NewFS(tempProc, tempSys) + fs, err := blockdevice.NewFS("fixtures/proc", "fixtures/sys/diskstats") if err != nil { t.Fatal(err) } diff --git a/collector/fixtures/sys.ttar b/collector/fixtures/sys.ttar index aa08e991c6..5c4388faec 100644 --- a/collector/fixtures/sys.ttar +++ b/collector/fixtures/sys.ttar @@ -50,6 +50,108 @@ Mode: 755 Path: sys/block/dm-4/slaves/dm-0 SymlinkTo: ../dm-0 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-5 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-5/dm +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-5/dm/name +Lines: 1 +mpathAEOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-5/dm/suspended +Lines: 1 +0EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-5/dm/uuid +Lines: 1 +mpath-3600508b1001c1234567890abcdef1234EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-5/size +Lines: 1 +104857600EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-5/slaves +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-5/slaves/sdi +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-5/slaves/sdj +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-5/slaves/sdk +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-5/slaves/sdl +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-6 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-6/dm +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-6/dm/name +Lines: 1 +mpathBEOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-6/dm/suspended +Lines: 1 +0EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-6/dm/uuid +Lines: 1 +mpath-3600508b1001cabcdef4567890123456EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-6/size +Lines: 1 +209715200EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-6/slaves +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-6/slaves/sdm +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-6/slaves/sdn +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-7 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/block/dm-7/dm +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-7/dm/name +Lines: 1 +vg0-rootEOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-7/dm/suspended +Lines: 1 +0EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-7/dm/uuid +Lines: 1 +LVM-abcdef1234567890abcdef1234567890EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/block/dm-7/size +Lines: 1 +41943040EOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: sys/block/md0 Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -871,108 +973,6 @@ Lines: 1 none Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/block/dm-5 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/block/dm-5/dm -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/block/dm-5/dm/name -Lines: 1 -mpathAEOF -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/block/dm-5/dm/suspended -Lines: 1 -0EOF -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/block/dm-5/dm/uuid -Lines: 1 -mpath-3600508b1001c1234567890abcdef1234EOF -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/block/dm-5/size -Lines: 1 -104857600EOF -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/block/dm-5/slaves -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/block/dm-5/slaves/sdi -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/block/dm-5/slaves/sdj -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/block/dm-5/slaves/sdk -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/block/dm-5/slaves/sdl -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/block/dm-6 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/block/dm-6/dm -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/block/dm-6/dm/name -Lines: 1 -mpathBEOF -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/block/dm-6/dm/suspended -Lines: 1 -0EOF -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/block/dm-6/dm/uuid -Lines: 1 -mpath-3600508b1001cabcdef4567890123456EOF -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/block/dm-6/size -Lines: 1 -209715200EOF -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/block/dm-6/slaves -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/block/dm-6/slaves/sdm -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/block/dm-6/slaves/sdn -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/block/dm-7 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/block/dm-7/dm -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/block/dm-7/dm/name -Lines: 1 -vg0-rootEOF -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/block/dm-7/dm/suspended -Lines: 1 -0EOF -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/block/dm-7/dm/uuid -Lines: 1 -LVM-abcdef1234567890abcdef1234567890EOF -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/block/dm-7/size -Lines: 1 -41943040EOF -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: sys/block/sdi Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1501,6 +1501,9 @@ SymlinkTo: ../../devices/platform/coretemp.0/hwmon/hwmon0 Path: sys/class/hwmon/hwmon1 SymlinkTo: ../../devices/platform/coretemp.1/hwmon/hwmon1 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/hwmon/hwmon10 +SymlinkTo: ../../devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon10 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: sys/class/hwmon/hwmon2 SymlinkTo: ../../devices/platform/applesmc.768/hwmon/hwmon2 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1595,9 +1598,6 @@ SymlinkTo: ../../devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon8 Path: sys/class/hwmon/hwmon9 SymlinkTo: ../../devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon9 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/class/hwmon/hwmon10 -SymlinkTo: ../../devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon10 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: sys/class/infiniband Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2518,16 +2518,6 @@ Lines: 1 Samsung SSD 970 PRO 512GB Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/class/nvme/nvme0/serial -Lines: 1 -S680HF8N190894I -Mode: 444 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/class/nvme/nvme0/state -Lines: 1 -live -Mode: 444 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: sys/class/nvme/nvme0/nvme0n1 Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2536,11 +2526,6 @@ Lines: 1 optimized Mode: 444 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/class/nvme/nvme0/nvme0n1/size -Lines: 1 -3906250000 -Mode: 444 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: sys/class/nvme/nvme0/nvme0n1/nuse Lines: 1 488281250 @@ -2554,6 +2539,21 @@ Lines: 1 4096 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/nvme/nvme0/nvme0n1/size +Lines: 1 +3906250000 +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/nvme/nvme0/serial +Lines: 1 +S680HF8N190894I +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/class/nvme/nvme0/state +Lines: 1 +live +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: sys/class/nvme-subsystem Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -8640,77 +8640,14 @@ Lines: 1 2 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/devices/platform/soc -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/devices/platform/soc/18000000.wifi -Mode: 755 +Directory: sys/devices/platform/bogus.0 +Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/devices/platform/soc/18000000.wifi/ieee80211 -Mode: 755 +Directory: sys/devices/platform/bogus.0/hwmon +Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon8 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon8/device -SymlinkTo: ../.. -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon8/name -Lines: 1 -mt7996_phy0_0 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon8/temp1_input -Lines: 1 -55000 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon9 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon9/device -SymlinkTo: ../.. -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon9/name -Lines: 1 -mt7996_phy0_1 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon9/temp1_input -Lines: 1 -56000 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon10 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon10/device -SymlinkTo: ../.. -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon10/name -Lines: 1 -mt7996_phy0_2 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon10/temp1_input -Lines: 1 -57000 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/devices/platform/bogus.0 -Mode: 775 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/devices/platform/bogus.0/hwmon -Mode: 775 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/devices/platform/bogus.0/hwmon/hwmon5 -Mode: 775 +Directory: sys/devices/platform/bogus.0/hwmon/hwmon5 +Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: sys/devices/platform/bogus.0/hwmon/hwmon5/bogus1_crit Lines: 1 @@ -9280,6 +9217,69 @@ Lines: 1 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/devices/platform/soc +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/devices/platform/soc/18000000.wifi +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/devices/platform/soc/18000000.wifi/ieee80211 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon10 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon10/device +SymlinkTo: ../.. +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon10/name +Lines: 1 +mt7996_phy0_2 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon10/temp1_input +Lines: 1 +57000 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon8 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon8/device +SymlinkTo: ../.. +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon8/name +Lines: 1 +mt7996_phy0_0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon8/temp1_input +Lines: 1 +55000 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon9 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon9/device +SymlinkTo: ../.. +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon9/name +Lines: 1 +mt7996_phy0_1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/devices/platform/soc/18000000.wifi/ieee80211/phy0/hwmon/hwmon9/temp1_input +Lines: 1 +56000 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: sys/devices/system Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -9675,25 +9675,24 @@ Mode: 644 Directory: sys/devices/system/edac/mc/mc0/csrow0 Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow0/ch0_ce_count +Path: sys/devices/system/edac/mc/mc0/csrow0/ce_count Lines: 1 -0 +3 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/devices/system/edac/mc/mc0/csrow1 -Mode: 755 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow1/ch0_ce_count +Path: sys/devices/system/edac/mc/mc0/csrow0/ch0_ce_count Lines: 1 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Directory: sys/devices/system/edac/mc/mc0/csrow2 -Mode: 755 +Path: sys/devices/system/edac/mc/mc0/csrow0/ch0_dimm_label +Lines: 1 +mc0csrow0channel0 +Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow2/ch0_ce_count +Path: sys/devices/system/edac/mc/mc0/csrow0/ch0_ue_count Lines: 1 -0 +2 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: sys/devices/system/edac/mc/mc0/csrow0/ch1_ce_count @@ -9701,104 +9700,105 @@ Lines: 1 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow1/ch1_ce_count +Path: sys/devices/system/edac/mc/mc0/csrow0/ch1_dimm_label Lines: 1 -0 +mc0csrow0channel1 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow2/ch1_ce_count +Path: sys/devices/system/edac/mc/mc0/csrow0/ch1_ue_count Lines: 1 -0 +2 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow0/ce_count +Path: sys/devices/system/edac/mc/mc0/csrow0/ue_count Lines: 1 -3 +4 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow0/ch0_ue_count +Directory: sys/devices/system/edac/mc/mc0/csrow1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/devices/system/edac/mc/mc0/csrow1/ce_count Lines: 1 -2 +0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow1/ch0_ue_count +Path: sys/devices/system/edac/mc/mc0/csrow1/ch0_ce_count Lines: 1 -2 +0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow0/ch1_ue_count +Path: sys/devices/system/edac/mc/mc0/csrow1/ch0_dimm_label Lines: 1 -2 +mc0csrow1channel0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow1/ch1_ue_count +Path: sys/devices/system/edac/mc/mc0/csrow1/ch0_ue_count Lines: 1 2 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow1/ce_count +Path: sys/devices/system/edac/mc/mc0/csrow1/ch1_ce_count Lines: 1 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow1/ue_count -Lines: 1 -4 -Mode: 644 -# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow2/ce_count +Path: sys/devices/system/edac/mc/mc0/csrow1/ch1_dimm_label Lines: 1 -0 +mc0csrow1channel1 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow2/ue_count +Path: sys/devices/system/edac/mc/mc0/csrow1/ch1_ue_count Lines: 1 -5 +2 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow0/ue_count +Path: sys/devices/system/edac/mc/mc0/csrow1/ue_count Lines: 1 4 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/ue_count +Directory: sys/devices/system/edac/mc/mc0/csrow2 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/devices/system/edac/mc/mc0/csrow2/ce_count Lines: 1 -5 +0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/ue_noinfo_count +Path: sys/devices/system/edac/mc/mc0/csrow2/ch0_ce_count Lines: 1 -6 +0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow0/ch0_dimm_label +Path: sys/devices/system/edac/mc/mc0/csrow2/ch0_dimm_label Lines: 1 -mc0csrow0channel0 +mc0csrow2channel0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow0/ch1_dimm_label +Path: sys/devices/system/edac/mc/mc0/csrow2/ch1_ce_count Lines: 1 -mc0csrow0channel1 +0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow1/ch0_dimm_label +Path: sys/devices/system/edac/mc/mc0/csrow2/ch1_dimm_label Lines: 1 -mc0csrow1channel0 +mc0csrow2channel1 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow1/ch1_dimm_label +Path: sys/devices/system/edac/mc/mc0/csrow2/ue_count Lines: 1 -mc0csrow1channel1 +5 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow2/ch0_dimm_label +Path: sys/devices/system/edac/mc/mc0/ue_count Lines: 1 -mc0csrow2channel0 +5 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Path: sys/devices/system/edac/mc/mc0/csrow2/ch1_dimm_label +Path: sys/devices/system/edac/mc/mc0/ue_noinfo_count Lines: 1 -mc0csrow2channel1 +6 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: sys/devices/system/node @@ -10011,6 +10011,34 @@ Lines: 1 cpu-thermal Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/diskstats +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/diskstats/block +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/diskstats/block/sda +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/diskstats/block/sda/queue +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/diskstats/block/sda/queue/rotational +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/diskstats/block/sdb +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/diskstats/block/sdb/queue +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/diskstats/block/sdb/queue/rotational +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: sys/fs Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -12057,6 +12085,202 @@ xpc 3571712 3568056 0 debug 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/duplicate_chip_names +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/duplicate_chip_names/class +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/duplicate_chip_names/class/hwmon +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/duplicate_chip_names/class/hwmon/hwmon6 +SymlinkTo: ../../devices/platform/asus-nb-wmi/hwmon/hwmon6 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/duplicate_chip_names/class/hwmon/hwmon7 +SymlinkTo: ../../devices/platform/asus-nb-wmi/hwmon/hwmon7 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/duplicate_chip_names/devices +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/duplicate_chip_names/devices/platform +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/duplicate_chip_names/devices/platform/asus-nb-wmi +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/duplicate_chip_names/devices/platform/asus-nb-wmi/hwmon +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/duplicate_chip_names/devices/platform/asus-nb-wmi/hwmon/hwmon6 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/duplicate_chip_names/devices/platform/asus-nb-wmi/hwmon/hwmon6/device +SymlinkTo: ../.. +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/duplicate_chip_names/devices/platform/asus-nb-wmi/hwmon/hwmon6/name +Lines: 1 +asus +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/duplicate_chip_names/devices/platform/asus-nb-wmi/hwmon/hwmon6/pwm1 +Lines: 1 +128 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/duplicate_chip_names/devices/platform/asus-nb-wmi/hwmon/hwmon6/pwm1_enable +Lines: 1 +2 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/duplicate_chip_names/devices/platform/asus-nb-wmi/hwmon/hwmon7 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/duplicate_chip_names/devices/platform/asus-nb-wmi/hwmon/hwmon7/device +SymlinkTo: ../.. +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/duplicate_chip_names/devices/platform/asus-nb-wmi/hwmon/hwmon7/name +Lines: 1 +asus_wmi_sensors +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/duplicate_chip_names/devices/platform/asus-nb-wmi/hwmon/hwmon7/pwm1 +Lines: 1 +200 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/duplicate_chip_names/devices/platform/asus-nb-wmi/hwmon/hwmon7/pwm1_enable +Lines: 1 +2 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/same_name_file +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/same_name_file/class +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/same_name_file/class/hwmon +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/same_name_file/class/hwmon/hwmon3 +SymlinkTo: ../../devices/platform/asus-nb-wmi/hwmon/hwmon3 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/same_name_file/class/hwmon/hwmon4 +SymlinkTo: ../../devices/platform/asus-nb-wmi/hwmon/hwmon4 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/same_name_file/devices +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/same_name_file/devices/platform +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/same_name_file/devices/platform/asus-nb-wmi +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/same_name_file/devices/platform/asus-nb-wmi/hwmon +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/same_name_file/devices/platform/asus-nb-wmi/hwmon/hwmon3 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/same_name_file/devices/platform/asus-nb-wmi/hwmon/hwmon3/device +SymlinkTo: ../.. +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/same_name_file/devices/platform/asus-nb-wmi/hwmon/hwmon3/name +Lines: 1 +asus +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/same_name_file/devices/platform/asus-nb-wmi/hwmon/hwmon3/pwm1_enable +Lines: 1 +2 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/same_name_file/devices/platform/asus-nb-wmi/hwmon/hwmon4 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/same_name_file/devices/platform/asus-nb-wmi/hwmon/hwmon4/device +SymlinkTo: ../.. +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/same_name_file/devices/platform/asus-nb-wmi/hwmon/hwmon4/name +Lines: 1 +asus +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/same_name_file/devices/platform/asus-nb-wmi/hwmon/hwmon4/pwm1_enable +Lines: 1 +2 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/unique_chip_names +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/unique_chip_names/class +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/unique_chip_names/class/hwmon +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/unique_chip_names/class/hwmon/hwmon0 +SymlinkTo: ../../devices/platform/coretemp.0/hwmon/hwmon0 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/unique_chip_names/class/hwmon/hwmon1 +SymlinkTo: ../../devices/platform/coretemp.1/hwmon/hwmon1 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/unique_chip_names/devices +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/unique_chip_names/devices/platform +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/unique_chip_names/devices/platform/coretemp.0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/unique_chip_names/devices/platform/coretemp.0/hwmon +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/unique_chip_names/devices/platform/coretemp.0/hwmon/hwmon0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/unique_chip_names/devices/platform/coretemp.0/hwmon/hwmon0/device +SymlinkTo: ../.. +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/unique_chip_names/devices/platform/coretemp.0/hwmon/hwmon0/name +Lines: 1 +coretemp +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/unique_chip_names/devices/platform/coretemp.0/hwmon/hwmon0/temp1_input +Lines: 1 +42000 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/unique_chip_names/devices/platform/coretemp.1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/unique_chip_names/devices/platform/coretemp.1/hwmon +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: sys/hwmon/unique_chip_names/devices/platform/coretemp.1/hwmon/hwmon1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/unique_chip_names/devices/platform/coretemp.1/hwmon/hwmon1/device +SymlinkTo: ../.. +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/unique_chip_names/devices/platform/coretemp.1/hwmon/hwmon1/name +Lines: 1 +coretemp +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: sys/hwmon/unique_chip_names/devices/platform/coretemp.1/hwmon/hwmon1/temp1_input +Lines: 1 +43000 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: sys/kernel Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/collector/fixtures/textfile/duplicate_metrics/a.prom b/collector/fixtures/textfile/duplicate_metrics/a.prom new file mode 100644 index 0000000000..43deca5531 --- /dev/null +++ b/collector/fixtures/textfile/duplicate_metrics/a.prom @@ -0,0 +1 @@ +dummy_metric 1 diff --git a/collector/fixtures/textfile/duplicate_metrics/b.prom b/collector/fixtures/textfile/duplicate_metrics/b.prom new file mode 100644 index 0000000000..43deca5531 --- /dev/null +++ b/collector/fixtures/textfile/duplicate_metrics/b.prom @@ -0,0 +1 @@ +dummy_metric 1 diff --git a/collector/fixtures/textfile/utf8_names/test.prom b/collector/fixtures/textfile/utf8_names/test.prom new file mode 100644 index 0000000000..905eca59b9 --- /dev/null +++ b/collector/fixtures/textfile/utf8_names/test.prom @@ -0,0 +1,3 @@ +# HELP "my.dotted.metric" A metric with UTF-8 compatible names. +# TYPE "my.dotted.metric" gauge +{"my.dotted.metric", "error.message"="Not Found"} 1 diff --git a/collector/hwmon_linux_test.go b/collector/hwmon_linux_test.go index 3206b0e09d..24db47e32a 100644 --- a/collector/hwmon_linux_test.go +++ b/collector/hwmon_linux_test.go @@ -18,76 +18,12 @@ package collector import ( "io" "log/slog" - "os" - "path/filepath" "slices" "testing" "github.com/prometheus/client_golang/prometheus" ) -// fakeHwmon describes a single hwmon node to materialize under a temporary -// /sys layout. The collector's hwmonName function reads the parent of the -// `device` symlink to derive a chip label, which is what produces the -// collision we need to test. -type fakeHwmon struct { - hwmonDir string // e.g. "hwmon3" - device string // parent device dir name, e.g. "asus-nb-wmi". Empty disables the device symlink. - name string // contents of the optional `name` file - files map[string]string // sensor file basename -> content -} - -// buildFakeSysfs writes a minimal /sys tree containing the supplied hwmon -// nodes and returns the path that should be passed as *sysPath. Each -// non-empty `device` shares a common /sys/devices/platform/ -// directory so two hwmon entries can collide on chip name. -func buildFakeSysfs(t *testing.T, hwmons []fakeHwmon) string { - t.Helper() - - sysRoot := t.TempDir() - classHwmon := filepath.Join(sysRoot, "class", "hwmon") - if err := os.MkdirAll(classHwmon, 0o755); err != nil { - t.Fatalf("mkdir class/hwmon: %v", err) - } - - for _, h := range hwmons { - var hwmonReal string - if h.device != "" { - hwmonReal = filepath.Join(sysRoot, "devices", "platform", h.device, "hwmon", h.hwmonDir) - } else { - hwmonReal = filepath.Join(sysRoot, "devices", "virtual", "hwmon", h.hwmonDir) - } - if err := os.MkdirAll(hwmonReal, 0o755); err != nil { - t.Fatalf("mkdir %s: %v", hwmonReal, err) - } - - if h.device != "" { - deviceTarget := filepath.Join(sysRoot, "devices", "platform", h.device) - if err := os.Symlink(deviceTarget, filepath.Join(hwmonReal, "device")); err != nil { - t.Fatalf("symlink device: %v", err) - } - } - - if h.name != "" { - if err := os.WriteFile(filepath.Join(hwmonReal, "name"), []byte(h.name+"\n"), 0o644); err != nil { - t.Fatalf("write name: %v", err) - } - } - - for fname, content := range h.files { - if err := os.WriteFile(filepath.Join(hwmonReal, fname), []byte(content+"\n"), 0o644); err != nil { - t.Fatalf("write %s: %v", fname, err) - } - } - - if err := os.Symlink(hwmonReal, filepath.Join(classHwmon, h.hwmonDir)); err != nil { - t.Fatalf("symlink class/hwmon: %v", err) - } - } - - return sysRoot -} - // gatherChipLabels runs the collector through a registry and returns the // observed `chip` label values across all metrics. It also surfaces any // gather error — which is the failure mode #3637 reported. @@ -138,31 +74,9 @@ func newTestHwmonCollector() *hwMonCollector { // that triggered #3637 on ASUS WMI laptops — must produce distinct chip // labels and not error during gather. func TestHwmonDuplicateChipNamesAreDisambiguated(t *testing.T) { - hwmons := []fakeHwmon{ - { - hwmonDir: "hwmon6", - device: "asus-nb-wmi", - name: "asus", - files: map[string]string{ - "pwm1": "128", - "pwm1_enable": "2", - }, - }, - { - hwmonDir: "hwmon7", - device: "asus-nb-wmi", - name: "asus_wmi_sensors", - files: map[string]string{ - "pwm1": "200", - "pwm1_enable": "2", - }, - }, - } - - sysRoot := buildFakeSysfs(t, hwmons) prev := *sysPath t.Cleanup(func() { *sysPath = prev }) - *sysPath = sysRoot + *sysPath = "fixtures/sys/hwmon/duplicate_chip_names" chips, err := gatherChipLabels(t, newTestHwmonCollector()) if err != nil { @@ -185,25 +99,9 @@ func TestHwmonDuplicateChipNamesAreDisambiguated(t *testing.T) { // When chip names are already unique, the collector must leave them alone // — no surprise suffixes for unaffected users. func TestHwmonUniqueChipNamesAreUnchanged(t *testing.T) { - hwmons := []fakeHwmon{ - { - hwmonDir: "hwmon0", - device: "coretemp.0", - name: "coretemp", - files: map[string]string{"temp1_input": "42000"}, - }, - { - hwmonDir: "hwmon1", - device: "coretemp.1", - name: "coretemp", - files: map[string]string{"temp1_input": "43000"}, - }, - } - - sysRoot := buildFakeSysfs(t, hwmons) prev := *sysPath t.Cleanup(func() { *sysPath = prev }) - *sysPath = sysRoot + *sysPath = "fixtures/sys/hwmon/unique_chip_names" chips, err := gatherChipLabels(t, newTestHwmonCollector()) if err != nil { @@ -221,25 +119,9 @@ func TestHwmonUniqueChipNamesAreUnchanged(t *testing.T) { // disambiguator collapses too. We must still emit unique chip labels by // falling back to the hwmonX basename. func TestHwmonDuplicateChipNamesWithSameNameFile(t *testing.T) { - hwmons := []fakeHwmon{ - { - hwmonDir: "hwmon3", - device: "asus-nb-wmi", - name: "asus", - files: map[string]string{"pwm1_enable": "2"}, - }, - { - hwmonDir: "hwmon4", - device: "asus-nb-wmi", - name: "asus", - files: map[string]string{"pwm1_enable": "2"}, - }, - } - - sysRoot := buildFakeSysfs(t, hwmons) prev := *sysPath t.Cleanup(func() { *sysPath = prev }) - *sysPath = sysRoot + *sysPath = "fixtures/sys/hwmon/same_name_file" chips, err := gatherChipLabels(t, newTestHwmonCollector()) if err != nil { diff --git a/collector/textfile_test.go b/collector/textfile_test.go index 222ffa8fee..5b9f701ccd 100644 --- a/collector/textfile_test.go +++ b/collector/textfile_test.go @@ -22,7 +22,6 @@ import ( "net/http" "net/http/httptest" "os" - "path/filepath" "testing" "github.com/alecthomas/kingpin/v2" @@ -159,17 +158,8 @@ func TestTextfileCollector(t *testing.T) { } func TestTextfileCollectorSupportsUTF8Names(t *testing.T) { - dir := t.TempDir() - const input = `# HELP "my.dotted.metric" A metric with UTF-8 compatible names. -# TYPE "my.dotted.metric" gauge -{"my.dotted.metric", "error.message"="Not Found"} 1 -` - if err := os.WriteFile(filepath.Join(dir, "test.prom"), []byte(input), 0o600); err != nil { - t.Fatal(err) - } - c := &textFileCollector{ - paths: []string{dir}, + paths: []string{"fixtures/textfile/utf8_names"}, logger: slog.New(slog.NewTextHandler(io.Discard, nil)), } registry := prometheus.NewRegistry() diff --git a/node_exporter_test.go b/node_exporter_test.go index 4938475e7b..f80d7fe06d 100644 --- a/node_exporter_test.go +++ b/node_exporter_test.go @@ -82,21 +82,7 @@ func TestHandlingOfDuplicatedMetrics(t *testing.T) { t.Skipf("node_exporter binary not available, try to run `make build` first: %s", err) } - dir, err := os.MkdirTemp("", "node-exporter") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(dir) - - content := []byte("dummy_metric 1\n") - if err := os.WriteFile(filepath.Join(dir, "a.prom"), content, 0o600); err != nil { - t.Fatal(err) - } - if err := os.WriteFile(filepath.Join(dir, "b.prom"), content, 0o600); err != nil { - t.Fatal(err) - } - - exporter := exec.Command(binary, "--web.listen-address", address, "--collector.textfile.directory", dir) + exporter := exec.Command(binary, "--web.listen-address", address, "--collector.textfile.directory", "collector/fixtures/textfile/duplicate_metrics") test := func(_ int) error { return queryExporter(address) } From 3af7d9f3d6a1b583a0a00801385dbec79f84c411 Mon Sep 17 00:00:00 2001 From: Christoph Maser Date: Thu, 29 Oct 2026 19:13:53 +0100 Subject: [PATCH 61/87] ci: address zizmor findings (#3871) Signed-off-by: Christoph Maser --- .github/dependabot.yml | 4 ++++ .github/workflows/approve-workflows.yml | 4 +++- .github/workflows/ci.yml | 9 +++++---- .github/workflows/golangci-lint.yml | 1 + 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 57d8410442..4c7e6d7e41 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -23,6 +23,8 @@ updates: prometheus: patterns: - "github.com/prometheus/*" + cooldown: + default-days: 7 - package-ecosystem: "github-actions" directory: "/" schedule: @@ -42,3 +44,5 @@ updates: - .github/workflows/govulncheck.yml - .github/workflows/scorecards.yml - .github/workflows/stale.yml + cooldown: + default-days: 7 diff --git a/.github/workflows/approve-workflows.yml b/.github/workflows/approve-workflows.yml index 697118dfc1..75c370c832 100644 --- a/.github/workflows/approve-workflows.yml +++ b/.github/workflows/approve-workflows.yml @@ -2,10 +2,12 @@ ### # This action is synced from https://github.com/prometheus/prometheus ### + name: Approve pending workflows on: - issue_comment: + # The pinned action requires triage access or higher and only calls GitHub APIs. + issue_comment: # zizmor: ignore[dangerous-triggers] types: [created] permissions: read-all diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 861450dbdc..edd002a4d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,7 @@ jobs: - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version: 1.27.x + cache: false - run: uname -a - run: make test-e2e @@ -98,8 +99,8 @@ jobs: - uses: prometheus/promci-artifacts/restore@9ca3252d07f230d5f923452b4df5697eba4a5bee # v0.1.1 - name: Build docker image run: | - if [[ "${{ github.ref }}" == refs/tags/* ]]; then - make docker DOCKER_IMAGE_TAG=${{ github.ref_name }} + if [[ "${GITHUB_REF}" == refs/tags/* ]]; then + make docker DOCKER_IMAGE_TAG="${GITHUB_REF_NAME}" else make docker fi @@ -107,8 +108,8 @@ jobs: - run: docker run --rm -t -v "$(pwd):/app" "${DOCKER_TEST_IMAGE_NAME}" -i "${REPO_PATH}" -T - name: Test docker image run: | - if [[ "${{ github.ref }}" == refs/tags/* ]]; then - make test-docker DOCKER_IMAGE_TAG=${{ github.ref_name }} + if [[ "${GITHUB_REF}" == refs/tags/* ]]; then + make test-docker DOCKER_IMAGE_TAG="${GITHUB_REF_NAME}" else make test-docker fi diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index a2d392e188..af01db374b 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -33,6 +33,7 @@ jobs: uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version: 1.27.x + cache: false - name: Install snmp_exporter/generator dependencies run: sudo apt-get update && sudo apt-get -y install libsnmp-dev if: github.repository == 'prometheus/snmp_exporter' From 24b9b4de35ac69d7a3cdc6911c88f3d6f18f1489 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Mon, 2 Nov 2026 15:03:15 +0100 Subject: [PATCH 62/87] Update common Prometheus files (#3867) Signed-off-by: prombot --- .github/dependabot.yml | 9 +-- .github/workflows/approve-workflows.yml | 3 +- .github/workflows/golangci-lint.yml | 5 +- .github/workflows/zizmor.yml | 84 +++++++++++++++++++++++++ 4 files changed, 93 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/zizmor.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 4c7e6d7e41..5427560093 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,6 +7,8 @@ updates: directory: "/" schedule: interval: "monthly" + cooldown: + default-days: 7 groups: aws: patterns: @@ -23,12 +25,12 @@ updates: prometheus: patterns: - "github.com/prometheus/*" - cooldown: - default-days: 7 - package-ecosystem: "github-actions" directory: "/" schedule: interval: "monthly" + cooldown: + default-days: 7 groups: promci: patterns: @@ -44,5 +46,4 @@ updates: - .github/workflows/govulncheck.yml - .github/workflows/scorecards.yml - .github/workflows/stale.yml - cooldown: - default-days: 7 + - .github/workflows/zizmor.yml diff --git a/.github/workflows/approve-workflows.yml b/.github/workflows/approve-workflows.yml index 75c370c832..cfbb86eafa 100644 --- a/.github/workflows/approve-workflows.yml +++ b/.github/workflows/approve-workflows.yml @@ -2,11 +2,10 @@ ### # This action is synced from https://github.com/prometheus/prometheus ### - name: Approve pending workflows on: - # The pinned action requires triage access or higher and only calls GitHub APIs. + # The pinned action requires triage access or higher and only calls GitHub APIs. issue_comment: # zizmor: ignore[dangerous-triggers] types: [created] diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index af01db374b..d6bad9764b 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -29,11 +29,12 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - - name: Install Go + # Go caching is acceptable here because this workflow has a read-only + # token, uses no secrets and publishes nothing. + - name: Install Go # zizmor: ignore[cache-poisoning] uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version: 1.27.x - cache: false - name: Install snmp_exporter/generator dependencies run: sudo apt-get update && sudo apt-get -y install libsnmp-dev if: github.repository == 'prometheus/snmp_exporter' diff --git a/.github/workflows/zizmor.yml b/.github/workflows/zizmor.yml new file mode 100644 index 0000000000..ac67240fbf --- /dev/null +++ b/.github/workflows/zizmor.yml @@ -0,0 +1,84 @@ +--- +# This workflow runs zizmor to find security issues in GitHub Actions workflows. +# It is synchronized from https://github.com/prometheus/prometheus. +# +# If the "GitHub Actions Security" check fails: +# +# 1. Open the "Run zizmor" step in the failed job. Each finding identifies +# a rule, the affected file and line, and the reason for the finding. +# The scan can report existing issues in files your PR did not change. +# +# 2. Find guidance for the reported rule at https://docs.zizmor.sh/audits/. +# Fix the affected workflow and push your changes to rerun the check. +# +# 3. To reproduce locally, install the zizmor version specified below using +# the instructions at https://docs.zizmor.sh/installation/. +# From the repository root, run `zizmor .`. +# Some findings can be fixed with `zizmor --fix=safe .`. +# Review the resulting diff and verify that the workflows still work. +# +# If a finding appears incorrect or a fix is unclear, ask the repository +# maintainers before adding an exception. Document the reason for any exception +# and keep it scoped to the specific finding. See the configuration reference +# at https://docs.zizmor.sh/configuration/. +# +# Propose changes to this shared workflow in prometheus/prometheus so they +# can be synchronized across repositories. +name: GitHub Actions Security + +on: + pull_request: + push: + branches: + - main + - master + +permissions: + contents: read + actions: read + +jobs: + zizmor: + name: Run zizmor + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Run zizmor + id: zizmor + uses: zizmorcore/zizmor-action@85b2b9fb8e3325e7a23d7d0a9d7ba5ae0f999e3e # v0.7.1 + with: + advanced-security: false + version: 1.31.1 + + - name: Explain how to resolve findings + if: failure() && steps.zizmor.outcome == 'failure' + run: | + cat >> "$GITHUB_STEP_SUMMARY" <<'EOF' + ### Troubleshooting GitHub Actions Security + + Open the **Run zizmor** step for the findings or execution error. + Each finding identifies the affected file, line, and rule. + The scan can report existing issues in files your PR did not change. + + 1. Follow the [guidance for the reported rule](https://docs.zizmor.sh/audits/). + 2. Fix the affected workflow and push your changes to rerun the check. + + To reproduce locally, [install zizmor](https://docs.zizmor.sh/installation/) + using the version specified in this workflow and run `zizmor .` from + the repository root. Some findings can be fixed with `zizmor --fix=safe .`. + Review the resulting diff and verify that the workflows still work. + + If a finding appears incorrect or a fix is unclear, ask the repository + maintainers before adding an exception. Document the reason and keep + the exception scoped to the specific finding. See the + [configuration reference](https://docs.zizmor.sh/configuration/). + + This workflow is synchronized from [prometheus/prometheus](https://github.com/prometheus/prometheus). + Propose shared workflow changes there so they can reach all repositories. + EOF From 6006ef113a0752f9fd1ad0de0ce503b78a0d8b41 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:03:56 +0100 Subject: [PATCH 63/87] build(deps): bump vmactions/openbsd-vm from 1.4.5 to 1.4.9 (#3880) Bumps [vmactions/openbsd-vm](https://github.com/vmactions/openbsd-vm) from 1.4.5 to 1.4.9. - [Release notes](https://github.com/vmactions/openbsd-vm/releases) - [Commits](https://github.com/vmactions/openbsd-vm/compare/c941015845c0f0c429676840963dc63b226d4f69...f1ca8bc8ecc5b6ef7218e5b914836e067e1546d3) --- updated-dependencies: - dependency-name: vmactions/openbsd-vm dependency-version: 1.4.9 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bsd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 9cd2f91901..fc0b450d54 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -80,7 +80,7 @@ jobs: with: persist-credentials: false - name: test-e2e - uses: vmactions/openbsd-vm@c941015845c0f0c429676840963dc63b226d4f69 # v1.4.5 + uses: vmactions/openbsd-vm@f1ca8bc8ecc5b6ef7218e5b914836e067e1546d3 # v1.4.9 with: copyback: false envs: 'GO_VERSION GNU_TAR_VERSION' From 592ae9db9a77e0eecdf172dff81def943af872e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:04:19 +0100 Subject: [PATCH 64/87] build(deps): bump vmactions/freebsd-vm from 1.5.8 to 1.5.9 (#3877) Bumps [vmactions/freebsd-vm](https://github.com/vmactions/freebsd-vm) from 1.5.8 to 1.5.9. - [Release notes](https://github.com/vmactions/freebsd-vm/releases) - [Commits](https://github.com/vmactions/freebsd-vm/compare/a2f9a41fa97f6848b8c3b791087dfcdaa5b473ff...c46abacb49f09938ca4e1702d15d836285d694cc) --- updated-dependencies: - dependency-name: vmactions/freebsd-vm dependency-version: 1.5.9 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bsd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index fc0b450d54..3efc980b53 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -26,7 +26,7 @@ jobs: with: persist-credentials: false - name: test-e2e - uses: vmactions/freebsd-vm@a2f9a41fa97f6848b8c3b791087dfcdaa5b473ff # v1.5.8 + uses: vmactions/freebsd-vm@c46abacb49f09938ca4e1702d15d836285d694cc # v1.5.9 with: release: "15" copyback: false From 5c62f9d3cf7f04660a378361e3add9900c276981 Mon Sep 17 00:00:00 2001 From: Pujitha Paladugu Date: Mon, 2 Nov 2026 07:04:57 -0800 Subject: [PATCH 65/87] fix(infiniband): skip sysfs reads for excluded devices (#3824) * fix(infiniband): skip sysfs reads for excluded devices Motivation: --collector.infiniband.device-exclude (and device-include) correctly filtered excluded devices out of emitted metrics, but the collector's Update() called sysfs.FS.InfiniBandClass(), which eagerly parses every device under /sys/class/infiniband -- including reading each port's counter files -- before the device filter is ever applied. On hosts with firmware-managed restricted ports, reading those counter files can trigger a firmware command that fails and floods the kernel log, even though the offending device was explicitly excluded. Approach: Enumerate device names first via sysfs.FS.InfiniBandClassDevices(), which only lists directory entries and performs no attribute or counter reads. Apply the existing device filter against the name, and only call sysfs.FS.InfiniBandDevice(name) -- which does the actual sysfs reads -- for devices that pass the filter. This does not change emitted metrics for included devices; it only avoids touching excluded devices' sysfs files at all. Validation: Added TestInfiniBandCollectorSkipsSysfsReadsForExcludedDevices, which builds a synthetic sysfs tree with a healthy device and a device missing its required fw_ver file (simulating a device whose attributes/counters cannot be read), then excludes the broken device via device-exclude and asserts Update() succeeds and only the included device's metrics are emitted. Report: https://github.com/prometheus/node_exporter/issues/3823 Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com> Assisted-by: claude-sonnet-5 (via Claude Code) --------- Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com> Signed-off-by: Ben Kochie Co-authored-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com> Co-authored-by: Ben Kochie --- collector/infiniband_linux.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/collector/infiniband_linux.go b/collector/infiniband_linux.go index da206d6a9b..6a869ef188 100644 --- a/collector/infiniband_linux.go +++ b/collector/infiniband_linux.go @@ -158,7 +158,7 @@ func (c *infinibandCollector) pushCounter(ch chan<- prometheus.Metric, name stri } func (c *infinibandCollector) Update(ch chan<- prometheus.Metric) error { - devices, err := c.fs.InfiniBandClass() + deviceNames, err := c.fs.InfiniBandClassDevices() if err != nil { if errors.Is(err, os.ErrNotExist) { c.logger.Debug("infiniband statistics not found, skipping") @@ -167,11 +167,16 @@ func (c *infinibandCollector) Update(ch chan<- prometheus.Metric) error { return fmt.Errorf("error obtaining InfiniBand class info: %w", err) } - for _, device := range devices { - if c.deviceFilter.ignored(device.Name) { + for _, name := range deviceNames { + if c.deviceFilter.ignored(name) { continue } + device, err := c.fs.InfiniBandDevice(name) + if err != nil { + return fmt.Errorf("error obtaining InfiniBand device info: %w", err) + } + infoDesc := prometheus.NewDesc( prometheus.BuildFQName(namespace, c.subsystem, "info"), "Non-numeric data from /sys/class/infiniband/, value is always 1.", From 3d897c0d03bafb44c9b00215d6af0c3fcb4631da Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:44:01 +0100 Subject: [PATCH 66/87] build(deps): bump vmactions/solaris-vm from 1.4.1 to 1.4.2 (#3879) Bumps [vmactions/solaris-vm](https://github.com/vmactions/solaris-vm) from 1.4.1 to 1.4.2. - [Release notes](https://github.com/vmactions/solaris-vm/releases) - [Commits](https://github.com/vmactions/solaris-vm/compare/87d3c436511cef802cd1637f86f73b1a97715c8c...1c166978f5a2c1f87f1c9d4d8dd85ae3d1eff6f7) --- updated-dependencies: - dependency-name: vmactions/solaris-vm dependency-version: 1.4.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/bsd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml index 3efc980b53..afb8a65862 100644 --- a/.github/workflows/bsd.yml +++ b/.github/workflows/bsd.yml @@ -238,7 +238,7 @@ jobs: with: persist-credentials: false - name: test-e2e - uses: vmactions/solaris-vm@87d3c436511cef802cd1637f86f73b1a97715c8c # v1.4.1 + uses: vmactions/solaris-vm@1c166978f5a2c1f87f1c9d4d8dd85ae3d1eff6f7 # v1.4.2 with: copyback: false envs: 'GO_VERSION' From 2ae7dd881ed9e551fb75abc811bef974b2c31819 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:51:49 +0100 Subject: [PATCH 67/87] build(deps): bump github.com/godbus/dbus/v5 from 5.2.2 to 5.2.4 (#3878) Bumps [github.com/godbus/dbus/v5](https://github.com/godbus/dbus) from 5.2.2 to 5.2.4. - [Release notes](https://github.com/godbus/dbus/releases) - [Commits](https://github.com/godbus/dbus/compare/v5.2.2...v5.2.4) --- updated-dependencies: - dependency-name: github.com/godbus/dbus/v5 dependency-version: 5.2.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0ece4bb32c..4d19bb2b3f 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/coreos/go-systemd/v22 v22.7.0 github.com/dennwc/btrfs v0.0.0-20260222081608-edfb8b9e4f55 github.com/ema/qdisc v1.0.0 - github.com/godbus/dbus/v5 v5.2.2 + github.com/godbus/dbus/v5 v5.2.4 github.com/hashicorp/go-envparse v0.1.0 github.com/hodgesds/perf-utils v0.7.0 github.com/illumos/go-kstat v0.0.0-20210513183136-173c9b0a9973 diff --git a/go.sum b/go.sum index dac01056a1..420de8e170 100644 --- a/go.sum +++ b/go.sum @@ -24,8 +24,8 @@ github.com/dennwc/ioctl v1.0.1-0.20181021180353-017804252068 h1:K71w/n/Y74EQsKo9 github.com/dennwc/ioctl v1.0.1-0.20181021180353-017804252068/go.mod h1:ellh2YB5ldny99SBU/VX7Nq0xiZbHphf1DrtHxxjMk0= github.com/ema/qdisc v1.0.0 h1:EHLG08FVRbWLg8uRICa3xzC9Zm0m7HyMHfXobWFnXYg= github.com/ema/qdisc v1.0.0/go.mod h1:FhIc0fLYi7f+lK5maMsesDqwYojIOh3VfRs8EVd5YJQ= -github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ= -github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c= +github.com/godbus/dbus/v5 v5.2.4 h1:F2gUCy++NMIxGmo9J+z5le/+ZC8W1OgeR51P4i9ZB/U= +github.com/godbus/dbus/v5 v5.2.4/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c= github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= From 78a4ed7dc18a414e8f17b1237709ad5d06405859 Mon Sep 17 00:00:00 2001 From: "prometheus-org-infra[bot]" <314372684+prometheus-org-infra[bot]@users.noreply.github.com> Date: Tue, 10 Nov 2026 10:36:04 -0300 Subject: [PATCH 68/87] Update MAINTAINERS.md (#3889) Source: fc9efc2ddcb3d8eb88e31982cfb974bdb50300f5 Signed-off-by: prometheus-org-infra[bot] <314372684+prometheus-org-infra[bot]@users.noreply.github.com> Co-authored-by: prometheus-org-infra[bot] <314372684+prometheus-org-infra[bot]@users.noreply.github.com> --- MAINTAINERS.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index ffe90361c3..7750e9e2af 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -1,2 +1,4 @@ -* Ben Kochie @SuperQ + + * Johannes 'fish' Ziemke @discordianfish +* Ben Kochie @superq From 9ebc134f7716ee13943549b94ef55640258385b5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Nov 2026 20:24:16 +0100 Subject: [PATCH 69/87] build(deps): bump github.com/prometheus/common (#3896) Bumps the prometheus group with 1 update: [github.com/prometheus/common](https://github.com/prometheus/common). Updates `github.com/prometheus/common` from 0.72.1 to 0.73.1 - [Release notes](https://github.com/prometheus/common/releases) - [Changelog](https://github.com/prometheus/common/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/common/compare/v0.72.1...v0.73.1) --- updated-dependencies: - dependency-name: github.com/prometheus/common dependency-version: 0.73.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: prometheus ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 3 ++- go.sum | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 4d19bb2b3f..dc05259579 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/prometheus-community/go-runit v0.1.0 github.com/prometheus/client_golang v1.25.0 github.com/prometheus/client_model v0.6.3 - github.com/prometheus/common v0.72.1 + github.com/prometheus/common v0.73.1 github.com/prometheus/exporter-toolkit v0.20.0 github.com/prometheus/procfs v0.23.0 github.com/safchain/ethtool v0.7.0 @@ -48,6 +48,7 @@ require ( github.com/mdlayher/vsock v1.3.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect + github.com/pandatix/go-abnf v0.5.3 // indirect github.com/siebenmann/go-kstat v0.0.0-20210513183136-173c9b0a9973 // indirect github.com/xhit/go-str2duration/v2 v2.1.0 // indirect go.uber.org/atomic v1.7.0 // indirect diff --git a/go.sum b/go.sum index 420de8e170..37695bd4f0 100644 --- a/go.sum +++ b/go.sum @@ -69,6 +69,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/opencontainers/selinux v1.15.1 h1:ERxeh5caJvCzNAKdI8WQbJmB1LDTn4BuaAg8wihLBpA= github.com/opencontainers/selinux v1.15.1/go.mod h1:LenyElirjUHszfxrjuFqC85HIeXZKumHcKMQtnaDlQQ= +github.com/pandatix/go-abnf v0.5.3 h1:LA9AaxAqwzdxfDe7+HIGUB6tzx2N6wYVEAChmfsoPgo= +github.com/pandatix/go-abnf v0.5.3/go.mod h1:AE0KD3/VNoCjGzc1gqetRKshbI4SYErXQ/8kPenR5mc= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= @@ -78,8 +80,8 @@ github.com/prometheus/client_golang v1.25.0 h1:cDtW1TcFsMi1RJc8khwCKB4VhzwV04aKq github.com/prometheus/client_golang v1.25.0/go.mod h1:j2X/4/kaQHLPnmyEU8zjmkndo1T317VpCIQEml8LTKk= github.com/prometheus/client_model v0.6.3 h1:O0jaTVAYNxTHYInEPFJt5I3+sN8zqBtVMPTB1qyxiEo= github.com/prometheus/client_model v0.6.3/go.mod h1:gpN5P9S7Rr6Yr92PiQ+Ixvhf6JZEkF1dnxsYL2aPBEM= -github.com/prometheus/common v0.72.1 h1:ZAiQed/nk8IIcsdzb2TlJu23NEUDyDLQ9TXTN2WRK6Y= -github.com/prometheus/common v0.72.1/go.mod h1:1IoBY4IRaJnhs2ESjNzjilP1cJ/P8pimGoomq7zRXrA= +github.com/prometheus/common v0.73.1 h1:SZWh/j4AvhCdhX8jvYSnxvPxhWlC9QZkjJ+tOrEr7kU= +github.com/prometheus/common v0.73.1/go.mod h1:I9aA/Ukz9s1olOobh8KtCkU7B1mQPQsB9UvQPsUQ1Dk= github.com/prometheus/exporter-toolkit v0.20.0 h1:hz3g2aPcq3mXlQSt1MGjj2rwVk1wtRalF+/FjYxFRkI= github.com/prometheus/exporter-toolkit v0.20.0/go.mod h1:gIIY0Mw0ci1wgYscdeMqVh6FUPYJca549eOkE39nU64= github.com/prometheus/procfs v0.23.0 h1:ad+S6FTkzwaMgacKLM5h6bNKExS+DMH0YiUwXItH/o4= From 452489e4bb664511d910fd06b24a3360ce12ecb7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Nov 2026 20:24:39 +0100 Subject: [PATCH 70/87] build(deps): bump github.com/mdlayher/ethtool from 0.6.1 to 0.7.0 (#3897) Bumps [github.com/mdlayher/ethtool](https://github.com/mdlayher/ethtool) from 0.6.1 to 0.7.0. - [Release notes](https://github.com/mdlayher/ethtool/releases) - [Commits](https://github.com/mdlayher/ethtool/compare/v0.6.1...v0.7.0) --- updated-dependencies: - dependency-name: github.com/mdlayher/ethtool dependency-version: 0.7.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index dc05259579..d40b82ed55 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/jsimonetti/rtnetlink/v2 v2.2.0 github.com/lufia/iostat v1.2.1 github.com/mattn/go-xmlrpc v0.0.3 - github.com/mdlayher/ethtool v0.6.1 + github.com/mdlayher/ethtool v0.7.0 github.com/mdlayher/netlink v1.11.2 github.com/mdlayher/wifi v0.9.0 github.com/opencontainers/selinux v1.15.1 diff --git a/go.sum b/go.sum index 37695bd4f0..45784cce38 100644 --- a/go.sum +++ b/go.sum @@ -51,8 +51,8 @@ github.com/lufia/iostat v1.2.1 h1:tnCdZBIglgxD47RyD55kfWQcJMGzO+1QBziSQfesf2k= github.com/lufia/iostat v1.2.1/go.mod h1:rEPNA0xXgjHQjuI5Cy05sLlS2oRcSlWHRLrvh/AQ+Pg= github.com/mattn/go-xmlrpc v0.0.3 h1:Y6WEMLEsqs3RviBrAa1/7qmbGB7DVD3brZIbqMbQdGY= github.com/mattn/go-xmlrpc v0.0.3/go.mod h1:mqc2dz7tP5x5BKlCahN/n+hs7OSZKJkS9JsHNBRlrxA= -github.com/mdlayher/ethtool v0.6.1 h1:fSfcX6EN3yBqcB+vsCnq8hpbIT4vEa7T+BKb0NjT894= -github.com/mdlayher/ethtool v0.6.1/go.mod h1:ezmdXM273WHGEt1OvaeqvKAkcjw28/dbYYeQuC2aIxQ= +github.com/mdlayher/ethtool v0.7.0 h1:cZ/so6IXQe8AV1ML2St/iz77ou8tkoMj3qXcmERLhrE= +github.com/mdlayher/ethtool v0.7.0/go.mod h1:zy+PslWS2FC+l3j1Tc8xtP+/m6XyuQe/va5Dw8+VS14= github.com/mdlayher/genetlink v1.4.0 h1:f/Xs7Y2T+GyX9b3dbiUhnLE9InGs5F9RxJ2JwBMl71o= github.com/mdlayher/genetlink v1.4.0/go.mod h1:d1hrKr8fwZU2JkcAtQUAzeTrI7nbgQSl+5k1cC0biSA= github.com/mdlayher/netlink v1.11.2 h1:HKh2jqe+omdSWcQ88nrT7INE61B0NXfiSPFdgL4YbNI= From 8b576ba992d5ccfe0012f889138b9c8a594f91a7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Nov 2026 20:25:03 +0100 Subject: [PATCH 71/87] build(deps): bump github.com/mdlayher/wifi from 0.9.0 to 0.10.0 (#3898) Bumps [github.com/mdlayher/wifi](https://github.com/mdlayher/wifi) from 0.9.0 to 0.10.0. - [Release notes](https://github.com/mdlayher/wifi/releases) - [Commits](https://github.com/mdlayher/wifi/compare/v0.9.0...v0.10.0) --- updated-dependencies: - dependency-name: github.com/mdlayher/wifi dependency-version: 0.10.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d40b82ed55..4d35a856c1 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/mattn/go-xmlrpc v0.0.3 github.com/mdlayher/ethtool v0.7.0 github.com/mdlayher/netlink v1.11.2 - github.com/mdlayher/wifi v0.9.0 + github.com/mdlayher/wifi v0.10.0 github.com/opencontainers/selinux v1.15.1 github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 github.com/prometheus-community/go-runit v0.1.0 diff --git a/go.sum b/go.sum index 45784cce38..6aa2912607 100644 --- a/go.sum +++ b/go.sum @@ -61,8 +61,8 @@ github.com/mdlayher/socket v0.6.1 h1:M7uj2NtuujUY4mYr1C57NmfNiRHbkKpnBxO856lsc3A github.com/mdlayher/socket v0.6.1/go.mod h1:+/SGtqc9V+5dAuRgQsU0fGBI+oRDiW7O2Obx10OIWfg= github.com/mdlayher/vsock v1.3.0 h1:bqQfZ1OznI03y6YiXp2sze05RVdzLn/zsfjnjd4+ivI= github.com/mdlayher/vsock v1.3.0/go.mod h1:WsuksavOvwCnV5UqGHUkvAvCy+Dqy81y4goKQTzxxNY= -github.com/mdlayher/wifi v0.9.0 h1:d5mmqw9S2U4f95dcW5wnnUagpI6GJh328/AchVSP4ko= -github.com/mdlayher/wifi v0.9.0/go.mod h1:Bfkrz+VncrVPaOLcFG/bR9tSY2PbmYNQicWvAZlUZlI= +github.com/mdlayher/wifi v0.10.0 h1:pAczBxBsER85yh561+d1RPw2B3ykazOpd5IGf0gJCgM= +github.com/mdlayher/wifi v0.10.0/go.mod h1:rZVskXHC+Jw0KQHeguAS4EGCmbfX7fo/O+4b0Bxx4bI= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= From b653b2190e4c5c613081b8f3b178639b9442d36f Mon Sep 17 00:00:00 2001 From: scarlet-storm <12461256+scarlet-storm@users.noreply.github.com> Date: Tue, 17 Nov 2026 14:39:26 +0530 Subject: [PATCH 72/87] nvme: Deprecate metric nvme_namespace_capacity_bytes (#3899) * nvme: deprecate nvme_namespace_capacity_bytes This metric is currently just a duplicate of namespace_size_bytes, as seen in procfs: https://github.com/prometheus/procfs/blob/98e16a16034c77c1277b41cc21915b70fa4631bc/sysfs/class_nvme.go#L200-L201 This is incorrect because capacity & size (ncap & nsze) have special meanings in nvme protocol. ncap is the max logical blocks allocatable to the namespace. nsze is the total logical blocks in the namespace. for thin provisioned namespace ncap < nsze & the kernel does not currently have an easy way to fetch ncap. if ncap is available in a future kernel the metric can be added back. Signed-off-by: scarlet-storm <12461256+scarlet-storm@users.noreply.github.com> * changelog: Note deprecation of nvme_namespace_capacity_bytes Signed-off-by: scarlet-storm <12461256+scarlet-storm@users.noreply.github.com> --------- Signed-off-by: scarlet-storm <12461256+scarlet-storm@users.noreply.github.com> --- CHANGELOG.md | 1 + collector/fixtures/e2e-64k-page-output.txt | 2 +- collector/fixtures/e2e-output.txt | 2 +- collector/nvme_linux.go | 28 ++++++++++++++-------- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd4f978795..991096d836 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## master / unreleased * [CHANGE] edac: Fix no data results #3863 +* [CHANGE] nvme: Deprecate metric nvme_namespace_capacity_bytes #3899 ## 1.12.1 / 2026-07-14 diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index 1b74382203..cd4f45bbfa 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -3514,7 +3514,7 @@ node_nfsd_server_threads 8 # HELP node_nvme_info Non-numeric data from /sys/class/nvme/, value is always 1. # TYPE node_nvme_info gauge node_nvme_info{cntlid="1997",device="nvme0",firmware_revision="1B2QEXP7",model="Samsung SSD 970 PRO 512GB",serial="S680HF8N190894I",state="live"} 1 -# HELP node_nvme_namespace_capacity_bytes Capacity of the NVMe namespace in bytes. +# HELP node_nvme_namespace_capacity_bytes Size of the NVMe namespace in bytes. DEPRECATED: please use nvme_namespace_size_bytes instead. # TYPE node_nvme_namespace_capacity_bytes gauge node_nvme_namespace_capacity_bytes{device="nvme0",nsid="1"} 2e+12 # HELP node_nvme_namespace_info Information about NVMe namespaces. Value is always 1 diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index 4dd448d5c6..1ff5612fd6 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -3536,7 +3536,7 @@ node_nfsd_server_threads 8 # HELP node_nvme_info Non-numeric data from /sys/class/nvme/, value is always 1. # TYPE node_nvme_info gauge node_nvme_info{cntlid="1997",device="nvme0",firmware_revision="1B2QEXP7",model="Samsung SSD 970 PRO 512GB",serial="S680HF8N190894I",state="live"} 1 -# HELP node_nvme_namespace_capacity_bytes Capacity of the NVMe namespace in bytes. +# HELP node_nvme_namespace_capacity_bytes Size of the NVMe namespace in bytes. DEPRECATED: please use nvme_namespace_size_bytes instead. # TYPE node_nvme_namespace_capacity_bytes gauge node_nvme_namespace_capacity_bytes{device="nvme0",nsid="1"} 2e+12 # HELP node_nvme_namespace_info Information about NVMe namespaces. Value is always 1 diff --git a/collector/nvme_linux.go b/collector/nvme_linux.go index ef95ee608b..d1bb8436ad 100644 --- a/collector/nvme_linux.go +++ b/collector/nvme_linux.go @@ -26,7 +26,10 @@ import ( "github.com/prometheus/procfs/sysfs" ) -var nvmeNamespaceUsage = kingpin.Flag("collector.nvme.namespace-usage", "Expose namespace used bytes (reads nuse, which makes the kernel query the controller).").Default("true").Bool() +var ( + nvmeNamespaceUsage = kingpin.Flag("collector.nvme.namespace-usage", "Expose namespace used bytes (reads nuse, which makes the kernel query the controller).").Default("true").Bool() + nvmeNamespaceCapacity = kingpin.Flag("collector.nvme.namespace-capacity", "Export namespace size (nsze) with the incorrect metric name nvme_namespace_capacity_bytes").Default("true").Bool() +) type nvmeCollector struct { fs sysfs.FS @@ -52,7 +55,7 @@ var ( nvmeNamespaceCapacityBytes = prometheus.NewDesc( prometheus.BuildFQName(namespace, "nvme", "namespace_capacity_bytes"), - "Capacity of the NVMe namespace in bytes.", + "Size of the NVMe namespace in bytes. DEPRECATED: please use nvme_namespace_size_bytes instead.", []string{"device", "nsid"}, nil, ) @@ -81,6 +84,9 @@ func NewNVMeCollector(logger *slog.Logger) (Collector, error) { if err != nil { return nil, fmt.Errorf("failed to open sysfs: %w", err) } + if *nvmeNamespaceCapacity { + logger.Warn("The metric nvme_namespace_capacity_bytes is deprecated, and is planned to be removed in the next major version release. Please use nvme_namespace_size_bytes instead.") + } return &nvmeCollector{ fs: fs, logger: logger, @@ -123,14 +129,16 @@ func (c *nvmeCollector) Update(ch chan<- prometheus.Metric) error { namespace.ANAState, ) - // Namespace capacity in bytes - ch <- prometheus.MustNewConstMetric( - nvmeNamespaceCapacityBytes, - prometheus.GaugeValue, - float64(namespace.CapacityBytes), - device.Name, - namespace.ID, - ) + if *nvmeNamespaceCapacity { + // Namespace size in bytes + ch <- prometheus.MustNewConstMetric( + nvmeNamespaceCapacityBytes, + prometheus.GaugeValue, + float64(namespace.SizeBytes), + device.Name, + namespace.ID, + ) + } // Namespace size in bytes ch <- prometheus.MustNewConstMetric( From 6813bc2f895bdd46cd06c09fa5e395a7b13c3242 Mon Sep 17 00:00:00 2001 From: SANCHIT KUMAR Date: Wed, 18 Nov 2026 14:39:48 +0530 Subject: [PATCH 73/87] fix(ksmd): parse general_profit as a signed value (#3894) * fix(ksmd): parse general_profit as a signed value The kernel prints /sys/kernel/mm/ksm/general_profit as a signed long, and it is negative when KSM costs more memory than it saves. It was read with ParseUint like the other files, so a negative value made Update return an error and drop every ksmd metric after full_scans, failing the collector for that scrape. Read general_profit with ParseInt. Use a negative value in the sys fixture and add a ksmd unit test, and update the e2e output. Signed-off-by: Sanchit2662 * ksmd: drop redundant unit test, update 64k-page e2e output The negative general_profit case is covered by the e2e output test, so remove the separate unit test. Update e2e-64k-page-output.txt (used on aarch64 and ppc64le) to match the changed sys fixture. Signed-off-by: Sanchit2662 * ksmd: update 64k-page e2e output Signed-off-by: Sanchit2662 --------- Signed-off-by: Sanchit2662 --- collector/fixtures/e2e-64k-page-output.txt | 2 +- collector/fixtures/e2e-output.txt | 2 +- collector/fixtures/sys.ttar | 2 +- collector/helper.go | 10 ++++++++++ collector/ksmd_linux.go | 17 +++++++++++++++-- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index cd4f45bbfa..a4acbed60c 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -2018,7 +2018,7 @@ node_kernel_hung_tasks_total 42 node_ksmd_full_scans_total 323 # HELP node_ksmd_general_profit_bytes How effective is KSM. ksm_saved_pages * sizeof(page) - (all_rmap_items) * sizeof(rmap_item) # TYPE node_ksmd_general_profit_bytes gauge -node_ksmd_general_profit_bytes 1.04448e+06 +node_ksmd_general_profit_bytes -81920 # HELP node_ksmd_merge_across_nodes Specifies if pages from different NUMA nodes can be merged. # TYPE node_ksmd_merge_across_nodes gauge node_ksmd_merge_across_nodes 1 diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index 1ff5612fd6..1956e7496f 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -2040,7 +2040,7 @@ node_kernel_hung_tasks_total 42 node_ksmd_full_scans_total 323 # HELP node_ksmd_general_profit_bytes How effective is KSM. ksm_saved_pages * sizeof(page) - (all_rmap_items) * sizeof(rmap_item) # TYPE node_ksmd_general_profit_bytes gauge -node_ksmd_general_profit_bytes 1.04448e+06 +node_ksmd_general_profit_bytes -81920 # HELP node_ksmd_merge_across_nodes Specifies if pages from different NUMA nodes can be merged. # TYPE node_ksmd_merge_across_nodes gauge node_ksmd_merge_across_nodes 1 diff --git a/collector/fixtures/sys.ttar b/collector/fixtures/sys.ttar index 5c4388faec..038b28e569 100644 --- a/collector/fixtures/sys.ttar +++ b/collector/fixtures/sys.ttar @@ -12297,7 +12297,7 @@ Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: sys/kernel/mm/ksm/general_profit Lines: 1 -1044480 +-81920 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: sys/kernel/mm/ksm/merge_across_nodes diff --git a/collector/helper.go b/collector/helper.go index 21dddf887c..1bddb21610 100644 --- a/collector/helper.go +++ b/collector/helper.go @@ -32,6 +32,16 @@ func readUintFromFile(path string) (uint64, error) { return value, nil } +// readIntFromFile reads a signed integer from the given file. Use it for +// values the kernel prints as signed (e.g. "%ld") and that can be negative. +func readIntFromFile(path string) (int64, error) { + data, err := os.ReadFile(path) + if err != nil { + return 0, err + } + return strconv.ParseInt(strings.TrimSpace(string(data)), 10, 64) +} + var metricNameRegex = regexp.MustCompile(`_*[^0-9A-Za-z_]+_*`) // SanitizeMetricName sanitize the given metric name by replacing invalid characters by underscores. diff --git a/collector/ksmd_linux.go b/collector/ksmd_linux.go index f400f0a0fc..2634f05da7 100644 --- a/collector/ksmd_linux.go +++ b/collector/ksmd_linux.go @@ -109,7 +109,21 @@ func NewKsmdCollector(logger *slog.Logger) (Collector, error) { // Update implements Collector and exposes kernel and system statistics. func (c *ksmdCollector) Update(ch chan<- prometheus.Metric) error { for _, n := range ksmdFiles { - val, err := readUintFromFile(sysFilePath(filepath.Join("kernel/mm/ksm", n))) + path := sysFilePath(filepath.Join("kernel/mm/ksm", n)) + + var v float64 + var err error + if n == "general_profit" { + // The kernel prints general_profit as a signed value, which is + // negative when KSM costs more than it saves. + var val int64 + val, err = readIntFromFile(path) + v = float64(val) + } else { + var val uint64 + val, err = readUintFromFile(path) + v = float64(val) + } if err != nil { if errors.Is(err, os.ErrNotExist) { c.logger.Debug("ksmd file not found, skipping", "file", n) @@ -118,7 +132,6 @@ func (c *ksmdCollector) Update(ch chan<- prometheus.Metric) error { return err } - v := float64(val) switch n { case "full_scans": ch <- prometheus.MustNewConstMetric(ksmdFullScansDesc, prometheus.CounterValue, v) From 133b28028e48ba01a60a5afaff01bbb8e9e8a0d3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:10:49 +0100 Subject: [PATCH 74/87] build(deps): bump github.com/jsimonetti/rtnetlink/v2 from 2.2.0 to 2.3.0 (#3907) Bumps [github.com/jsimonetti/rtnetlink/v2](https://github.com/jsimonetti/rtnetlink) from 2.2.0 to 2.3.0. - [Release notes](https://github.com/jsimonetti/rtnetlink/releases) - [Commits](https://github.com/jsimonetti/rtnetlink/compare/v2.2.0...v2.3.0) --- updated-dependencies: - dependency-name: github.com/jsimonetti/rtnetlink/v2 dependency-version: 2.3.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 4d35a856c1..bb027575b1 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/hashicorp/go-envparse v0.1.0 github.com/hodgesds/perf-utils v0.7.0 github.com/illumos/go-kstat v0.0.0-20210513183136-173c9b0a9973 - github.com/jsimonetti/rtnetlink/v2 v2.2.0 + github.com/jsimonetti/rtnetlink/v2 v2.3.0 github.com/lufia/iostat v1.2.1 github.com/mattn/go-xmlrpc v0.0.3 github.com/mdlayher/ethtool v0.7.0 diff --git a/go.sum b/go.sum index 6aa2912607..7c70c97569 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cilium/ebpf v0.20.0 h1:atwWj9d3NffHyPZzVlx3hmw1on5CLe9eljR8VuHTwhM= -github.com/cilium/ebpf v0.20.0/go.mod h1:pzLjFymM+uZPLk/IXZUL63xdx5VXEo+enTzxkZXdycw= +github.com/cilium/ebpf v0.22.0 h1:v2ktp0roffpMOj2MMf3idtCQZOsAoC4BJbAJN+ke2bY= +github.com/cilium/ebpf v0.22.0/go.mod h1:CDzZbe2hC5JjlDC+CY3KFCzlYwN4gbxppYM+Z10bQt4= github.com/coreos/go-systemd/v22 v22.7.0 h1:LAEzFkke61DFROc7zNLX/WA2i5J8gYqe0rSj9KI28KA= github.com/coreos/go-systemd/v22 v22.7.0/go.mod h1:xNUYtjHu2EDXbsxz1i41wouACIwT7Ybq9o0BQhMwD0w= github.com/cyphar/filepath-securejoin v0.6.1 h1:5CeZ1jPXEiYt3+Z6zqprSAgSWiggmpVyciv8syjIpVE= @@ -41,8 +41,8 @@ github.com/illumos/go-kstat v0.0.0-20210513183136-173c9b0a9973/go.mod h1:PoK3ejP github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/jsimonetti/rtnetlink/v2 v2.2.0 h1:/KfZ310gOAFrXXol5VwnFEt+ucldD/0dsSRZwpHCP9w= -github.com/jsimonetti/rtnetlink/v2 v2.2.0/go.mod h1:lbjDHxC+5RJ08lzPeA90Ls2pEoId3F08MoEMlhfHxeI= +github.com/jsimonetti/rtnetlink/v2 v2.3.0 h1:RcO6g+rsiPuHB5oGXi4V1Gnq1FW3wY/OeJFxq/mDoEA= +github.com/jsimonetti/rtnetlink/v2 v2.3.0/go.mod h1:vhjO1m9rZR3EhuoaiTJy+pTfcFn2911lLXs2++/syos= github.com/klauspost/compress v1.20.1 h1:T7kKElXUMXrUJ2E9QhQhxFtcK5rPyLdsGZvdbLMPdiQ= github.com/klauspost/compress v1.20.1/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= From 432bf4b7ea5e690e32f039b35c346ca2b5a72bf7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:11:07 +0100 Subject: [PATCH 75/87] build(deps): bump golang.org/x/sys (#3906) Bumps the golang-org-x group with 1 update: [golang.org/x/sys](https://github.com/golang/sys). Updates `golang.org/x/sys` from 0.49.0 to 0.50.0 - [Commits](https://github.com/golang/sys/compare/v0.49.0...v0.50.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-version: 0.50.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: golang-org-x ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index bb027575b1..0e16233a58 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( github.com/prometheus/exporter-toolkit v0.20.0 github.com/prometheus/procfs v0.23.0 github.com/safchain/ethtool v0.7.0 - golang.org/x/sys v0.49.0 + golang.org/x/sys v0.50.0 howett.net/plist v1.0.1 ) diff --git a/go.sum b/go.sum index 7c70c97569..ee772d6425 100644 --- a/go.sum +++ b/go.sum @@ -123,8 +123,8 @@ golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20211031064116-611d5d643895/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= -golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/sys v0.50.0 h1:dkKZEFTEKaLr1sjhs0WiKqoi8Jj5nHbS3Njmx1UoMJs= +golang.org/x/sys v0.50.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= From c8a8fa9da0b16e66c672e38f6993fbdc4bcb73a7 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Wed, 18 Nov 2026 12:50:41 +0100 Subject: [PATCH 76/87] Release v1.13.0 (#3908) The behavior of `node_cpu_frequency_hertz` has changed. There are two different sources of data for this metric. One from the `cpu` collector, one from the `cpufreq` collector. Due to historical feature migrations the `cpufreq` collector shares the same subsystem as the `cpu` collector. This caused conflicting data behavior. An attempt to fix this was introduced in #3318. This behavior has been reverted to the previous behavior in #3795. A new flag (`--collector.cpufreq.enable-cpufreq-prefix`) has been introduced that gives the `cpufreq` a dedicated metric name subsystem (`node_cpufreq_...`). This will likely be the default in v2. * [CHANGE] netstat: Use procfs parsers for netstat, snmp and snmp6 #3796 * [CHANGE] edac: Fix no data results #3863 * [CHANGE] nvme: Deprecate metric nvme_namespace_capacity_bytes #3899 * [FEATURE] Add tainted collector for /proc/sys/kernel/tainted #3745 * [FEATURE] Add resctrl collector #3797 * [ENHANCEMENT] netstat: Add new FreeBSD metrics #3334 * [ENHANCEMENT] Add `chip` label to DRM metrics #3572 * [ENHANCEMENT] diskstats: add device-mapper backing device info metric #3676 * [ENHANCEMENT] textfile: support UTF-8 metric and label names #3729 * [ENHANCEMENT] ksmd: add general_profit metric #3778 #3894 * [BUGFIX] edac: Fix printf-style formatting in slog call #3759 * [BUGFIX] fibre_channel: fix crash when attempting to dereference invalid counters #3573 * [BUGFIX] thermal: Fix collecting Darwin temperatures without CPU power status #3767 * [BUGFIX] fibrechannel: Fix for ppc64le #3769 * [BUGFIX] cpu: Revert dup cpu frequency, add node_cpufreq flag #3795 * [BUGFIX] infiniband: skip sysfs reads for excluded devices #3824 * [BUGFIX] bcache: Fix btree_read_average_duration_seconds unit #3828 Signed-off-by: Ben Kochie --- CHANGELOG.md | 29 +++++++++++++++++++++++++++++ VERSION | 2 +- go.mod | 12 ++++++------ go.sum | 24 ++++++++++++------------ 4 files changed, 48 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 991096d836..33a6474852 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,36 @@ ## master / unreleased +## 1.13.0 / 2026-11-19 + +NOTE: + +The behavior of `node_cpu_frequency_hertz` has changed. There are two different sources +of data for this metric. One from the `cpu` collector, one from the `cpufreq` collector. +Due to historical feature migrations the `cpufreq` collector shares the same subsystem +as the `cpu` collector. This caused conflicting data behavior. An attempt to fix this +was introduced in #3318. This behavior has been reverted to the previous behavior in #3795. + +A new flag (`--collector.cpufreq.enable-cpufreq-prefix`) has been introduced that gives +the `cpufreq` a dedicated metric name subsystem (`node_cpufreq_...`). This will likely +be the default in v2. + +* [CHANGE] netstat: Use procfs parsers for netstat, snmp and snmp6 #3796 * [CHANGE] edac: Fix no data results #3863 * [CHANGE] nvme: Deprecate metric nvme_namespace_capacity_bytes #3899 +* [FEATURE] Add tainted collector for /proc/sys/kernel/tainted #3745 +* [FEATURE] Add resctrl collector #3797 +* [ENHANCEMENT] netstat: Add new FreeBSD metrics #3334 +* [ENHANCEMENT] Add `chip` label to DRM metrics #3572 +* [ENHANCEMENT] diskstats: add device-mapper backing device info metric #3676 +* [ENHANCEMENT] textfile: support UTF-8 metric and label names #3729 +* [ENHANCEMENT] ksmd: add general_profit metric #3778 #3894 +* [BUGFIX] edac: Fix printf-style formatting in slog call #3759 +* [BUGFIX] fibre_channel: fix crash when attempting to dereference invalid counters #3573 +* [BUGFIX] thermal: Fix collecting Darwin temperatures without CPU power status #3767 +* [BUGFIX] fibrechannel: Fix for ppc64le #3769 +* [BUGFIX] cpu: Revert dup cpu frequency, add node_cpufreq flag #3795 +* [BUGFIX] infiniband: skip sysfs reads for excluded devices #3824 +* [BUGFIX] bcache: Fix btree_read_average_duration_seconds unit #3828 ## 1.12.1 / 2026-07-14 diff --git a/VERSION b/VERSION index f8f4f03b3d..feaae22bac 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.12.1 +1.13.0 diff --git a/go.mod b/go.mod index 0e16233a58..e7b276e5f5 100644 --- a/go.mod +++ b/go.mod @@ -19,11 +19,11 @@ require ( github.com/mdlayher/netlink v1.11.2 github.com/mdlayher/wifi v0.10.0 github.com/opencontainers/selinux v1.15.1 - github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 + github.com/power-devops/perfstat v0.0.0-20260916203055-22a1a467d9f0 github.com/prometheus-community/go-runit v0.1.0 github.com/prometheus/client_golang v1.25.0 github.com/prometheus/client_model v0.6.3 - github.com/prometheus/common v0.73.1 + github.com/prometheus/common v0.74.0 github.com/prometheus/exporter-toolkit v0.20.0 github.com/prometheus/procfs v0.23.0 github.com/safchain/ethtool v0.7.0 @@ -48,15 +48,15 @@ require ( github.com/mdlayher/vsock v1.3.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect - github.com/pandatix/go-abnf v0.5.3 // indirect + github.com/pandatix/go-abnf v0.5.5 // indirect github.com/siebenmann/go-kstat v0.0.0-20210513183136-173c9b0a9973 // indirect github.com/xhit/go-str2duration/v2 v2.1.0 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect - go.yaml.in/yaml/v2 v2.4.4 // indirect + go.yaml.in/yaml/v2 v2.4.5 // indirect golang.org/x/crypto v0.58.0 // indirect - golang.org/x/net v0.61.0 // indirect - golang.org/x/oauth2 v0.37.0 // indirect + golang.org/x/net v0.62.0 // indirect + golang.org/x/oauth2 v0.38.0 // indirect golang.org/x/sync v0.24.0 // indirect golang.org/x/text v0.43.0 // indirect golang.org/x/time v0.15.0 // indirect diff --git a/go.sum b/go.sum index ee772d6425..57b40f790f 100644 --- a/go.sum +++ b/go.sum @@ -69,19 +69,19 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/opencontainers/selinux v1.15.1 h1:ERxeh5caJvCzNAKdI8WQbJmB1LDTn4BuaAg8wihLBpA= github.com/opencontainers/selinux v1.15.1/go.mod h1:LenyElirjUHszfxrjuFqC85HIeXZKumHcKMQtnaDlQQ= -github.com/pandatix/go-abnf v0.5.3 h1:LA9AaxAqwzdxfDe7+HIGUB6tzx2N6wYVEAChmfsoPgo= -github.com/pandatix/go-abnf v0.5.3/go.mod h1:AE0KD3/VNoCjGzc1gqetRKshbI4SYErXQ/8kPenR5mc= +github.com/pandatix/go-abnf v0.5.5 h1:EXex5KkRQx4Dm6GnpAcQnIMBs9KiK0uf8p/wq+4t9PM= +github.com/pandatix/go-abnf v0.5.5/go.mod h1:AE0KD3/VNoCjGzc1gqetRKshbI4SYErXQ/8kPenR5mc= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= -github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= +github.com/power-devops/perfstat v0.0.0-20260916203055-22a1a467d9f0 h1:XA01Vk/wv9YikCi1V51yRzIHPMT5of9+cMpZoZvDn/M= +github.com/power-devops/perfstat v0.0.0-20260916203055-22a1a467d9f0/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus-community/go-runit v0.1.0 h1:uTWEj/Fn2RoLdfg/etSqwzgYNOYPrARx1BHUN052tGA= github.com/prometheus-community/go-runit v0.1.0/go.mod h1:AvJ9Jo3gAFu2lbM4+qfjdpq30FfiLDJZKbQ015u08IQ= github.com/prometheus/client_golang v1.25.0 h1:cDtW1TcFsMi1RJc8khwCKB4VhzwV04aKqbYtNOXuiK0= github.com/prometheus/client_golang v1.25.0/go.mod h1:j2X/4/kaQHLPnmyEU8zjmkndo1T317VpCIQEml8LTKk= github.com/prometheus/client_model v0.6.3 h1:O0jaTVAYNxTHYInEPFJt5I3+sN8zqBtVMPTB1qyxiEo= github.com/prometheus/client_model v0.6.3/go.mod h1:gpN5P9S7Rr6Yr92PiQ+Ixvhf6JZEkF1dnxsYL2aPBEM= -github.com/prometheus/common v0.73.1 h1:SZWh/j4AvhCdhX8jvYSnxvPxhWlC9QZkjJ+tOrEr7kU= -github.com/prometheus/common v0.73.1/go.mod h1:I9aA/Ukz9s1olOobh8KtCkU7B1mQPQsB9UvQPsUQ1Dk= +github.com/prometheus/common v0.74.0 h1:6iYW8MsYvmEnXFD9zLGgF0qmReaRhs3OMONu1c/nrLI= +github.com/prometheus/common v0.74.0/go.mod h1:i/02C+FCst5B1etKgWesNrD49n+onplJCqUCtUKkOeA= github.com/prometheus/exporter-toolkit v0.20.0 h1:hz3g2aPcq3mXlQSt1MGjj2rwVk1wtRalF+/FjYxFRkI= github.com/prometheus/exporter-toolkit v0.20.0/go.mod h1:gIIY0Mw0ci1wgYscdeMqVh6FUPYJca549eOkE39nU64= github.com/prometheus/procfs v0.23.0 h1:ad+S6FTkzwaMgacKLM5h6bNKExS+DMH0YiUwXItH/o4= @@ -109,16 +109,16 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= -go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= +go.yaml.in/yaml/v2 v2.4.5 h1:a5nxWvYi94DRl6QSLlTbLpVmutgx2qg8EVjnJtuFpwI= +go.yaml.in/yaml/v2 v2.4.5/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ= go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54= golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w= -golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw= -golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= -golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98= -golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58= +golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY= +golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= +golang.org/x/oauth2 v0.38.0 h1:uW7XQbcu1eoiQS7uMJvLOjPMl04bTbmY1VeRPxvbspI= +golang.org/x/oauth2 v0.38.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58= golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= From 52f26e3856b02305e19dd36a1db9ce28d9697453 Mon Sep 17 00:00:00 2001 From: PrometheusBot Date: Wed, 18 Nov 2026 19:39:40 +0100 Subject: [PATCH 77/87] Update common Prometheus files (#3886) Signed-off-by: prombot --- Makefile.common | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Makefile.common b/Makefile.common index efc2730c16..bd5230e4b0 100644 --- a/Makefile.common +++ b/Makefile.common @@ -352,8 +352,7 @@ common-docker-manifest: echo "Skipping manifest for $$variant_name variant (no supported architectures)"; \ continue; \ fi; \ - DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name" $$refs; \ - DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name"; \ + docker buildx imagetools create -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name" $$refs; \ fi; \ if [ "$$dockerfile" = "Dockerfile" ]; then \ echo "Creating default variant ($$variant_name) manifest"; \ @@ -365,8 +364,7 @@ common-docker-manifest: echo "Skipping default variant manifest (no supported architectures)"; \ continue; \ fi; \ - DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)" $$refs; \ - DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)"; \ + docker buildx imagetools create -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)" $$refs; \ fi; \ if [ "$(DOCKER_IMAGE_TAG)" = "latest" ]; then \ if [ "$$dockerfile" != "Dockerfile" ] || [ "$$variant_name" != "default" ]; then \ @@ -379,8 +377,7 @@ common-docker-manifest: echo "Skipping version-tag manifest for $$variant_name variant (no supported architectures)"; \ continue; \ fi; \ - DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):v$(DOCKER_MAJOR_VERSION_TAG)-$$variant_name" $$refs; \ - DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):v$(DOCKER_MAJOR_VERSION_TAG)-$$variant_name"; \ + docker buildx imagetools create -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):v$(DOCKER_MAJOR_VERSION_TAG)-$$variant_name" $$refs; \ fi; \ if [ "$$dockerfile" = "Dockerfile" ]; then \ echo "Creating default variant version tag manifest"; \ @@ -392,8 +389,7 @@ common-docker-manifest: echo "Skipping default variant version-tag manifest (no supported architectures)"; \ continue; \ fi; \ - DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):v$(DOCKER_MAJOR_VERSION_TAG)" $$refs; \ - DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):v$(DOCKER_MAJOR_VERSION_TAG)"; \ + docker buildx imagetools create -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):v$(DOCKER_MAJOR_VERSION_TAG)" $$refs; \ fi; \ fi; \ done From e9db234c8ff1602612e9985154c23c41f300c435 Mon Sep 17 00:00:00 2001 From: vigneshwar Date: Thu, 19 Nov 2026 00:10:58 +0530 Subject: [PATCH 78/87] textfile: fix panic on a metric without HELP after inconsistent help texts (#3866) * textfile: fix panic on a metric without HELP after inconsistent help texts Once a metric has been seen with two different help texts, every later family with the same name is treated as inconsistent. If such a later family has no HELP line, the collector dereferenced its nil help text and panicked. The panic happens in the per-collector goroutine, so it takes down node_exporter. Use the getter for the log line and keep the recorded help text when the new family has none. Signed-off-by: vigneshwar * textfile: move the missing help test into the fixtures Cover the inconsistent help case with a fixture in TestTextfileCollector instead of a separate test that writes files, and drop the extra comment. Signed-off-by: vigneshwar --------- Signed-off-by: vigneshwar Co-authored-by: Ben Kochie --- .../metrics_merge_inconsistent_then_no_help.out | 12 ++++++++++++ .../metrics_merge_inconsistent_then_no_help/a.prom | 3 +++ .../metrics_merge_inconsistent_then_no_help/b.prom | 3 +++ .../metrics_merge_inconsistent_then_no_help/c.prom | 2 ++ .../metrics_merge_inconsistent_then_no_help/d.prom | 3 +++ collector/textfile.go | 6 ++++-- collector/textfile_test.go | 4 ++++ 7 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help.out create mode 100644 collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help/a.prom create mode 100644 collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help/b.prom create mode 100644 collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help/c.prom create mode 100644 collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help/d.prom diff --git a/collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help.out b/collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help.out new file mode 100644 index 0000000000..38c23a044a --- /dev/null +++ b/collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help.out @@ -0,0 +1,12 @@ +# HELP foo First help text. +# TYPE foo gauge +foo{file="a"} 1 +# HELP node_textfile_mtime_seconds Unixtime mtime of textfiles successfully read. +# TYPE node_textfile_mtime_seconds gauge +node_textfile_mtime_seconds{file="fixtures/textfile/metrics_merge_inconsistent_then_no_help/a.prom"} 1 +node_textfile_mtime_seconds{file="fixtures/textfile/metrics_merge_inconsistent_then_no_help/b.prom"} 1 +node_textfile_mtime_seconds{file="fixtures/textfile/metrics_merge_inconsistent_then_no_help/c.prom"} 1 +node_textfile_mtime_seconds{file="fixtures/textfile/metrics_merge_inconsistent_then_no_help/d.prom"} 1 +# HELP node_textfile_scrape_error 1 if there was an error opening or reading a file, 0 otherwise +# TYPE node_textfile_scrape_error gauge +node_textfile_scrape_error 1 diff --git a/collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help/a.prom b/collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help/a.prom new file mode 100644 index 0000000000..4e727fd6d5 --- /dev/null +++ b/collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help/a.prom @@ -0,0 +1,3 @@ +# HELP foo First help text. +# TYPE foo gauge +foo{file="a"} 1 diff --git a/collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help/b.prom b/collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help/b.prom new file mode 100644 index 0000000000..b094d1087e --- /dev/null +++ b/collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help/b.prom @@ -0,0 +1,3 @@ +# HELP foo Second help text. +# TYPE foo gauge +foo{file="b"} 2 diff --git a/collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help/c.prom b/collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help/c.prom new file mode 100644 index 0000000000..7e6cf1efa5 --- /dev/null +++ b/collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help/c.prom @@ -0,0 +1,2 @@ +# TYPE foo gauge +foo{file="c"} 3 diff --git a/collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help/d.prom b/collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help/d.prom new file mode 100644 index 0000000000..3569ccf392 --- /dev/null +++ b/collector/fixtures/textfile/metrics_merge_inconsistent_then_no_help/d.prom @@ -0,0 +1,3 @@ +# HELP foo First help text. +# TYPE foo gauge +foo{file="d"} 4 diff --git a/collector/textfile.go b/collector/textfile.go index 6629eb9d8e..8e4055f297 100644 --- a/collector/textfile.go +++ b/collector/textfile.go @@ -219,12 +219,14 @@ func (c *textFileCollector) Update(ch chan<- prometheus.Metric) error { // Check for metrics with inconsistent help texts and take the first help text occurrence. if helpTexts, seen := metricsNamesToHelpTexts[*mf.Name]; seen { if mf.Help != nil && helpTexts[0] != *mf.Help || helpTexts[1] != "" { - metricsNamesToHelpTexts[*mf.Name] = [2]string{helpTexts[0], *mf.Help} + if mf.Help != nil { + metricsNamesToHelpTexts[*mf.Name] = [2]string{helpTexts[0], *mf.Help} + } errored = true c.logger.Error("inconsistent metric help text", "metric", *mf.Name, "original_help_text", helpTexts[0], - "new_help_text", *mf.Help, + "new_help_text", mf.GetHelp(), // Only the first file path will be recorded in case of two or more inconsistent help texts. "file", metricsNamesToFiles[*mf.Name][0]) continue diff --git a/collector/textfile_test.go b/collector/textfile_test.go index 5b9f701ccd..ebfbfec566 100644 --- a/collector/textfile_test.go +++ b/collector/textfile_test.go @@ -121,6 +121,10 @@ func TestTextfileCollector(t *testing.T) { paths: []string{"fixtures/textfile/metrics_merge_different_help"}, out: "fixtures/textfile/metrics_merge_different_help.out", }, + { + paths: []string{"fixtures/textfile/metrics_merge_inconsistent_then_no_help"}, + out: "fixtures/textfile/metrics_merge_inconsistent_then_no_help.out", + }, } for i, test := range tests { From 0488fdbdc3cb3cc3021850b00b093427a561073e Mon Sep 17 00:00:00 2001 From: Frederic <1665799+Finomosec@users.noreply.github.com> Date: Wed, 18 Nov 2026 20:14:17 +0100 Subject: [PATCH 79/87] btrfs: Fix device_unused_bytes wrapping around during shrink (#3827) While a device is being shrunk, its size is already reduced but the extents beyond it are still allocated, so bytes used exceeds the size and the unsigned subtraction reports ~1.8e19 instead of a negative value. Signed-off-by: Finomosec <1665799+Finomosec@users.noreply.github.com> Co-authored-by: Ben Kochie --- collector/btrfs_linux.go | 7 +++++-- collector/btrfs_linux_test.go | 30 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/collector/btrfs_linux.go b/collector/btrfs_linux.go index b25b08b6dc..cdb21144d2 100644 --- a/collector/btrfs_linux.go +++ b/collector/btrfs_linux.go @@ -339,12 +339,15 @@ func (c *btrfsCollector) getMetrics(s *btrfs.Stats, ioctlStats *btrfsIoctlFsStat // A bytes available metric is probably more useful than a // bytes used metric, because large numbers of bytes will // suffer from floating point representation issues - // and we probably care more about the number when it's low anyway + // and we probably care more about the number when it's low anyway. + // While a device is being shrunk, its size is already reduced but + // the extents beyond it are still allocated, so bytesUsed can exceed + // totalBytes and the unsigned subtraction would wrap around. btrfsMetric{ name: "device_unused_bytes", desc: "Unused bytes unused on a device that is part of the filesystem.", metricType: prometheus.GaugeValue, - value: float64(dev.totalBytes - dev.bytesUsed), + value: float64(int64(dev.totalBytes) - int64(dev.bytesUsed)), extraLabel: extraLabels, extraLabelValue: extraLabelValues, }) diff --git a/collector/btrfs_linux_test.go b/collector/btrfs_linux_test.go index 7be7bc39bb..0013d6d3bc 100644 --- a/collector/btrfs_linux_test.go +++ b/collector/btrfs_linux_test.go @@ -127,3 +127,33 @@ func TestBtrfs(t *testing.T) { } } } + +func TestBtrfsDeviceUnusedBytesDuringShrink(t *testing.T) { + fs, err := btrfs.NewFS("fixtures/sys") + if err != nil { + t.Fatal(err) + } + collector := &btrfsCollector{fs: fs} + + stats, err := collector.fs.Stats() + if err != nil { + t.Fatalf("Failed to retrieve Btrfs stats: %v", err) + } + + ioctlStats := &btrfsIoctlFsStats{ + devices: []btrfsIoctlFsDevStats{ + {path: "/dev/sda", uuid: "dev-uuid", totalBytes: 10 << 30, bytesUsed: 12 << 30}, + }, + } + + for _, m := range collector.getMetrics(stats[0], ioctlStats) { + if m.name != "device_unused_bytes" { + continue + } + if want := -float64(2 << 30); m.value != want { + t.Errorf("Incorrect device_unused_bytes: expected %v, got %v", want, m.value) + } + return + } + t.Error("device_unused_bytes metric not found") +} From 0192dd896337e6eeb5935024cd5d8aec431caf3a Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Thu, 19 Nov 2026 18:31:41 +0100 Subject: [PATCH 80/87] Release v1.13.1 (#3910) * [BUGFIX] btrfs: Fix device_unused_bytes wrapping around during shrink #3827 * [BUGFIX] textfile: fix panic on a metric without HELP after inconsistent help texts #3866 Signed-off-by: Ben Kochie --- CHANGELOG.md | 7 ++++++- VERSION | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33a6474852..e76c1a5935 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ ## master / unreleased -## 1.13.0 / 2026-11-19 +## 1.13.1 / 2026-11-19 + +* [BUGFIX] btrfs: Fix device_unused_bytes wrapping around during shrink #3827 +* [BUGFIX] textfile: fix panic on a metric without HELP after inconsistent help texts #3866 + +## 1.13.0 / 2026-11-18 NOTE: diff --git a/VERSION b/VERSION index feaae22bac..b50dd27dd9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.13.0 +1.13.1 From 5d9a510b3af4116b37f28fd56f3257cf1d6f418f Mon Sep 17 00:00:00 2001 From: Roman Krompets Date: Mon, 23 Nov 2026 05:39:05 -0500 Subject: [PATCH 81/87] CLOS-9230: Pin unix socket mode invariants in tests Before syncing with upstream (which moves server startup to exporter-toolkit/bootstrap), pin the socket-mode behaviour cl_plus relies on that no test covered yet: - end-to-end-test.sh -s: the socket gets the default 0640 permissions and the exporter process owns no TCP listener. - TestUnixSocket: a non-default --web.socket-permissions is applied, the --web.listen-address passed alongside is not served, SIGTERM exits 0 and removes the socket file. Both pass against the current implementation. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01ByLmoC6vPtQjunkTkv35PG Worked-On: cl-aiworkspaces --- docs/design/unix-socket-listener.md | 22 +++++----- end-to-end-test.sh | 16 ++++++++ node_exporter_test.go | 64 +++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 11 deletions(-) diff --git a/docs/design/unix-socket-listener.md b/docs/design/unix-socket-listener.md index c93dadd620..3d1ff691f3 100644 --- a/docs/design/unix-socket-listener.md +++ b/docs/design/unix-socket-listener.md @@ -84,23 +84,23 @@ its parent directory, and setting the scraping group. | Metrics over unix socket match metrics over TCP | `end-to-end-test.sh -s` (invoked by `make test-e2e`) | E2E | Full `/metrics` exposition via `curl --unix-socket` must diff-equal the fixture produced via TCP. | | Socket file is removed on clean shutdown | `end-to-end-test.sh` finish trap (socket mode) | E2E | After SIGTERM, `ls` on the socket path must fail; test exits non-zero otherwise. | | Both transports still work after refactors | `Makefile` `test-e2e` target | E2E | Runs the e2e suite twice — once with TCP (`--web.listen-address`) and once with `--web.socket-path`. | +| Default permissions are applied | `end-to-end-test.sh -s` | E2E | Without `--web.socket-permissions` (as `cl_plus` runs it) the socket file has mode `640`. | +| No TCP listener in socket mode | `end-to-end-test.sh -s` | E2E | `ss -ltnp` must list no TCP listener owned by the exporter process (the default `:9100` included). | +| Non-default permissions, ignored TCP flags, SIGTERM exit | `TestUnixSocket` in `node_exporter_test.go` | Go (runs the binary) | `--web.socket-permissions 0600` gives a `0600` socket; the `--web.listen-address` passed alongside is not served; SIGTERM exits 0 and removes the socket. Like the other binary tests there, it is skipped unless the binary is at `$GOPATH/bin/node_exporter`, so it does not run in package builds. | ### Known gaps -- **Permission mode semantics are not tested.** No automated test verifies - that `--web.socket-permissions` actually produces the requested mode on - disk, nor that a non-default value (e.g., `0600`, `0660`) is honoured. -- **Concurrent-start / stale-socket scenarios are not tested.** The e2e - suite does not cover the case where a previous process crashed leaving a - socket file behind, nor the case where two exporters race on the same - path. +- **Concurrent-start / stale-socket scenarios are barely tested.** The e2e + suite pre-creates the socket path as a regular file, so removal of a + stale file at startup is exercised, but a stale socket left by a crashed + process and two exporters racing on the same path are not. - **Chmod-failure path is not tested.** Exit behaviour when `chmod` fails (e.g., socket path on a filesystem that rejects mode changes) is not exercised. - **Signal-handling coverage is shallow.** Only the graceful `SIGINT`/`SIGTERM` path is exercised; `SIGKILL` or panic paths (which leak the socket file by design) are not asserted anywhere. -- **No assertion that TCP flags are ignored in socket mode.** A user - passing both `--web.listen-address` and `--web.socket-path` gets - socket-only behaviour silently; this is not documented in `--help` or - checked at flag-parse time. +- **Ignoring TCP flags in socket mode is silent.** A user passing both + `--web.listen-address` and `--web.socket-path` gets socket-only behaviour + (asserted by `TestUnixSocket`); this is not documented in `--help` or + reported at flag-parse time. diff --git a/end-to-end-test.sh b/end-to-end-test.sh index 552d49ab70..a82e963676 100755 --- a/end-to-end-test.sh +++ b/end-to-end-test.sh @@ -370,6 +370,22 @@ sleep 1 fi ) | grep --text -E -v "${skip_re}" > "${generated_metrics}" +if [ ${socket} -ne 0 ]; then + # The default --web.socket-permissions (0640, what cl_plus runs with) is + # applied to the socket file. + socket_mode=$(stat -c '%a' "${unix_socket}") + if [ "${socket_mode}" != "640" ]; then + echo "Unix socket has permissions ${socket_mode}, want 640" + exit 1 + fi + # No TCP listener is opened in unix socket mode. + tcp_listeners=$(ss -ltnp) + if grep -q "pid=$(cat "${tmpdir}/node_exporter.pid")," <<< "${tcp_listeners}"; then + echo "Node exporter opened a TCP listener in unix socket mode" + exit 1 + fi +fi + # The following ignore-list is only applicable to the VMs used to run E2E tests on platforms for which containerized environments are not available. # However, owing to this, there are some non-deterministic metrics that end up generating samples, unlike their containerized counterparts, for e.g., node_network_receive_bytes_total. non_deterministic_metrics=$(cat << METRICS diff --git a/node_exporter_test.go b/node_exporter_test.go index 0d6b41e4d5..71fd5e0e41 100644 --- a/node_exporter_test.go +++ b/node_exporter_test.go @@ -14,12 +14,15 @@ package main import ( + "context" "fmt" "io" + "net" "net/http" "os" "os/exec" "path/filepath" + "syscall" "testing" "time" @@ -108,6 +111,67 @@ func TestHandlingOfDuplicatedMetrics(t *testing.T) { } } +// TestUnixSocket covers the CloudLinux unix socket transport, see +// docs/design/unix-socket-listener.md. +func TestUnixSocket(t *testing.T) { + if _, err := os.Stat(binary); err != nil { + t.Skipf("node_exporter binary not available, try to run `make build` first: %s", err) + } + + socket := filepath.Join(t.TempDir(), "node_exporter.socket") + exporter := exec.Command(binary, + "--web.socket-path", socket, + "--web.socket-permissions", "0600", + "--web.listen-address", address) + if err := exporter.Start(); err != nil { + t.Fatalf("failed to start command: %s", err) + } + defer exporter.Process.Kill() + + client := &http.Client{Transport: &http.Transport{ + DialContext: func(ctx context.Context, _, _ string) (net.Conn, error) { + return (&net.Dialer{}).DialContext(ctx, "unix", socket) + }, + }} + var err error + for range 10 { + time.Sleep(500 * time.Millisecond) + var resp *http.Response + if resp, err = client.Get("http://localhost/metrics"); err == nil { + resp.Body.Close() + if resp.StatusCode != http.StatusOK { + err = fmt.Errorf("want /metrics status code %d, have %d", http.StatusOK, resp.StatusCode) + } + break + } + } + if err != nil { + t.Fatalf("metrics are not served on the unix socket: %s", err) + } + + fi, err := os.Stat(socket) + if err != nil { + t.Fatal(err) + } + if fi.Mode()&os.ModeSocket == 0 || fi.Mode().Perm() != 0600 { + t.Errorf("want a socket with permissions 0600, have %s", fi.Mode()) + } + + if err := queryExporter(address); err == nil { + t.Errorf("want no TCP listener on %s in unix socket mode", address) + } + + if err := exporter.Process.Signal(syscall.SIGTERM); err != nil { + t.Fatal(err) + } + if err := exporter.Wait(); err != nil { + t.Errorf("want clean exit on SIGTERM, have %s", err) + } + if _, err := os.Stat(socket); !os.IsNotExist(err) { + t.Errorf("want the socket file removed on SIGTERM, have %v", err) + } +} + func queryExporter(address string) error { resp, err := http.Get(fmt.Sprintf("http://%s/metrics", address)) if err != nil { From 2fbb7901df10c487e431f3556f6aea99a8c513f7 Mon Sep 17 00:00:00 2001 From: Roman Krompets Date: Mon, 23 Nov 2026 05:51:33 -0500 Subject: [PATCH 82/87] CLOS-9230: Fix data race in diskstats and mdadm collector tests TestDiskStats and TestMdadmStats start collector.Update on a sink that nobody reads, so the goroutine outlives the test. It is still reading the collector path flags when a later test (TestMountPointDetails, TestMemInfo) re-parses kingpin flags, and `go test -race` (what `make test` runs on amd64, including the RPM %build) fails with "race detected during execution of test". On this host with Go 1.27.4, `go test -short -race ./...` failed 8 of 20 runs on unmodified upstream v1.13.1 and 2 of 20 on the previous fork base; with the sink drained it passed 30 of 30. Test-only change to upstream files; drop it once upstream fixes the tests. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01ByLmoC6vPtQjunkTkv35PG Worked-On: cl-aiworkspaces --- collector/diskstats_linux_test.go | 4 ++++ collector/mdadm_linux_test.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/collector/diskstats_linux_test.go b/collector/diskstats_linux_test.go index d8190c0cf0..782832e35f 100644 --- a/collector/diskstats_linux_test.go +++ b/collector/diskstats_linux_test.go @@ -348,6 +348,10 @@ node_disk_written_bytes_total{device="vda"} 1.0938236928e+11 } close(sink) }() + // Drain the sink so the Update goroutine ends before the test does and + // cannot race with flag parsing in the next test. + for range sink { + } err = testutil.GatherAndCompare(reg, strings.NewReader(testcase)) if err != nil { diff --git a/collector/mdadm_linux_test.go b/collector/mdadm_linux_test.go index 6aa216232e..db20c99b60 100644 --- a/collector/mdadm_linux_test.go +++ b/collector/mdadm_linux_test.go @@ -285,6 +285,10 @@ func TestMdadmStats(t *testing.T) { } close(sink) }() + // Drain the sink so the Update goroutine ends before the test does and + // cannot race with flag parsing in the next test. + for range sink { + } err = testutil.GatherAndCompare(reg, strings.NewReader(testcase)) if err != nil { From 4b61793f7f9fed602d9ea0eeea61137c179156fa Mon Sep 17 00:00:00 2001 From: Roman Krompets Date: Mon, 23 Nov 2026 05:52:33 -0500 Subject: [PATCH 83/87] CLOS-9230: Build with Go 1.27.4, bump to 1.2.2-1 Upstream v1.13.1 requires Go 1.26.0 (go.mod); the recipes still fetched go1.24.0, with which the go command's default GOTOOLCHAIN=auto would download a newer toolchain from proxy.golang.org on its own (the 1.2.1 binary reports go1.25.0 for that reason). Fetch go1.27.4 from dl.google.com in node_exporter.spec and debian/rules, the latest patch of the Go line upstream builds v1.13.1 with (.promu.yml, CI setup-go). Bump version to 1.2.2-1 in the spec and debian/changelog. Update the packaging design spec: toolchain pin and why, module/promu downloads, and the test coverage table (the RPM build does not run test-e2e; QA runs it on the installed tests subpackage). Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01ByLmoC6vPtQjunkTkv35PG Worked-On: cl-aiworkspaces --- debian/changelog | 7 ++++++ debian/rules | 2 +- docs/design/cloudlinux-packaging.md | 34 ++++++++++++++++++++--------- node_exporter.spec | 9 +++++--- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/debian/changelog b/debian/changelog index 23865ce2c3..a6b12c1edc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +cl-node-exporter (1.2.2-1) stable; urgency=medium + + [ Roman Krompets ] + * CLOS-9230: Sync node_exporter with upstream (v1.13.1) + + -- Roman Krompets Mon, 23 Nov 2026 10:00:00 +0000 + cl-node-exporter (1.2.1-1) stable; urgency=medium [ Roman Krompets ] diff --git a/debian/rules b/debian/rules index 0a0ea703d4..362603b163 100644 --- a/debian/rules +++ b/debian/rules @@ -29,7 +29,7 @@ _clshare_plus := /usr/share/cloudlinux/cl_plus dh $@ override_dh_auto_build: - curl https://dl.google.com/go/go1.24.0.linux-amd64.tar.gz --output /tmp/go.tar.gz + curl https://dl.google.com/go/go1.27.4.linux-amd64.tar.gz --output /tmp/go.tar.gz tar xzf /tmp/go.tar.gz -C /tmp/ make build make tools diff --git a/docs/design/cloudlinux-packaging.md b/docs/design/cloudlinux-packaging.md index bec3b7189e..a7531d9470 100644 --- a/docs/design/cloudlinux-packaging.md +++ b/docs/design/cloudlinux-packaging.md @@ -30,7 +30,7 @@ package (`cl_plus`). | Path | Purpose | |------|---------| | `/opt/node_exporter_tests/node_exporter` | Second copy of the built binary, used by the e2e harness. | -| `/opt/node_exporter_tests/end-to-end-test.sh` | E2E harness script. | +| `/opt/node_exporter_tests/end-to-end-test.sh` | E2E harness script. Needs `curl`, and for `-s` also `stat` and `ss` (iproute), on the test host; the subpackage declares no dependencies (`AutoReq: 0`). | | `/opt/node_exporter_tests/collector/` | Fixture data (procfs/sysfs/udev snapshots). Broken symlinks under `fixtures/` are stripped during `%install` because dh on Ubuntu rejects them. | | `/opt/node_exporter_tests/tools/tools` | Build-tag matcher helper used by the e2e script. | @@ -43,11 +43,24 @@ the exact binary that ships, including the CloudLinux unix-socket mode (see Both packages download and use a pinned upstream Go toolchain at build time rather than relying on the distro's `golang` package: -- **Pinned version: `go1.24.0`.** Hard-coded in both `node_exporter.spec` - (`%build` section) and `debian/rules` (`override_dh_auto_build`). -- **Source:** `https://dl.google.com/go/go1.24.0.linux-.tar.gz`. +- **Pinned version: `go1.27.4`.** Hard-coded in both `node_exporter.spec` + (`%build` section) and `debian/rules` (`override_dh_auto_build`). It must + be at least the `go` directive in `go.mod` (`1.26.0` at upstream v1.13.1): + with an older toolchain the go command's default `GOTOOLCHAIN=auto` + silently downloads the required toolchain from `proxy.golang.org` (the + 1.2.1 package pinned `go1.24.0` but its binary reports `go1.25.0`). The + pin follows the Go line upstream builds releases with (`.promu.yml`, + `setup-go` in `.github/workflows/ci.yml`), at its latest patch release. +- **Source:** `https://dl.google.com/go/go1.27.4.linux-.tar.gz` + (`amd64`; the spec's non-x86_64 branch fetches `386`). The archive is not + checksum-verified by the recipes; the published SHA-256 values are listed + at `https://go.dev/dl/?mode=json`. - **Location:** extracted to `%{_tmppath}/go` (RPM) or `/tmp/go` (deb). -- The pinned toolchain is prepended to `PATH` for the duration of the build. +- The pinned toolchain is appended to `PATH` in the spec (a `go` already on + the builder's `PATH` would win) and prepended in `debian/rules`. +- Go modules are not vendored: `make build` / `make test` download them + from the Go module proxy, and `make build` downloads `promu` from GitHub, + so build workers need internet access. RPM spec also runs 32-bit cross-testing (`make test-32bit`) on x86_64/amd64 builds. The deb rules do not. @@ -98,7 +111,8 @@ builds. The deb rules do not. | Aspect | Test | Type | Covers | |--------|------|------|--------| -| Binary builds and e2e passes on RPM build workers | `%build` section of `node_exporter.spec` runs `make build`, `make test`, `make test-32bit` | RPM build-time | Compilation + unit tests + 32-bit cross-compile + e2e socket/TCP tests (`make test-e2e`) on RPM workers. Failure aborts the build. | +| Binary builds and unit tests pass on RPM build workers | `%build` section of `node_exporter.spec` runs `make build`, `make tools`, `make test`, `make test-32bit` | RPM build-time | Compilation + unit tests (with `-race` on x86_64) + 32-bit cross-compile tests on RPM workers. Failure aborts the build. `make test-e2e` is not run here; the root-package tests that need a built binary skip (it is not at `$GOPATH/bin`). | +| E2E over TCP and unix socket on the shipped binary | `rpm_tests/p_cl-node-exporter` in the QA repo runs `/opt/node_exporter_tests/end-to-end-test.sh` and `-s` | QA (installed package) | Both runs must exit 0 with no output. Ubuntu is skipped there (covered by `cl-end-server-tools` tests). | | Binary builds on Ubuntu build workers | `override_dh_auto_build` in `debian/rules` runs `make build`, `make tools`, `make test` | deb build-time | Compilation + unit tests on Ubuntu. (No `test-e2e` is wired in deb.) | | Fixture ttar archive is extractable | `make test-e2e` depends on `collector/fixtures/sys/.unpacked` and `collector/fixtures/udev/.unpacked` | Build | If the ttar archives are corrupt or missing, the build fails at extraction time. | @@ -112,10 +126,10 @@ builds. The deb rules do not. - **Version-file format is not asserted.** If a future change to the spec accidentally drops the newline, quotes the string, or appends the architecture, Sentry tagging will silently degrade. -- **Tests subpackage is not smoke-tested after install.** No CI job - installs `cl-node-exporter-tests` on a fresh VM and runs - `/opt/node_exporter_tests/end-to-end-test.sh` against the shipped - binary. +- **Tests subpackage runs on RPM systems only.** QA's + `rpm_tests/p_cl-node-exporter` installs `cl-node-exporter-tests` and runs + the e2e harness against the shipped binary on CloudLinux, but skips + Ubuntu. - **No coverage for non-amd64 targets.** Non-x86_64 arches are not built and therefore not exercised at all for the RPM or deb paths, even though upstream supports them. diff --git a/node_exporter.spec b/node_exporter.spec index 14f5f94e7b..01b2790498 100644 --- a/node_exporter.spec +++ b/node_exporter.spec @@ -4,7 +4,7 @@ Autoreq: 0 %define pkg_version_file %{cl_dir}%{name} Name: cl-node-exporter -Version: 1.2.1 +Version: 1.2.2 Release: 1%{dist}.cloudlinux Summary: CL Node Exporter tool License: Apache License, Version 2.0 @@ -38,9 +38,9 @@ This package provides end-to-end tests for Node Exporter tool %build # download new version of Go compiler %ifarch x86_64 amd64 ia32e -curl https://dl.google.com/go/go1.24.0.linux-amd64.tar.gz --output %{_tmppath}/go.tar.gz +curl https://dl.google.com/go/go1.27.4.linux-amd64.tar.gz --output %{_tmppath}/go.tar.gz %else -curl https://dl.google.com/go/go1.24.0.linux-386.tar.gz --output %{_tmppath}/go.tar.gz +curl https://dl.google.com/go/go1.27.4.linux-386.tar.gz --output %{_tmppath}/go.tar.gz %endif tar xzf %{_tmppath}/go.tar.gz -C %{_tmppath} export PATH=$PATH:%{_tmppath}/go/bin @@ -94,6 +94,9 @@ exit 0 %changelog +* Mon Nov 23 2026 Roman Krompets 1.2.2-1 +- CLOS-9230: Sync repository with upstream (v1.13.1) + * Fri Apr 24 2026 Roman Krompets 1.2.1-1 - CLPRO-3024: Sync repository with upstream (v1.11.1) From b22df28423904a0d15a9cfdc56b4ce2592a71c80 Mon Sep 17 00:00:00 2001 From: Roman Krompets Date: Mon, 23 Nov 2026 05:57:52 -0500 Subject: [PATCH 84/87] CLOS-9230: Keep dm slaves fixture links in the RPM tests subpackage Upstream v1.13.0 added node_disk_device_mapper_backing_device_info; its e2e fixtures list sys/block/dm-*/slaves/* entries that are dangling symlinks (the collector only reads their names). The spec deleted every dangling symlink under the shipped fixtures, so the installed /opt/node_exporter_tests/end-to-end-test.sh failed in both modes with five missing series. Keep the slaves/ links in the RPM. Verified with a local rpmbuild on CL9: the package builds, and both ./end-to-end-test.sh and ./end-to-end-test.sh -s run from the extracted tests subpackage exit 0 with no output (they failed before this change). debian/rules is unchanged: its blanket removal was added because dh failed on dangling symlinks, and QA does not run the e2e on Ubuntu. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01ByLmoC6vPtQjunkTkv35PG Worked-On: cl-aiworkspaces --- docs/design/cloudlinux-packaging.md | 7 +++++-- node_exporter.spec | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/design/cloudlinux-packaging.md b/docs/design/cloudlinux-packaging.md index a7531d9470..75ecadb7f0 100644 --- a/docs/design/cloudlinux-packaging.md +++ b/docs/design/cloudlinux-packaging.md @@ -31,7 +31,7 @@ package (`cl_plus`). |------|---------| | `/opt/node_exporter_tests/node_exporter` | Second copy of the built binary, used by the e2e harness. | | `/opt/node_exporter_tests/end-to-end-test.sh` | E2E harness script. Needs `curl`, and for `-s` also `stat` and `ss` (iproute), on the test host; the subpackage declares no dependencies (`AutoReq: 0`). | -| `/opt/node_exporter_tests/collector/` | Fixture data (procfs/sysfs/udev snapshots). Broken symlinks under `fixtures/` are stripped during `%install` because dh on Ubuntu rejects them. | +| `/opt/node_exporter_tests/collector/` | Fixture data (procfs/sysfs/udev snapshots). Broken symlinks under `fixtures/` are stripped during install because dh on Ubuntu rejects them. The RPM keeps the broken `sys/block/dm-*/slaves/*` links: the diskstats collector lists them by name for `node_disk_device_mapper_backing_device_info` (upstream v1.13.0+), and without them the e2e output misses five series in both modes. | | `/opt/node_exporter_tests/tools/tools` | Build-tag matcher helper used by the e2e script. | This subpackage exists so the QA pipeline can run the upstream e2e suite on @@ -78,7 +78,10 @@ builds. The deb rules do not. - After install, `find $buildroot/opt/node_exporter_tests/collector/fixtures -xtype l -delete` removes broken symlinks produced by the procfs fixture - ttar archive. Without this, `dh_*` fails the build on Ubuntu. + ttar archive. Without this, `dh_*` fails the build on Ubuntu. Unlike the + RPM it also removes the `slaves/` links, so the deb tests package's e2e + would miss the five `node_disk_device_mapper_backing_device_info` series + for `dm-0`..`dm-4`; QA does not run the e2e on Ubuntu. - `override_dh_auto_clean` only removes `debian/tmp` — it does not invoke `make clean`, so the vendored Go toolchain in `/tmp/go` may persist between builds on a long-lived worker. diff --git a/node_exporter.spec b/node_exporter.spec index 01b2790498..804bd2117a 100644 --- a/node_exporter.spec +++ b/node_exporter.spec @@ -72,8 +72,9 @@ install -D -m 755 node_exporter $RPM_BUILD_ROOT/opt/node_exporter_tests/node_exp mkdir -p $RPM_BUILD_ROOT/opt/node_exporter_tests/tools install -D -m 755 tools/tools $RPM_BUILD_ROOT/opt/node_exporter_tests/tools/tools -# remove broken symlinks -find $RPM_BUILD_ROOT/opt/node_exporter_tests/collector/fixtures -xtype l -delete +# remove broken symlinks, except block device slaves/ entries: the diskstats +# collector reads them by name and the e2e output expects them +find $RPM_BUILD_ROOT/opt/node_exporter_tests/collector/fixtures -xtype l ! -path '*/slaves/*' -delete # write package version to file if [[ ! -d "$RPM_BUILD_ROOT%{cl_dir}" ]]; then From cad2ef4fd9239f25f085b4326481029de0586889 Mon Sep 17 00:00:00 2001 From: Roman Krompets Date: Mon, 23 Nov 2026 07:44:33 -0500 Subject: [PATCH 85/87] CLOS-9230: Keep dm slaves links and empty fixture dirs in the deb tests package The deb tests package lost fixture data the e2e harness reads: debian/rules deleted every dangling symlink, including the sys/block/dm-*/slaves/* links upstream v1.13.0 added, and dh_movefiles moves only files and symlinks, so empty fixture directories such as sys/block/dm-5/slaves/sd* were dropped. end-to-end-test.sh on the installed debs (Ubuntu 22.04) failed in TCP and unix-socket mode on node_disk_device_mapper_backing_device_info and node_dmmultipath_*. Keep the slaves links like the RPM spec does and create the empty fixture directories in the tests package. With both, the deb e2e passes in both modes. debhelper 13.6 builds the package with the links kept. The packaging design spec now describes this and lists diff among the tools the e2e harness needs on the test host. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01ByLmoC6vPtQjunkTkv35PG Worked-On: cl-aiworkspaces --- debian/rules | 9 +++++++-- docs/design/cloudlinux-packaging.md | 19 ++++++++++++------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/debian/rules b/debian/rules index 362603b163..a8ce1ec771 100644 --- a/debian/rules +++ b/debian/rules @@ -51,11 +51,16 @@ override_dh_auto_install: mkdir -p $(buildroot)/opt/node_exporter_tests/tools install -D -m 755 tools/tools $(buildroot)/opt/node_exporter_tests/tools/tools - # remove broken symlinks - find $(buildroot)/opt/node_exporter_tests/collector/fixtures -xtype l -delete + # remove broken symlinks, except block device slaves/ entries: the diskstats + # collector reads them by name and the e2e output expects them + find $(buildroot)/opt/node_exporter_tests/collector/fixtures -xtype l ! -path '*/slaves/*' -delete echo "$(version)-$(release)" > $(buildroot)/usr/share/cloudlinux/cl_version + # dh_movefiles moves files and symlinks only: create the empty fixture + # directories (e.g. sys/block/dm-5/slaves/sd*) in the tests package + cd $(buildroot) && find ./opt/node_exporter_tests/collector -type d -empty -exec install -d $(CURDIR)/debian/$(name)-tests/{} \; + # Packaging dh_movefiles -p$(name) \ .$(_clshare_plus)/node_exporter diff --git a/docs/design/cloudlinux-packaging.md b/docs/design/cloudlinux-packaging.md index 75ecadb7f0..526a657abd 100644 --- a/docs/design/cloudlinux-packaging.md +++ b/docs/design/cloudlinux-packaging.md @@ -30,8 +30,8 @@ package (`cl_plus`). | Path | Purpose | |------|---------| | `/opt/node_exporter_tests/node_exporter` | Second copy of the built binary, used by the e2e harness. | -| `/opt/node_exporter_tests/end-to-end-test.sh` | E2E harness script. Needs `curl`, and for `-s` also `stat` and `ss` (iproute), on the test host; the subpackage declares no dependencies (`AutoReq: 0`). | -| `/opt/node_exporter_tests/collector/` | Fixture data (procfs/sysfs/udev snapshots). Broken symlinks under `fixtures/` are stripped during install because dh on Ubuntu rejects them. The RPM keeps the broken `sys/block/dm-*/slaves/*` links: the diskstats collector lists them by name for `node_disk_device_mapper_backing_device_info` (upstream v1.13.0+), and without them the e2e output misses five series in both modes. | +| `/opt/node_exporter_tests/end-to-end-test.sh` | E2E harness script. Needs `curl` and `diff` (diffutils), and for `-s` also `stat` and `ss` (iproute), on the test host; the subpackage declares no dependencies (`AutoReq: 0`). | +| `/opt/node_exporter_tests/collector/` | Fixture data (procfs/sysfs/udev snapshots). Broken symlinks under `fixtures/` are stripped during install, except the broken `sys/block/dm-*/slaves/*` links, which both recipes keep: the diskstats collector lists them by name for `node_disk_device_mapper_backing_device_info` (upstream v1.13.0+), and without them the e2e output misses five series in both modes. | | `/opt/node_exporter_tests/tools/tools` | Build-tag matcher helper used by the e2e script. | This subpackage exists so the QA pipeline can run the upstream e2e suite on @@ -77,11 +77,16 @@ builds. The deb rules do not. ### Debian-only conventions (`debian/rules`) - After install, `find $buildroot/opt/node_exporter_tests/collector/fixtures - -xtype l -delete` removes broken symlinks produced by the procfs fixture - ttar archive. Without this, `dh_*` fails the build on Ubuntu. Unlike the - RPM it also removes the `slaves/` links, so the deb tests package's e2e - would miss the five `node_disk_device_mapper_backing_device_info` series - for `dm-0`..`dm-4`; QA does not run the e2e on Ubuntu. + -xtype l ! -path '*/slaves/*' -delete` removes broken symlinks produced by + the sysfs fixture ttar archive, keeping the `slaves/` ones like the RPM + spec does. The removal was added because `dh_*` failed on broken links + (commit e978e382); debhelper 13.6 on Ubuntu 22.04 packages them fine. +- `dh_movefiles` moves only files and symlinks, so empty fixture + directories (e.g. `sys/block/dm-5/slaves/sd*`, listed by the dmmultipath + collector) are created in the tests package directly with + `find -type d -empty -exec install -d`. Without them the deb tests + package's e2e misses the `node_dmmultipath_*` path series. QA does not + run the e2e on Ubuntu, so only a manual run catches this. - `override_dh_auto_clean` only removes `debian/tmp` — it does not invoke `make clean`, so the vendored Go toolchain in `/tmp/go` may persist between builds on a long-lived worker. From fe090f5f316b59c01ba166a4aacffc90cb76e824 Mon Sep 17 00:00:00 2001 From: Roman Krompets Date: Mon, 23 Nov 2026 07:57:53 -0500 Subject: [PATCH 86/87] CLOS-9230: Ship dm slaves fixture entries as empty files, not dangling links QA's 0_integrity_check.bats ("symlinks are correct and exists") fails any package that contains a symlink to a missing target. Since 2becbe36 the tests package shipped none, but keeping the five sys/block/dm-{0..4}/slaves/* links (b22df284 for the RPM, cad2ef4f for the deb) made that gate fail for cl-node-exporter-tests on every target. The diskstats collector only reads the entry names in slaves/ (procfs SysBlockDeviceUnderlyingDevices uses Readdirnames), so both recipes now turn those dangling links into empty regular files of the same name and delete every other dangling link as before. The package again has no dangling symlinks and the e2e output still has the five node_disk_device_mapper_backing_device_info series. The packaging design spec records the no-dangling-symlink invariant and the QA gate that enforces it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01ByLmoC6vPtQjunkTkv35PG Worked-On: cl-aiworkspaces --- debian/rules | 7 ++++--- docs/design/cloudlinux-packaging.md | 14 ++++++++------ node_exporter.spec | 7 ++++--- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/debian/rules b/debian/rules index a8ce1ec771..a58208c573 100644 --- a/debian/rules +++ b/debian/rules @@ -51,9 +51,10 @@ override_dh_auto_install: mkdir -p $(buildroot)/opt/node_exporter_tests/tools install -D -m 755 tools/tools $(buildroot)/opt/node_exporter_tests/tools/tools - # remove broken symlinks, except block device slaves/ entries: the diskstats - # collector reads them by name and the e2e output expects them - find $(buildroot)/opt/node_exporter_tests/collector/fixtures -xtype l ! -path '*/slaves/*' -delete + # remove broken symlinks (QA rejects them); block device slaves/ entries are + # read by name only (diskstats backing devices), so they become empty files + find $(buildroot)/opt/node_exporter_tests/collector/fixtures -xtype l -path '*/slaves/*' -exec rm {} \; -exec touch {} \; + find $(buildroot)/opt/node_exporter_tests/collector/fixtures -xtype l -delete echo "$(version)-$(release)" > $(buildroot)/usr/share/cloudlinux/cl_version diff --git a/docs/design/cloudlinux-packaging.md b/docs/design/cloudlinux-packaging.md index 526a657abd..5eb2506e38 100644 --- a/docs/design/cloudlinux-packaging.md +++ b/docs/design/cloudlinux-packaging.md @@ -31,7 +31,7 @@ package (`cl_plus`). |------|---------| | `/opt/node_exporter_tests/node_exporter` | Second copy of the built binary, used by the e2e harness. | | `/opt/node_exporter_tests/end-to-end-test.sh` | E2E harness script. Needs `curl` and `diff` (diffutils), and for `-s` also `stat` and `ss` (iproute), on the test host; the subpackage declares no dependencies (`AutoReq: 0`). | -| `/opt/node_exporter_tests/collector/` | Fixture data (procfs/sysfs/udev snapshots). Broken symlinks under `fixtures/` are stripped during install, except the broken `sys/block/dm-*/slaves/*` links, which both recipes keep: the diskstats collector lists them by name for `node_disk_device_mapper_backing_device_info` (upstream v1.13.0+), and without them the e2e output misses five series in both modes. | +| `/opt/node_exporter_tests/collector/` | Fixture data (procfs/sysfs/udev snapshots). Both recipes strip broken symlinks under `fixtures/` during install, so the package ships none (see Invariants). The five broken `sys/block/dm-*/slaves/*` links are replaced by empty regular files of the same name instead: the diskstats collector only lists the entry names there (procfs `SysBlockDeviceUnderlyingDevices`, `Readdirnames`) for `node_disk_device_mapper_backing_device_info` (upstream v1.13.0+), and without them the e2e output misses five series in both modes. | | `/opt/node_exporter_tests/tools/tools` | Build-tag matcher helper used by the e2e script. | This subpackage exists so the QA pipeline can run the upstream e2e suite on @@ -76,11 +76,6 @@ builds. The deb rules do not. ### Debian-only conventions (`debian/rules`) -- After install, `find $buildroot/opt/node_exporter_tests/collector/fixtures - -xtype l ! -path '*/slaves/*' -delete` removes broken symlinks produced by - the sysfs fixture ttar archive, keeping the `slaves/` ones like the RPM - spec does. The removal was added because `dh_*` failed on broken links - (commit e978e382); debhelper 13.6 on Ubuntu 22.04 packages them fine. - `dh_movefiles` moves only files and symlinks, so empty fixture directories (e.g. `sys/block/dm-5/slaves/sd*`, listed by the dmmultipath collector) are created in the tests package directly with @@ -110,6 +105,12 @@ builds. The deb rules do not. - **Tests subpackage is optional.** The binary package must function without `cl-node-exporter-tests` installed; the test subpackage is a QA-only artifact. +- **No dangling symlinks in either package.** QA's + `rpm_tests/common/0_integrity_check.bats` ("symlinks are correct and + exists") fails a package with a symlink to a missing target, on every + target including Ubuntu. Fixture links that dangle after extraction are + deleted, or, where a collector needs the entry name, replaced by an empty + file in both recipes. - **Both architectures are amd64-only today.** Both `node_exporter.spec` (via the `%ifarch` x86_64/amd64/ia32e branches being the only curl'd Go archives) and `debian/control` (`Architecture: amd64`) restrict the @@ -121,6 +122,7 @@ builds. The deb rules do not. |--------|------|------|--------| | Binary builds and unit tests pass on RPM build workers | `%build` section of `node_exporter.spec` runs `make build`, `make tools`, `make test`, `make test-32bit` | RPM build-time | Compilation + unit tests (with `-race` on x86_64) + 32-bit cross-compile tests on RPM workers. Failure aborts the build. `make test-e2e` is not run here; the root-package tests that need a built binary skip (it is not at `$GOPATH/bin`). | | E2E over TCP and unix socket on the shipped binary | `rpm_tests/p_cl-node-exporter` in the QA repo runs `/opt/node_exporter_tests/end-to-end-test.sh` and `-s` | QA (installed package) | Both runs must exit 0 with no output. Ubuntu is skipped there (covered by `cl-end-server-tools` tests). | +| Packages ship no dangling symlinks | `rpm_tests/common/0_integrity_check.bats` in the QA repo ("symlinks are correct and exists") | QA (installed package) | Every symlink in `cl-node-exporter` and `cl-node-exporter-tests` must resolve; runs on all targets including Ubuntu. | | Binary builds on Ubuntu build workers | `override_dh_auto_build` in `debian/rules` runs `make build`, `make tools`, `make test` | deb build-time | Compilation + unit tests on Ubuntu. (No `test-e2e` is wired in deb.) | | Fixture ttar archive is extractable | `make test-e2e` depends on `collector/fixtures/sys/.unpacked` and `collector/fixtures/udev/.unpacked` | Build | If the ttar archives are corrupt or missing, the build fails at extraction time. | diff --git a/node_exporter.spec b/node_exporter.spec index 804bd2117a..ae91fc7ab8 100644 --- a/node_exporter.spec +++ b/node_exporter.spec @@ -72,9 +72,10 @@ install -D -m 755 node_exporter $RPM_BUILD_ROOT/opt/node_exporter_tests/node_exp mkdir -p $RPM_BUILD_ROOT/opt/node_exporter_tests/tools install -D -m 755 tools/tools $RPM_BUILD_ROOT/opt/node_exporter_tests/tools/tools -# remove broken symlinks, except block device slaves/ entries: the diskstats -# collector reads them by name and the e2e output expects them -find $RPM_BUILD_ROOT/opt/node_exporter_tests/collector/fixtures -xtype l ! -path '*/slaves/*' -delete +# remove broken symlinks (QA rejects them); block device slaves/ entries are +# read by name only (diskstats backing devices), so they become empty files +find $RPM_BUILD_ROOT/opt/node_exporter_tests/collector/fixtures -xtype l -path '*/slaves/*' -exec rm {} \; -exec touch {} \; +find $RPM_BUILD_ROOT/opt/node_exporter_tests/collector/fixtures -xtype l -delete # write package version to file if [[ ! -d "$RPM_BUILD_ROOT%{cl_dir}" ]]; then From 1f731c0e7aee21ffd83ca05c598ba76dfe90f0d0 Mon Sep 17 00:00:00 2001 From: Roman Krompets Date: Mon, 23 Nov 2026 11:27:13 -0500 Subject: [PATCH 87/87] CLOS-9230: Make the unix socket test checks portable The checks added in 5d9a510b broke the upstream workflows on PR #9: `stat -c` is GNU-only (FreeBSD/OpenBSD e2e: "stat: illegal option -- c"), `ss` is missing from the golang-builder CI container and does not exist on the BSDs, Solaris or macOS ("ss: command not found", make Error 127), and gofumpt wants the 0o600 octal literal in TestUnixSocket. end-to-end-test.sh -s keeps asserting the same two invariants with only what the script already needs everywhere it runs: - default permissions: the first 10 characters of `ls -ld` on the socket must be srw-r-----; - no TCP listener: the exporter now also gets the script's own --web.listen-address=127.0.0.1:, and curl to it must fail with exit code 7 (connection refused) while the socket serves metrics. Any other curl result, including a missing curl, fails the run. This is the invariant TestUnixSocket pins; the released 1.2.1 refuses that address in socket mode too. The tests package no longer needs stat or ss on the test host; the packaging spec's dependency list and the socket spec's coverage table are updated. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01ByLmoC6vPtQjunkTkv35PG Worked-On: cl-aiworkspaces --- docs/design/cloudlinux-packaging.md | 2 +- docs/design/unix-socket-listener.md | 8 ++++---- end-to-end-test.sh | 20 ++++++++++++-------- node_exporter_test.go | 2 +- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/docs/design/cloudlinux-packaging.md b/docs/design/cloudlinux-packaging.md index 5eb2506e38..acc63b5803 100644 --- a/docs/design/cloudlinux-packaging.md +++ b/docs/design/cloudlinux-packaging.md @@ -30,7 +30,7 @@ package (`cl_plus`). | Path | Purpose | |------|---------| | `/opt/node_exporter_tests/node_exporter` | Second copy of the built binary, used by the e2e harness. | -| `/opt/node_exporter_tests/end-to-end-test.sh` | E2E harness script. Needs `curl` and `diff` (diffutils), and for `-s` also `stat` and `ss` (iproute), on the test host; the subpackage declares no dependencies (`AutoReq: 0`). | +| `/opt/node_exporter_tests/end-to-end-test.sh` | E2E harness script. Needs `curl` and `diff` (diffutils) on the test host, in both modes; the subpackage declares no dependencies (`AutoReq: 0`). | | `/opt/node_exporter_tests/collector/` | Fixture data (procfs/sysfs/udev snapshots). Both recipes strip broken symlinks under `fixtures/` during install, so the package ships none (see Invariants). The five broken `sys/block/dm-*/slaves/*` links are replaced by empty regular files of the same name instead: the diskstats collector only lists the entry names there (procfs `SysBlockDeviceUnderlyingDevices`, `Readdirnames`) for `node_disk_device_mapper_backing_device_info` (upstream v1.13.0+), and without them the e2e output misses five series in both modes. | | `/opt/node_exporter_tests/tools/tools` | Build-tag matcher helper used by the e2e script. | diff --git a/docs/design/unix-socket-listener.md b/docs/design/unix-socket-listener.md index 7606dab99e..1821873436 100644 --- a/docs/design/unix-socket-listener.md +++ b/docs/design/unix-socket-listener.md @@ -112,8 +112,8 @@ its parent directory, and setting the scraping group. | Metrics over unix socket match metrics over TCP | `end-to-end-test.sh -s` (invoked by `make test-e2e`) | E2E | Full `/metrics` exposition via `curl --unix-socket` must diff-equal the fixture produced via TCP. | | Socket file is removed on clean shutdown | `end-to-end-test.sh` finish trap (socket mode) | E2E | After SIGTERM, `ls` on the socket path must fail; test exits non-zero otherwise. | | Both transports still work after refactors | `Makefile` `test-e2e` target | E2E | Runs the e2e suite twice — once with TCP (`--web.listen-address`) and once with `--web.socket-path`. | -| Default permissions are applied | `end-to-end-test.sh -s` | E2E | Without `--web.socket-permissions` (as `cl_plus` runs it) the socket file has mode `640`. | -| No TCP listener in socket mode | `end-to-end-test.sh -s` | E2E | `ss -ltnp` must list no TCP listener owned by the exporter process (the default `:9100` included). | +| Default permissions are applied | `end-to-end-test.sh -s` | E2E | Without `--web.socket-permissions` (as `cl_plus` runs it) the socket file's `ls -ld` mode string starts with `srw-r-----`. | +| No TCP listener in socket mode | `end-to-end-test.sh -s` | E2E | The exporter also gets `--web.listen-address=127.0.0.1:`; `curl` to that address must fail with exit code 7 (connection refused) while the socket serves metrics. This shows bootstrap never opens its listeners; it does not look for TCP listeners on other addresses. The check uses only `ls` and `curl`, which the script already needs, so it runs unchanged on Linux and on the BSD, Solaris and macOS jobs of the upstream workflows. | | Non-default permissions, ignored TCP flags, SIGTERM exit | `TestUnixSocket` in `node_exporter_test.go` | Go (runs the binary) | `--web.socket-permissions 0600` gives a `0600` socket; the `--web.listen-address` passed alongside is not served; SIGTERM exits 0 and removes the socket. Like the other binary tests there, it is skipped unless the binary is at `$GOPATH/bin/node_exporter`, so it does not run in package builds. | ### Known gaps @@ -130,5 +130,5 @@ its parent directory, and setting the scraping group. leak the socket file by design) are not asserted anywhere. - **Ignoring TCP flags in socket mode is silent.** A user passing both `--web.listen-address` and `--web.socket-path` gets socket-only behaviour - (asserted by `TestUnixSocket`); this is not documented in `--help` or - reported at flag-parse time. + (asserted by `TestUnixSocket` and `end-to-end-test.sh -s`); this is not + documented in `--help` or reported at flag-parse time. diff --git a/end-to-end-test.sh b/end-to-end-test.sh index 1e39e7ea73..179bac5ffb 100755 --- a/end-to-end-test.sh +++ b/end-to-end-test.sh @@ -273,7 +273,8 @@ EOF if [ ${socket} -ne 0 ]; then touch "${unix_socket}" - connection_params="--web.socket-path=${unix_socket}" + # The TCP address is passed as well: unix socket mode must not listen on it. + connection_params="--web.socket-path=${unix_socket} --web.listen-address=127.0.0.1:${port}" else connection_params="--web.listen-address=127.0.0.1:${port}" fi @@ -375,15 +376,18 @@ sleep 1 if [ ${socket} -ne 0 ]; then # The default --web.socket-permissions (0640, what cl_plus runs with) is # applied to the socket file. - socket_mode=$(stat -c '%a' "${unix_socket}") - if [ "${socket_mode}" != "640" ]; then - echo "Unix socket has permissions ${socket_mode}, want 640" + socket_mode=$(ls -ld "${unix_socket}") + socket_mode=${socket_mode:0:10} + if [ "${socket_mode}" != "srw-r-----" ]; then + echo "Unix socket has mode ${socket_mode}, want srw-r-----" exit 1 fi - # No TCP listener is opened in unix socket mode. - tcp_listeners=$(ss -ltnp) - if grep -q "pid=$(cat "${tmpdir}/node_exporter.pid")," <<< "${tcp_listeners}"; then - echo "Node exporter opened a TCP listener in unix socket mode" + # No TCP listener is opened in unix socket mode: connecting to the + # --web.listen-address passed above must be refused (curl exit code 7). + tcp_rc=0 + curl -s -o /dev/null "http://127.0.0.1:${port}/" || tcp_rc=$? + if [ ${tcp_rc} -ne 7 ]; then + echo "Node exporter accepted a TCP connection on 127.0.0.1:${port} in unix socket mode (curl exit code ${tcp_rc}, want 7)" exit 1 fi fi diff --git a/node_exporter_test.go b/node_exporter_test.go index 39a7832141..eaa6337ca0 100644 --- a/node_exporter_test.go +++ b/node_exporter_test.go @@ -137,7 +137,7 @@ func TestUnixSocket(t *testing.T) { if err != nil { t.Fatal(err) } - if fi.Mode()&os.ModeSocket == 0 || fi.Mode().Perm() != 0600 { + if fi.Mode()&os.ModeSocket == 0 || fi.Mode().Perm() != 0o600 { t.Errorf("want a socket with permissions 0600, have %s", fi.Mode()) }