From 5b6be535f9839a7e3a4b86024a787ff52b98d662 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Mar 2026 01:38:16 +0000 Subject: [PATCH] Bump github.com/prometheus/procfs from 0.19.2 to 0.20.1 Bumps [github.com/prometheus/procfs](https://github.com/prometheus/procfs) from 0.19.2 to 0.20.1. - [Release notes](https://github.com/prometheus/procfs/releases) - [Commits](https://github.com/prometheus/procfs/compare/v0.19.2...v0.20.1) --- updated-dependencies: - dependency-name: github.com/prometheus/procfs dependency-version: 0.20.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 +- go.sum | 4 +- .../prometheus/procfs/.golangci.yml | 8 + .../prometheus/procfs/Makefile.common | 247 ++++++++++++++++-- .../github.com/prometheus/procfs/cpuinfo.go | 3 +- .../prometheus/procfs/cpuinfo_armx.go | 2 - .../prometheus/procfs/cpuinfo_loong64.go | 1 - .../prometheus/procfs/cpuinfo_mipsx.go | 2 - .../prometheus/procfs/cpuinfo_others.go | 1 - .../prometheus/procfs/cpuinfo_ppcx.go | 2 - .../prometheus/procfs/cpuinfo_riscvx.go | 2 - .../prometheus/procfs/cpuinfo_s390x.go | 1 - .../prometheus/procfs/cpuinfo_x86.go | 2 - .../prometheus/procfs/fs_statfs_notype.go | 1 - .../prometheus/procfs/fs_statfs_type.go | 1 - .../procfs/internal/util/sysreadfile.go | 2 - .../internal/util/sysreadfile_compat.go | 1 - .../prometheus/procfs/kernel_hung.go | 1 - .../prometheus/procfs/kernel_random.go | 1 - .../github.com/prometheus/procfs/net_tcp.go | 4 + .../prometheus/procfs/proc_interrupts.go | 2 +- .../github.com/prometheus/procfs/proc_maps.go | 2 - .../prometheus/procfs/proc_smaps.go | 1 - .../prometheus/procfs/proc_statm.go | 1 + .../prometheus/procfs/proc_status.go | 43 +++ .../procfs/sysfs/class_cooling_device.go | 10 +- .../prometheus/procfs/sysfs/class_dmi.go | 1 - .../prometheus/procfs/sysfs/class_drm.go | 1 - .../procfs/sysfs/class_drm_amdgpu.go | 29 +- .../prometheus/procfs/sysfs/class_drm_card.go | 1 - .../procfs/sysfs/class_fibrechannel.go | 1 - .../procfs/sysfs/class_infiniband.go | 1 - .../prometheus/procfs/sysfs/class_nvme.go | 92 ++++++- .../procfs/sysfs/class_power_supply.go | 1 - .../prometheus/procfs/sysfs/class_powercap.go | 1 - .../procfs/sysfs/class_sas_device.go | 1 - .../prometheus/procfs/sysfs/class_sas_host.go | 1 - .../prometheus/procfs/sysfs/class_sas_phy.go | 1 - .../prometheus/procfs/sysfs/class_sas_port.go | 1 - .../prometheus/procfs/sysfs/class_scsitape.go | 1 - .../prometheus/procfs/sysfs/class_thermal.go | 4 +- .../prometheus/procfs/sysfs/class_watchdog.go | 1 - .../prometheus/procfs/sysfs/clocksource.go | 1 - .../github.com/prometheus/procfs/sysfs/doc.go | 1 - .../github.com/prometheus/procfs/sysfs/fs.go | 1 - .../prometheus/procfs/sysfs/mdraid.go | 1 - .../prometheus/procfs/sysfs/net_class.go | 1 - .../prometheus/procfs/sysfs/net_class_aer.go | 1 - .../prometheus/procfs/sysfs/net_class_ecn.go | 1 - .../prometheus/procfs/sysfs/pci_device.go | 1 - .../prometheus/procfs/sysfs/system_cpu.go | 1 - .../prometheus/procfs/sysfs/vmstat_numa.go | 1 - .../prometheus/procfs/sysfs/vulnerability.go | 1 - vendor/github.com/prometheus/procfs/vm.go | 1 - .../github.com/prometheus/procfs/zoneinfo.go | 1 - vendor/modules.txt | 4 +- 56 files changed, 415 insertions(+), 89 deletions(-) diff --git a/go.mod b/go.mod index 848be78..8d8d6db 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/kubeservice-stack/node-metrics -go 1.24.0 +go 1.25.0 require ( github.com/alecthomas/kingpin/v2 v2.4.0 @@ -10,7 +10,7 @@ require ( github.com/prometheus/client_golang v1.23.2 github.com/prometheus/common v0.67.5 github.com/prometheus/exporter-toolkit v0.15.1 - github.com/prometheus/procfs v0.19.2 + github.com/prometheus/procfs v0.20.1 github.com/stretchr/testify v1.11.1 golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc golang.org/x/sys v0.41.0 diff --git a/go.sum b/go.sum index ab3c9e5..07f3ec2 100644 --- a/go.sum +++ b/go.sum @@ -62,8 +62,8 @@ github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTU github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= github.com/prometheus/exporter-toolkit v0.15.1 h1:XrGGr/qWl8Gd+pqJqTkNLww9eG8vR/CoRk0FubOKfLE= github.com/prometheus/exporter-toolkit v0.15.1/go.mod h1:P/NR9qFRGbCFgpklyhix9F6v6fFr/VQB/CVsrMDGKo4= -github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws= -github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw= +github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc= +github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/siebenmann/go-kstat v0.0.0-20210513183136-173c9b0a9973 h1:GfSdC6wKfTGcgCS7BtzF5694Amne1pGCSTY252WhlEY= diff --git a/vendor/github.com/prometheus/procfs/.golangci.yml b/vendor/github.com/prometheus/procfs/.golangci.yml index 23ecd45..eac920b 100644 --- a/vendor/github.com/prometheus/procfs/.golangci.yml +++ b/vendor/github.com/prometheus/procfs/.golangci.yml @@ -34,6 +34,14 @@ linters: capital: true misspell: locale: US + revive: + rules: + - name: var-naming + # TODO(SuperQ): See: https://github.com/prometheus/prometheus/issues/17766 + arguments: + - [] + - [] + - - skip-package-name-checks: true exclusions: presets: - comments diff --git a/vendor/github.com/prometheus/procfs/Makefile.common b/vendor/github.com/prometheus/procfs/Makefile.common index 6f61bec..cce3ef1 100644 --- a/vendor/github.com/prometheus/procfs/Makefile.common +++ b/vendor/github.com/prometheus/procfs/Makefile.common @@ -1,4 +1,4 @@ -# Copyright 2018 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 @@ -55,13 +55,13 @@ ifneq ($(shell command -v gotestsum 2> /dev/null),) endif endif -PROMU_VERSION ?= 0.17.0 +PROMU_VERSION ?= 0.18.0 PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v2.1.5 +GOLANGCI_LINT_VERSION ?= v2.10.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. @@ -82,11 +82,50 @@ endif PREFIX ?= $(shell pwd) BIN_DIR ?= $(shell pwd) DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD)) -DOCKERFILE_PATH ?= ./Dockerfile DOCKERBUILD_CONTEXT ?= ./ DOCKER_REPO ?= prom +# Check if deprecated DOCKERFILE_PATH is set +ifdef DOCKERFILE_PATH +$(error DOCKERFILE_PATH is deprecated. Use DOCKERFILE_VARIANTS ?= $(DOCKERFILE_PATH) in the Makefile) +endif + DOCKER_ARCHS ?= amd64 +DOCKERFILE_VARIANTS ?= Dockerfile $(wildcard Dockerfile.*) + +# Function to extract variant from Dockerfile label. +# Returns the variant name from io.prometheus.image.variant label, or "default" if not found. +define dockerfile_variant +$(strip $(or $(shell sed -n 's/.*io\.prometheus\.image\.variant="\([^"]*\)".*/\1/p' $(1)),default)) +endef + +# Check for duplicate variant names (including default for Dockerfiles without labels). +DOCKERFILE_VARIANT_NAMES := $(foreach df,$(DOCKERFILE_VARIANTS),$(call dockerfile_variant,$(df))) +DOCKERFILE_VARIANT_NAMES_SORTED := $(sort $(DOCKERFILE_VARIANT_NAMES)) +ifneq ($(words $(DOCKERFILE_VARIANT_NAMES)),$(words $(DOCKERFILE_VARIANT_NAMES_SORTED))) +$(error Duplicate variant names found. Each Dockerfile must have a unique io.prometheus.image.variant label, and only one can be without a label (default)) +endif + +# Build variant:dockerfile pairs for shell iteration. +DOCKERFILE_VARIANTS_WITH_NAMES := $(foreach df,$(DOCKERFILE_VARIANTS),$(call dockerfile_variant,$(df)):$(df)) + +# Shell helper to check whether a dockerfile/arch pair is excluded. +define dockerfile_arch_is_excluded +case " $(DOCKERFILE_ARCH_EXCLUSIONS) " in \ + *" $$dockerfile:$(1) "*) true ;; \ + *) false ;; \ +esac +endef + +# Shell helper to check whether a registry/arch pair is excluded. +# Extracts registry from DOCKER_REPO (e.g., quay.io/prometheus -> quay.io) +define registry_arch_is_excluded +registry=$$(echo "$(DOCKER_REPO)" | cut -d'/' -f1); \ +case " $(DOCKER_REGISTRY_ARCH_EXCLUSIONS) " in \ + *" $$registry:$(1) "*) true ;; \ + *) false ;; \ +esac +endef BUILD_DOCKER_ARCHS = $(addprefix common-docker-,$(DOCKER_ARCHS)) PUBLISH_DOCKER_ARCHS = $(addprefix common-docker-publish-,$(DOCKER_ARCHS)) @@ -112,7 +151,7 @@ common-all: precheck style check_license lint yamllint unused build test .PHONY: common-style common-style: @echo ">> checking code style" - @fmtRes=$$($(GOFMT) -d $$(find . -path ./vendor -prune -o -name '*.go' -print)); \ + @fmtRes=$$($(GOFMT) -d $$(git ls-files '*.go' ':!:vendor/*' || find . -path ./vendor -prune -o -name '*.go' -print)); \ if [ -n "$${fmtRes}" ]; then \ echo "gofmt checking failed!"; echo "$${fmtRes}"; echo; \ echo "Please ensure you are using $$($(GO) version) for formatting code."; \ @@ -122,13 +161,19 @@ common-style: .PHONY: common-check_license common-check_license: @echo ">> checking license header" - @licRes=$$(for file in $$(find . -type f -iname '*.go' ! -path './vendor/*') ; do \ + @licRes=$$(for file in $$(git ls-files '*.go' ':!:vendor/*' || find . -path ./vendor -prune -o -type f -iname '*.go' -print) ; do \ awk 'NR<=3' $$file | grep -Eq "(Copyright|generated|GENERATED)" || echo $$file; \ done); \ if [ -n "$${licRes}" ]; then \ echo "license header checking failed:"; echo "$${licRes}"; \ exit 1; \ fi + @echo ">> checking for copyright years 2026 or later" + @futureYearRes=$$(git grep -E 'Copyright (202[6-9]|20[3-9][0-9])' -- '*.go' ':!:vendor/*' || true); \ + if [ -n "$${futureYearRes}" ]; then \ + echo "Files with copyright year 2026 or later found (should use 'Copyright The Prometheus Authors'):"; echo "$${futureYearRes}"; \ + exit 1; \ + fi .PHONY: common-deps common-deps: @@ -220,28 +265,194 @@ common-docker-repo-name: .PHONY: common-docker $(BUILD_DOCKER_ARCHS) common-docker: $(BUILD_DOCKER_ARCHS) $(BUILD_DOCKER_ARCHS): common-docker-%: - docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" \ - -f $(DOCKERFILE_PATH) \ - --build-arg ARCH="$*" \ - --build-arg OS="linux" \ - $(DOCKERBUILD_CONTEXT) + @for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \ + dockerfile=$${variant#*:}; \ + variant_name=$${variant%%:*}; \ + if $(call dockerfile_arch_is_excluded,$*); then \ + echo "Skipping $$variant_name variant for linux-$* (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \ + continue; \ + fi; \ + distroless_arch="$*"; \ + if [ "$*" = "armv7" ]; then \ + distroless_arch="arm"; \ + fi; \ + 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 \ + --build-arg ARCH="$*" \ + --build-arg OS="linux" \ + --build-arg DISTROLESS_ARCH="$$distroless_arch" \ + $(DOCKERBUILD_CONTEXT); \ + if [ "$$variant_name" != "default" ]; then \ + echo "Tagging default variant with $$variant_name suffix"; \ + docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" \ + "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name"; \ + fi; \ + else \ + 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 \ + --build-arg ARCH="$*" \ + --build-arg OS="linux" \ + --build-arg DISTROLESS_ARCH="$$distroless_arch" \ + $(DOCKERBUILD_CONTEXT); \ + fi; \ + done .PHONY: common-docker-publish $(PUBLISH_DOCKER_ARCHS) common-docker-publish: $(PUBLISH_DOCKER_ARCHS) $(PUBLISH_DOCKER_ARCHS): common-docker-publish-%: - docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" + @for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \ + dockerfile=$${variant#*:}; \ + variant_name=$${variant%%:*}; \ + if $(call dockerfile_arch_is_excluded,$*); then \ + echo "Skipping push for $$variant_name variant on linux-$* (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \ + continue; \ + fi; \ + if $(call registry_arch_is_excluded,$*); then \ + echo "Skipping push for $$variant_name variant on linux-$* to $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \ + continue; \ + fi; \ + if [ "$$dockerfile" != "Dockerfile" ] || [ "$$variant_name" != "default" ]; then \ + echo "Pushing $$variant_name variant for linux-$*"; \ + docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name"; \ + fi; \ + if [ "$$dockerfile" = "Dockerfile" ]; then \ + echo "Pushing default variant ($$variant_name) for linux-$*"; \ + docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)"; \ + fi; \ + if [ "$(DOCKER_IMAGE_TAG)" = "latest" ]; then \ + if [ "$$dockerfile" != "Dockerfile" ] || [ "$$variant_name" != "default" ]; then \ + echo "Pushing $$variant_name variant version tags for linux-$*"; \ + docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)-$$variant_name"; \ + fi; \ + if [ "$$dockerfile" = "Dockerfile" ]; then \ + echo "Pushing default variant version tag for linux-$*"; \ + docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)"; \ + fi; \ + fi; \ + done DOCKER_MAJOR_VERSION_TAG = $(firstword $(subst ., ,$(shell cat VERSION))) .PHONY: common-docker-tag-latest $(TAG_DOCKER_ARCHS) common-docker-tag-latest: $(TAG_DOCKER_ARCHS) $(TAG_DOCKER_ARCHS): common-docker-tag-latest-%: - docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest" - docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)" + @for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \ + dockerfile=$${variant#*:}; \ + variant_name=$${variant%%:*}; \ + if $(call dockerfile_arch_is_excluded,$*); then \ + echo "Skipping tag for $$variant_name variant on linux-$* (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \ + continue; \ + fi; \ + if $(call registry_arch_is_excluded,$*); then \ + echo "Skipping tag for $$variant_name variant on linux-$* for $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \ + continue; \ + fi; \ + if [ "$$dockerfile" != "Dockerfile" ] || [ "$$variant_name" != "default" ]; then \ + echo "Tagging $$variant_name variant for linux-$* as latest"; \ + docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest-$$variant_name"; \ + docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)-$$variant_name"; \ + fi; \ + if [ "$$dockerfile" = "Dockerfile" ]; then \ + echo "Tagging default variant ($$variant_name) for linux-$* as latest"; \ + docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest"; \ + docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)"; \ + fi; \ + done .PHONY: common-docker-manifest common-docker-manifest: - DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)" $(foreach ARCH,$(DOCKER_ARCHS),$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$(ARCH):$(SANITIZED_DOCKER_IMAGE_TAG)) - DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)" + @for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \ + dockerfile=$${variant#*:}; \ + variant_name=$${variant%%:*}; \ + if [ "$$dockerfile" != "Dockerfile" ] || [ "$$variant_name" != "default" ]; then \ + echo "Creating manifest for $$variant_name variant"; \ + refs=""; \ + for arch in $(DOCKER_ARCHS); do \ + if $(call dockerfile_arch_is_excluded,$$arch); then \ + echo " Skipping $$arch for $$variant_name (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \ + continue; \ + fi; \ + if $(call registry_arch_is_excluded,$$arch); then \ + echo " Skipping $$arch for $$variant_name on $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \ + continue; \ + fi; \ + refs="$$refs $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$$arch:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name"; \ + done; \ + if [ -z "$$refs" ]; then \ + 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"; \ + fi; \ + if [ "$$dockerfile" = "Dockerfile" ]; then \ + echo "Creating default variant ($$variant_name) manifest"; \ + refs=""; \ + for arch in $(DOCKER_ARCHS); do \ + if $(call dockerfile_arch_is_excluded,$$arch); then \ + echo " Skipping $$arch for default variant (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \ + continue; \ + fi; \ + if $(call registry_arch_is_excluded,$$arch); then \ + echo " Skipping $$arch for default variant on $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \ + continue; \ + fi; \ + refs="$$refs $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$$arch:$(SANITIZED_DOCKER_IMAGE_TAG)"; \ + done; \ + if [ -z "$$refs" ]; then \ + 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)"; \ + fi; \ + if [ "$(DOCKER_IMAGE_TAG)" = "latest" ]; then \ + if [ "$$dockerfile" != "Dockerfile" ] || [ "$$variant_name" != "default" ]; then \ + echo "Creating manifest for $$variant_name variant version tag"; \ + refs=""; \ + for arch in $(DOCKER_ARCHS); do \ + if $(call dockerfile_arch_is_excluded,$$arch); then \ + echo " Skipping $$arch for $$variant_name version tag (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \ + continue; \ + fi; \ + if $(call registry_arch_is_excluded,$$arch); then \ + echo " Skipping $$arch for $$variant_name version tag on $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \ + continue; \ + fi; \ + refs="$$refs $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$$arch:v$(DOCKER_MAJOR_VERSION_TAG)-$$variant_name"; \ + done; \ + if [ -z "$$refs" ]; then \ + 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"; \ + fi; \ + if [ "$$dockerfile" = "Dockerfile" ]; then \ + echo "Creating default variant version tag manifest"; \ + refs=""; \ + for arch in $(DOCKER_ARCHS); do \ + if $(call dockerfile_arch_is_excluded,$$arch); then \ + echo " Skipping $$arch for default variant version tag (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \ + continue; \ + fi; \ + if $(call registry_arch_is_excluded,$$arch); then \ + echo " Skipping $$arch for default variant version tag on $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \ + continue; \ + fi; \ + refs="$$refs $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$$arch:v$(DOCKER_MAJOR_VERSION_TAG)"; \ + done; \ + if [ -z "$$refs" ]; then \ + 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)"; \ + fi; \ + fi; \ + done .PHONY: promu promu: $(PROMU) @@ -266,6 +477,10 @@ $(GOLANGCI_LINT): | sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION) endif +.PHONY: common-print-golangci-lint-version +common-print-golangci-lint-version: + @echo $(GOLANGCI_LINT_VERSION) + .PHONY: precheck precheck:: diff --git a/vendor/github.com/prometheus/procfs/cpuinfo.go b/vendor/github.com/prometheus/procfs/cpuinfo.go index 5fe6cec..4b23d8d 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package procfs @@ -502,7 +501,7 @@ func parseCPUInfoRISCV(info []byte) ([]CPUInfo, error) { return cpuinfo, nil } -func parseCPUInfoDummy(_ []byte) ([]CPUInfo, error) { // nolint:unused,deadcode +func parseCPUInfoDummy(_ []byte) ([]CPUInfo, error) { //nolint:unused return nil, errors.New("not implemented") } diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_armx.go b/vendor/github.com/prometheus/procfs/cpuinfo_armx.go index 8f15555..b09035f 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo_armx.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_armx.go @@ -12,8 +12,6 @@ // limitations under the License. //go:build linux && (arm || arm64) -// +build linux -// +build arm arm64 package procfs diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go b/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go index e81a5db..7bb2021 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package procfs diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go b/vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go index 4be2b1c..fd75d0f 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go @@ -12,8 +12,6 @@ // limitations under the License. //go:build linux && (mips || mipsle || mips64 || mips64le) -// +build linux -// +build mips mipsle mips64 mips64le package procfs diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_others.go b/vendor/github.com/prometheus/procfs/cpuinfo_others.go index e713bae..3d36ba0 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo_others.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_others.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux && !386 && !amd64 && !arm && !arm64 && !loong64 && !mips && !mips64 && !mips64le && !mipsle && !ppc64 && !ppc64le && !riscv64 && !s390x -// +build linux,!386,!amd64,!arm,!arm64,!loong64,!mips,!mips64,!mips64le,!mipsle,!ppc64,!ppc64le,!riscv64,!s390x package procfs diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go b/vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go index 0825aa1..b342505 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go @@ -12,8 +12,6 @@ // limitations under the License. //go:build linux && (ppc64 || ppc64le) -// +build linux -// +build ppc64 ppc64le package procfs diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go b/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go index 496770b..7259823 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go @@ -12,8 +12,6 @@ // limitations under the License. //go:build linux && (riscv || riscv64) -// +build linux -// +build riscv riscv64 package procfs diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_s390x.go b/vendor/github.com/prometheus/procfs/cpuinfo_s390x.go index b3228ce..50a8239 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo_s390x.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_s390x.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package procfs diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_x86.go b/vendor/github.com/prometheus/procfs/cpuinfo_x86.go index 575eb02..00edb30 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo_x86.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_x86.go @@ -12,8 +12,6 @@ // limitations under the License. //go:build linux && (386 || amd64) -// +build linux -// +build 386 amd64 package procfs diff --git a/vendor/github.com/prometheus/procfs/fs_statfs_notype.go b/vendor/github.com/prometheus/procfs/fs_statfs_notype.go index 3c53023..0bef25b 100644 --- a/vendor/github.com/prometheus/procfs/fs_statfs_notype.go +++ b/vendor/github.com/prometheus/procfs/fs_statfs_notype.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build !freebsd && !linux -// +build !freebsd,!linux package procfs diff --git a/vendor/github.com/prometheus/procfs/fs_statfs_type.go b/vendor/github.com/prometheus/procfs/fs_statfs_type.go index 80fce48..d183330 100644 --- a/vendor/github.com/prometheus/procfs/fs_statfs_type.go +++ b/vendor/github.com/prometheus/procfs/fs_statfs_type.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build freebsd || linux -// +build freebsd linux package procfs diff --git a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go b/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go index 8318d8d..f6a4a4d 100644 --- a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go +++ b/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go @@ -12,8 +12,6 @@ // limitations under the License. //go:build (linux || darwin) && !appengine -// +build linux darwin -// +build !appengine package util diff --git a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go b/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go index 15bb096..c80e082 100644 --- a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go +++ b/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build (linux && appengine) || (!linux && !darwin) -// +build linux,appengine !linux,!darwin package util diff --git a/vendor/github.com/prometheus/procfs/kernel_hung.go b/vendor/github.com/prometheus/procfs/kernel_hung.go index 539c111..0c7a69f 100644 --- a/vendor/github.com/prometheus/procfs/kernel_hung.go +++ b/vendor/github.com/prometheus/procfs/kernel_hung.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build !windows -// +build !windows package procfs diff --git a/vendor/github.com/prometheus/procfs/kernel_random.go b/vendor/github.com/prometheus/procfs/kernel_random.go index b66565a..e7c5b8c 100644 --- a/vendor/github.com/prometheus/procfs/kernel_random.go +++ b/vendor/github.com/prometheus/procfs/kernel_random.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build !windows -// +build !windows package procfs diff --git a/vendor/github.com/prometheus/procfs/net_tcp.go b/vendor/github.com/prometheus/procfs/net_tcp.go index 610ea78..2c7f9bc 100644 --- a/vendor/github.com/prometheus/procfs/net_tcp.go +++ b/vendor/github.com/prometheus/procfs/net_tcp.go @@ -25,6 +25,7 @@ type ( // NetTCP returns the IPv4 kernel/networking statistics for TCP datagrams // read from /proc/net/tcp. +// // Deprecated: Use github.com/mdlayher/netlink#Conn (with syscall.AF_INET) instead. func (fs FS) NetTCP() (NetTCP, error) { return newNetTCP(fs.proc.Path("net/tcp")) @@ -32,6 +33,7 @@ func (fs FS) NetTCP() (NetTCP, error) { // NetTCP6 returns the IPv6 kernel/networking statistics for TCP datagrams // read from /proc/net/tcp6. +// // Deprecated: Use github.com/mdlayher/netlink#Conn (with syscall.AF_INET6) instead. func (fs FS) NetTCP6() (NetTCP, error) { return newNetTCP(fs.proc.Path("net/tcp6")) @@ -39,6 +41,7 @@ func (fs FS) NetTCP6() (NetTCP, error) { // NetTCPSummary returns already computed statistics like the total queue lengths // for TCP datagrams read from /proc/net/tcp. +// // Deprecated: Use github.com/mdlayher/netlink#Conn (with syscall.AF_INET) instead. func (fs FS) NetTCPSummary() (*NetTCPSummary, error) { return newNetTCPSummary(fs.proc.Path("net/tcp")) @@ -46,6 +49,7 @@ func (fs FS) NetTCPSummary() (*NetTCPSummary, error) { // NetTCP6Summary returns already computed statistics like the total queue lengths // for TCP datagrams read from /proc/net/tcp6. +// // Deprecated: Use github.com/mdlayher/netlink#Conn (with syscall.AF_INET6) instead. func (fs FS) NetTCP6Summary() (*NetTCPSummary, error) { return newNetTCPSummary(fs.proc.Path("net/tcp6")) diff --git a/vendor/github.com/prometheus/procfs/proc_interrupts.go b/vendor/github.com/prometheus/procfs/proc_interrupts.go index b942c50..643b500 100644 --- a/vendor/github.com/prometheus/procfs/proc_interrupts.go +++ b/vendor/github.com/prometheus/procfs/proc_interrupts.go @@ -42,7 +42,7 @@ type Interrupts map[string]Interrupt // Interrupts creates a new instance from a given Proc instance. func (p Proc) Interrupts() (Interrupts, error) { - data, err := util.ReadFileNoStat(p.path("interrupts")) + data, err := util.ReadFileNoStat(p.fs.proc.Path("interrupts")) if err != nil { return nil, err } diff --git a/vendor/github.com/prometheus/procfs/proc_maps.go b/vendor/github.com/prometheus/procfs/proc_maps.go index cc519f9..08b89a6 100644 --- a/vendor/github.com/prometheus/procfs/proc_maps.go +++ b/vendor/github.com/prometheus/procfs/proc_maps.go @@ -12,8 +12,6 @@ // limitations under the License. //go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) && !js -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris -// +build !js package procfs diff --git a/vendor/github.com/prometheus/procfs/proc_smaps.go b/vendor/github.com/prometheus/procfs/proc_smaps.go index 3e48afd..f637309 100644 --- a/vendor/github.com/prometheus/procfs/proc_smaps.go +++ b/vendor/github.com/prometheus/procfs/proc_smaps.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build !windows -// +build !windows package procfs diff --git a/vendor/github.com/prometheus/procfs/proc_statm.go b/vendor/github.com/prometheus/procfs/proc_statm.go index b0a9360..6bcc97e 100644 --- a/vendor/github.com/prometheus/procfs/proc_statm.go +++ b/vendor/github.com/prometheus/procfs/proc_statm.go @@ -45,6 +45,7 @@ type ProcStatm struct { } // NewStatm returns the current status information of the process. +// // Deprecated: Use p.Statm() instead. func (p Proc) NewStatm() (ProcStatm, error) { return p.Statm() diff --git a/vendor/github.com/prometheus/procfs/proc_status.go b/vendor/github.com/prometheus/procfs/proc_status.go index 1ed2bce..12d6558 100644 --- a/vendor/github.com/prometheus/procfs/proc_status.go +++ b/vendor/github.com/prometheus/procfs/proc_status.go @@ -83,6 +83,19 @@ type ProcStatus struct { // CpusAllowedList: List of cpu cores processes are allowed to run on. CpusAllowedList []uint64 + + // CapInh is the bitmap of inheritable capabilities + // + // See: https://www.kernel.org/doc/man-pages/online/pages/man7/capabilities.7.html + CapInh uint64 + // CapPrm is the bitmap of permitted capabilities + CapPrm uint64 + // CapEff is the bitmap of effective capabilities + CapEff uint64 + // CapBnd is the bitmap of bounding capabilities + CapBnd uint64 + // CapAmb is the bitmap of ambient capabilities + CapAmb uint64 } // NewStatus returns the current status information of the process. @@ -190,6 +203,36 @@ func (s *ProcStatus) fillStatus(k string, vString string, vUint uint64, vUintByt s.NonVoluntaryCtxtSwitches = vUint case "Cpus_allowed_list": s.CpusAllowedList = calcCpusAllowedList(vString) + case "CapInh": + var err error + s.CapInh, err = strconv.ParseUint(vString, 16, 64) + if err != nil { + return err + } + case "CapPrm": + var err error + s.CapPrm, err = strconv.ParseUint(vString, 16, 64) + if err != nil { + return err + } + case "CapEff": + var err error + s.CapEff, err = strconv.ParseUint(vString, 16, 64) + if err != nil { + return err + } + case "CapBnd": + var err error + s.CapBnd, err = strconv.ParseUint(vString, 16, 64) + if err != nil { + return err + } + case "CapAmb": + var err error + s.CapAmb, err = strconv.ParseUint(vString, 16, 64) + if err != nil { + return err + } } return nil diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_cooling_device.go b/vendor/github.com/prometheus/procfs/sysfs/class_cooling_device.go index 4627553..037c333 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_cooling_device.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_cooling_device.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs @@ -41,17 +40,20 @@ func (fs FS) ClassCoolingDeviceStats() ([]ClassCoolingDeviceStats, error) { } var coolingDeviceStats = ClassCoolingDeviceStats{} - stats := make([]ClassCoolingDeviceStats, len(cds)) - for i, cd := range cds { + stats := make([]ClassCoolingDeviceStats, 0, len(cds)) + for _, cd := range cds { cdName := strings.TrimPrefix(filepath.Base(cd), "cooling_device") coolingDeviceStats, err = parseCoolingDeviceStats(cd) if err != nil { + if canIgnoreError(err) { + continue + } return []ClassCoolingDeviceStats{}, err } coolingDeviceStats.Name = cdName - stats[i] = coolingDeviceStats + stats = append(stats, coolingDeviceStats) } return stats, nil } diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_dmi.go b/vendor/github.com/prometheus/procfs/sysfs/class_dmi.go index 889478b..3cdd95f 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_dmi.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_dmi.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_drm.go b/vendor/github.com/prometheus/procfs/sysfs/class_drm.go index 75942f1..c0ca599 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_drm.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_drm.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_drm_amdgpu.go b/vendor/github.com/prometheus/procfs/sysfs/class_drm_amdgpu.go index 7cd7e65..7ba4f6f 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_drm_amdgpu.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_drm_amdgpu.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs @@ -21,6 +20,7 @@ import ( "fmt" "path/filepath" "regexp" + "strings" "syscall" "github.com/prometheus/procfs/internal/util" @@ -47,6 +47,21 @@ type ClassDRMCardAMDGPUStats struct { MemoryVRAMVendor string // The VRAM vendor name. PowerDPMForcePerformanceLevel string // The current power performance level. UniqueID string // The unique ID of the GPU that will persist from machine to machine. + DevName string // The device name. + DevType string // The device type. +} + +// readDev reads the device name and type from the "device" symlink in the given directory. +func readDevInfo(dir string) (string, string, error) { + devicePath, devErr := filepath.EvalSymlinks(filepath.Join(dir, "device")) + if devErr == nil { + devPathPrefix, devName := filepath.Split(devicePath) + _, devType := filepath.Split(strings.TrimRight(devPathPrefix, "/")) + + return devName, devType, nil + } + + return "", "", devErr } // ClassDRMCardAMDGPUStats returns DRM card metrics for all amdgpu cards. @@ -65,8 +80,10 @@ func (fs FS) ClassDRMCardAMDGPUStats() ([]ClassDRMCardAMDGPUStats, error) { } return nil, err } - cardStats.Name = filepath.Base(card) - stats = append(stats, cardStats) + if cardStats != (ClassDRMCardAMDGPUStats{}) { + cardStats.Name = filepath.Base(card) + stats = append(stats, cardStats) + } } return stats, nil } @@ -87,6 +104,12 @@ func parseClassDRMAMDGPUCard(card string) (ClassDRMCardAMDGPUStats, error) { stats := ClassDRMCardAMDGPUStats{Name: card} // Read only specific files for faster data gathering. + if n, t, err := readDevInfo(card); err == nil { + stats.DevName = n + stats.DevType = t + } else { + return ClassDRMCardAMDGPUStats{}, err + } if v, err := readDRMCardField(card, "gpu_busy_percent"); err == nil { stats.GPUBusyPercent = *util.NewValueParser(v).PUInt64() } diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_drm_card.go b/vendor/github.com/prometheus/procfs/sysfs/class_drm_card.go index d3ebc87..057634e 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_drm_card.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_drm_card.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_fibrechannel.go b/vendor/github.com/prometheus/procfs/sysfs/class_fibrechannel.go index 3323f94..7b46e02 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_fibrechannel.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_fibrechannel.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_infiniband.go b/vendor/github.com/prometheus/procfs/sysfs/class_infiniband.go index 037dec9..4a893ae 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_infiniband.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_infiniband.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_nvme.go b/vendor/github.com/prometheus/procfs/sysfs/class_nvme.go index e88bcd1..7c4abb0 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_nvme.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_nvme.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs @@ -20,20 +19,37 @@ import ( "fmt" "os" "path/filepath" + "regexp" + "strconv" "github.com/prometheus/procfs/internal/util" ) const nvmeClassPath = "class/nvme" +var nvmeNamespacePattern = regexp.MustCompile(`nvme\d+c\d+n(\d+)`) + +// NVMeNamespace contains info from files in /sys/class/nvme//. +type NVMeNamespace struct { + ID string // namespace ID extracted from directory name + UsedBlocks uint64 // from nuse file (blocks used) + SizeBlocks uint64 // from size file (total blocks) + LogicalBlockSize uint64 // from queue/logical_block_size file + ANAState string // from ana_state file + UsedBytes uint64 // calculated: UsedBlocks * LogicalBlockSize + SizeBytes uint64 // calculated: SizeBlocks * LogicalBlockSize + CapacityBytes uint64 // calculated: SizeBlocks * LogicalBlockSize +} + // NVMeDevice contains info from files in /sys/class/nvme for a single NVMe device. type NVMeDevice struct { Name string - Serial string // /sys/class/nvme//serial - Model string // /sys/class/nvme//model - State string // /sys/class/nvme//state - FirmwareRevision string // /sys/class/nvme//firmware_rev - ControllerID string // /sys/class/nvme//cntlid + Serial string // /sys/class/nvme//serial + Model string // /sys/class/nvme//model + State string // /sys/class/nvme//state + FirmwareRevision string // /sys/class/nvme//firmware_rev + ControllerID string // /sys/class/nvme//cntlid + Namespaces []NVMeNamespace // NVMe namespaces for this device } // NVMeClass is a collection of every NVMe device in /sys/class/nvme. @@ -68,6 +84,7 @@ func (fs FS) parseNVMeDevice(name string) (*NVMeDevice, error) { path := fs.sys.Path(nvmeClassPath, name) device := NVMeDevice{Name: name} + // Parse device-level attributes for _, f := range [...]string{"firmware_rev", "model", "serial", "state", "cntlid"} { name := filepath.Join(path, f) value, err := util.SysReadFile(name) @@ -89,5 +106,68 @@ func (fs FS) parseNVMeDevice(name string) (*NVMeDevice, error) { } } + // Parse namespaces - read directory and filter using regex + dirs, err := os.ReadDir(path) + if err != nil { + return nil, fmt.Errorf("failed to list NVMe namespaces at %q: %w", path, err) + } + + var namespaces []NVMeNamespace + + for _, d := range dirs { + // Use regex to identify namespace directories and extract namespace ID + match := nvmeNamespacePattern.FindStringSubmatch(d.Name()) + if len(match) < 2 { + // Skip if not a namespace directory + continue + } + nsid := match[1] + namespacePath := filepath.Join(path, d.Name()) + + namespace := NVMeNamespace{ + ID: nsid, + ANAState: "unknown", // Default value + } + + // Parse namespace attributes using the same approach as device attributes + for _, f := range [...]string{"nuse", "size", "queue/logical_block_size", "ana_state"} { + filePath := filepath.Join(namespacePath, f) + value, err := util.SysReadFile(filePath) + if err != nil { + if f == "ana_state" { + // ana_state may not exist, skip silently + continue + } + return nil, fmt.Errorf("failed to read file %q: %w", filePath, err) + } + + switch f { + case "nuse": + if val, parseErr := strconv.ParseUint(value, 10, 64); parseErr == nil { + namespace.UsedBlocks = val + } + case "size": + if val, parseErr := strconv.ParseUint(value, 10, 64); parseErr == nil { + namespace.SizeBlocks = val + } + case "queue/logical_block_size": + if val, parseErr := strconv.ParseUint(value, 10, 64); parseErr == nil { + namespace.LogicalBlockSize = val + } + case "ana_state": + namespace.ANAState = value + } + } + + // Calculate derived values + namespace.UsedBytes = namespace.UsedBlocks * namespace.LogicalBlockSize + namespace.SizeBytes = namespace.SizeBlocks * namespace.LogicalBlockSize + namespace.CapacityBytes = namespace.SizeBlocks * namespace.LogicalBlockSize + + namespaces = append(namespaces, namespace) + } + + device.Namespaces = namespaces + return &device, nil } diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_power_supply.go b/vendor/github.com/prometheus/procfs/sysfs/class_power_supply.go index b7ff896..8a5e35f 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_power_supply.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_power_supply.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_powercap.go b/vendor/github.com/prometheus/procfs/sysfs/class_powercap.go index c98d39d..75b3c46 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_powercap.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_powercap.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_sas_device.go b/vendor/github.com/prometheus/procfs/sysfs/class_sas_device.go index 21a4022..bc4b242 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_sas_device.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_sas_device.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_sas_host.go b/vendor/github.com/prometheus/procfs/sysfs/class_sas_host.go index 925c070..2298429 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_sas_host.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_sas_host.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_sas_phy.go b/vendor/github.com/prometheus/procfs/sysfs/class_sas_phy.go index f75f1cf..7be976c 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_sas_phy.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_sas_phy.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_sas_port.go b/vendor/github.com/prometheus/procfs/sysfs/class_sas_port.go index a5041b6..d67ef43 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_sas_port.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_sas_port.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_scsitape.go b/vendor/github.com/prometheus/procfs/sysfs/class_scsitape.go index d3e7ca3..5cde0ea 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_scsitape.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_scsitape.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_thermal.go b/vendor/github.com/prometheus/procfs/sysfs/class_thermal.go index 71b2a98..db83286 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_thermal.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_thermal.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs @@ -51,7 +50,8 @@ func (fs FS) ClassThermalZoneStats() ([]ClassThermalZoneStats, error) { for _, zone := range zones { zoneStats, err := parseClassThermalZone(zone) if err != nil { - if errors.Is(err, syscall.ENODATA) || errors.As(err, new(*fsp.PathError)) || errors.Is(err, syscall.EAGAIN) { + if errors.Is(err, syscall.ENODATA) || errors.As(err, new(*fsp.PathError)) || errors.Is(err, syscall.EAGAIN) || + errors.Is(err, syscall.EINVAL) { continue } return nil, err diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_watchdog.go b/vendor/github.com/prometheus/procfs/sysfs/class_watchdog.go index e462c77..0062f0d 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/class_watchdog.go +++ b/vendor/github.com/prometheus/procfs/sysfs/class_watchdog.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/clocksource.go b/vendor/github.com/prometheus/procfs/sysfs/clocksource.go index e853ca5..ccb92d1 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/clocksource.go +++ b/vendor/github.com/prometheus/procfs/sysfs/clocksource.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/doc.go b/vendor/github.com/prometheus/procfs/sysfs/doc.go index a087b5b..1df670e 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/doc.go +++ b/vendor/github.com/prometheus/procfs/sysfs/doc.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux // Package sysfs provides functions to retrieve system and kernel metrics // from the pseudo-filesystem sys. diff --git a/vendor/github.com/prometheus/procfs/sysfs/fs.go b/vendor/github.com/prometheus/procfs/sysfs/fs.go index a09b6c6..6a1d81b 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/fs.go +++ b/vendor/github.com/prometheus/procfs/sysfs/fs.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/mdraid.go b/vendor/github.com/prometheus/procfs/sysfs/mdraid.go index a88aa9a..139c7eb 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/mdraid.go +++ b/vendor/github.com/prometheus/procfs/sysfs/mdraid.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/net_class.go b/vendor/github.com/prometheus/procfs/sysfs/net_class.go index 5b6328d..2c87fd3 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/net_class.go +++ b/vendor/github.com/prometheus/procfs/sysfs/net_class.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/net_class_aer.go b/vendor/github.com/prometheus/procfs/sysfs/net_class_aer.go index 727d0df..6bed0ca 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/net_class_aer.go +++ b/vendor/github.com/prometheus/procfs/sysfs/net_class_aer.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/net_class_ecn.go b/vendor/github.com/prometheus/procfs/sysfs/net_class_ecn.go index 4a68c5f..69e6cfd 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/net_class_ecn.go +++ b/vendor/github.com/prometheus/procfs/sysfs/net_class_ecn.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/pci_device.go b/vendor/github.com/prometheus/procfs/sysfs/pci_device.go index a3f6e85..42e7344 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/pci_device.go +++ b/vendor/github.com/prometheus/procfs/sysfs/pci_device.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/system_cpu.go b/vendor/github.com/prometheus/procfs/sysfs/system_cpu.go index ff4f959..1db7e0c 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/system_cpu.go +++ b/vendor/github.com/prometheus/procfs/sysfs/system_cpu.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/vmstat_numa.go b/vendor/github.com/prometheus/procfs/sysfs/vmstat_numa.go index abd2a69..bf2153a 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/vmstat_numa.go +++ b/vendor/github.com/prometheus/procfs/sysfs/vmstat_numa.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/sysfs/vulnerability.go b/vendor/github.com/prometheus/procfs/sysfs/vulnerability.go index 5ef25c0..f53aaa3 100644 --- a/vendor/github.com/prometheus/procfs/sysfs/vulnerability.go +++ b/vendor/github.com/prometheus/procfs/sysfs/vulnerability.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build linux -// +build linux package sysfs diff --git a/vendor/github.com/prometheus/procfs/vm.go b/vendor/github.com/prometheus/procfs/vm.go index 2a8d763..52180c0 100644 --- a/vendor/github.com/prometheus/procfs/vm.go +++ b/vendor/github.com/prometheus/procfs/vm.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build !windows -// +build !windows package procfs diff --git a/vendor/github.com/prometheus/procfs/zoneinfo.go b/vendor/github.com/prometheus/procfs/zoneinfo.go index 806e171..63d1898 100644 --- a/vendor/github.com/prometheus/procfs/zoneinfo.go +++ b/vendor/github.com/prometheus/procfs/zoneinfo.go @@ -12,7 +12,6 @@ // limitations under the License. //go:build !windows -// +build !windows package procfs diff --git a/vendor/modules.txt b/vendor/modules.txt index e3464d8..8f58234 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -92,8 +92,8 @@ github.com/prometheus/common/version ## explicit; go 1.24.0 github.com/prometheus/exporter-toolkit/web github.com/prometheus/exporter-toolkit/web/kingpinflag -# github.com/prometheus/procfs v0.19.2 -## explicit; go 1.24.0 +# github.com/prometheus/procfs v0.20.1 +## explicit; go 1.25.0 github.com/prometheus/procfs github.com/prometheus/procfs/internal/fs github.com/prometheus/procfs/internal/util