Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MON-3847: Bump openshift/node_exporter to v1.8.0 #145

Merged
merged 70 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
81fc05c
Make filesystem space prediction window configurable (#2844)
fitz123 Nov 13, 2023
78af952
NFSd: handle new wdeleg_getattr attribute in /proc/net/rpc/nfsd (#2810)
klausman Nov 14, 2023
97029a2
Update common Prometheus files (#2851)
prombot Nov 19, 2023
4abf2c9
Update containerization warnings (#2855)
SuperQ Nov 23, 2023
12f1744
Fix debug log in cpu collector (#2857)
simonpasquier Nov 24, 2023
e1724b3
build(deps): bump github.com/alecthomas/kingpin/v2 from 2.3.2 to 2.4.…
dependabot[bot] Dec 1, 2023
e508aff
build(deps): bump howett.net/plist from 1.0.0 to 1.0.1 (#2862)
dependabot[bot] Dec 1, 2023
332232c
Add new collector and metrics for XFRM (#2544) (#2866)
gavinkflam Dec 3, 2023
12d5add
build(deps): bump github.com/jsimonetti/rtnetlink from 1.3.5 to 1.4.0…
dependabot[bot] Dec 4, 2023
9666d00
build(deps): bump golang.org/x/sys from 0.13.0 to 0.15.0 (#2863)
dependabot[bot] Dec 4, 2023
0550ab3
Add TCPOFOQueue to default netstat metrics (#2867)
freedge Dec 8, 2023
c2dcc79
Update common Prometheus files (#2870)
prombot Dec 10, 2023
16f7122
Add mitigation information to the linux vulnerabilities collector (#2…
jopelima Dec 14, 2023
120c481
Update common Prometheus files (#2872)
prombot Dec 19, 2023
95d419d
build(deps): bump golang.org/x/crypto from 0.14.0 to 0.17.0 (#2877)
dependabot[bot] Dec 19, 2023
73d9530
Update common Prometheus files (#2879)
prombot Dec 19, 2023
683d2cd
build(deps): bump github.com/prometheus/exporter-toolkit (#2885)
dependabot[bot] Jan 1, 2024
bd99fb0
build(deps): bump github.com/beevik/ntp from 1.3.0 to 1.3.1 (#2886)
dependabot[bot] Jan 1, 2024
d8e2be1
build(deps): bump github.com/prometheus/client_golang (#2887)
dependabot[bot] Jan 1, 2024
f18cd07
Update common Prometheus files (#2897)
prombot Jan 8, 2024
e22174c
diskstats: ignore zram devices on linux systems by default (#2898)
DBS-ST-VIT Jan 15, 2024
4db443e
Bump golang-builder version (#2908)
gitperr Jan 27, 2024
94ddad4
exec_bsd: Fix labels for vm.stats.sys.v_syscall sysctl (#2895)
phyber Jan 29, 2024
34467b1
chore:remove constant from function (#2884)
tylitianrui Jan 29, 2024
1ae329e
build(deps): bump github.com/prometheus/common from 0.45.0 to 0.46.0 …
dependabot[bot] Feb 1, 2024
14949db
build(deps): bump github.com/jsimonetti/rtnetlink from 1.4.0 to 1.4.1…
dependabot[bot] Feb 2, 2024
fe78e7e
fix hwmon nil ptr (#2873)
yowenter Feb 3, 2024
29fca60
Fix hwmon error capture (#2915)
SuperQ Feb 7, 2024
d54744a
Update common Prometheus files (#2917)
prombot Feb 7, 2024
6d18ce7
Revert "Add ZFS freebsd per dataset stats (#2753)" (#2925)
seeplusplus Feb 14, 2024
9f1f791
filesystem: fix mountTimeout not working issue (#2903)
DongWei-4 Feb 14, 2024
9f94738
Fix description for NodeDiskIOSaturation alert (#2929)
slyt Feb 16, 2024
09014c0
Enforce no subprocess policy (#2926)
SuperQ Feb 16, 2024
1219247
filesystem: surface device errors (#2923)
PamelaMei-SAP Feb 18, 2024
3a02ab1
Revert "filesystem: fix mountTimeout not working issue (#2903)" (#2932)
SuperQ Feb 20, 2024
c371a7f
Update common Prometheus files (#2939)
prombot Feb 26, 2024
3866d2a
Update common Prometheus files (#2946)
prombot Mar 4, 2024
cdb1e4c
build(deps): bump golang.org/x/sys from 0.16.0 to 0.17.0 (#2943)
dependabot[bot] Mar 6, 2024
762f15e
build(deps): bump github.com/prometheus/client_golang (#2942)
dependabot[bot] Mar 6, 2024
d502a14
build(deps): bump github.com/prometheus/client_model from 0.5.0 to 0.…
dependabot[bot] Mar 6, 2024
4ec07ee
build(deps): bump golang.org/x/sys from 0.17.0 to 0.18.0 (#2948)
dependabot[bot] Mar 6, 2024
90c7f0f
Update common Prometheus files (#2949)
prombot Mar 8, 2024
8dbeac9
build(deps): bump github.com/prometheus/procfs from 0.12.0 to 0.13.0 …
dependabot[bot] Mar 8, 2024
cc49133
Add multi-cluster support for Nodes dashboard (#2945)
adberger Mar 8, 2024
5e412a6
disable selinux,fix end-to-end-test.sh error(#2934) (#2937)
linuxgcc Mar 8, 2024
95efb86
Add new collector and metrics for watchdog (#2309) (#2880)
gavinkflam Mar 9, 2024
94ef5cc
Enable watchdog module by default; Add no data error (#2953)
gavinkflam Mar 14, 2024
666a5d7
Update common Prometheus files (#2954)
prombot Mar 17, 2024
9d359d0
build(deps): bump google.golang.org/protobuf from 1.32.0 to 1.33.0 (#…
dependabot[bot] Mar 17, 2024
32ac7f4
Update common Prometheus files (#2959)
prombot Mar 18, 2024
274cd51
Update common Prometheus files (#2964)
prombot Mar 21, 2024
b3bbd1f
Sanitize ethtool metric name keys
SuperQ Feb 29, 2024
6425f07
Update common Prometheus files
prombot Mar 21, 2024
641cf2c
chore: fix some typos (#2974)
occupyhabit Mar 23, 2024
ebddab4
collector/textfile: Avoid inconsistent help-texts (#2962)
rexagod Mar 24, 2024
3accd4c
Update common Prometheus files (#2973)
prombot Mar 24, 2024
b6227af
os_release.go: Added support end parsing support. (#2982)
jpds Apr 3, 2024
29cdbd6
zfs: Log mib when sysctl read fails on FreeBSD
dekimsey Mar 23, 2024
7d4103c
chore: fix typo in comment
looklose Apr 10, 2024
bf67c85
fibre_channel: update procfs to take into account optional attributes…
machine424 Apr 15, 2024
0202220
refactor: Optimize code by using built-in constants in the standard l…
coderwander Apr 16, 2024
36e0d1f
os_release.go: Removed caching of modtime/filename of os-release file…
jpds Apr 17, 2024
dc5d3ca
build(deps): bump golang.org/x/net from 0.20.0 to 0.23.0 (#2996)
dependabot[bot] Apr 19, 2024
e9e2713
fix: data race of NetClassCollector metrics initialization when multi…
gqcn Apr 19, 2024
5c4f9e7
Update common Prometheus files (#2992)
prombot Apr 19, 2024
acb3676
Update build (#3000)
SuperQ Apr 20, 2024
d333366
Fix watchdog_test lint and test failures on macos. (#3003)
cleeland Apr 22, 2024
cadb1d1
Release v1.8.0 (#3002)
SuperQ Apr 24, 2024
2fe26a6
Merge tag 'refs/tags/v1.8.0'
github-actions[bot] Apr 25, 2024
219bf3b
[bot] vendor: revendor
github-actions[bot] Apr 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ executors:
# should also be updated.
golang:
docker:
- image: cimg/go:1.21
- image: cimg/go:1.22
arm:
machine:
image: ubuntu-2204:current
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
machine:
image: ubuntu-2204:current
environment:
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.18-base
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.22-base
REPO_PATH: github.com/prometheus/node_exporter
steps:
- prometheus/setup_environment
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/container_description.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: Push README to Docker Hub
on:
push:
paths:
- "README.md"
- ".github/workflows/container_description.yml"
branches: [ main, master ]

permissions:
contents: read

jobs:
PushDockerHubReadme:
runs-on: ubuntu-latest
name: Push README to Docker Hub
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
steps:
- name: git checkout
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Set docker hub repo name
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
- name: Push README to Dockerhub
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1
env:
DOCKER_USER: ${{ secrets.DOCKER_HUB_LOGIN }}
DOCKER_PASS: ${{ secrets.DOCKER_HUB_PASSWORD }}
with:
destination_container_repo: ${{ env.DOCKER_REPO_NAME }}
provider: dockerhub
short_description: ${{ env.DOCKER_REPO_NAME }}
readme_file: 'README.md'

PushQuayIoReadme:
runs-on: ubuntu-latest
name: Push README to quay.io
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
steps:
- name: git checkout
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Set quay.io org name
run: echo "DOCKER_REPO=$(echo quay.io/${GITHUB_REPOSITORY_OWNER} | tr -d '-')" >> $GITHUB_ENV
- name: Set quay.io repo name
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
- name: Push README to quay.io
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1
env:
DOCKER_APIKEY: ${{ secrets.QUAY_IO_API_TOKEN }}
with:
destination_container_repo: ${{ env.DOCKER_REPO_NAME }}
provider: quay
readme_file: 'README.md'
16 changes: 11 additions & 5 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,27 @@ on:
- ".golangci.yml"
pull_request:

permissions: # added using https://github.com/step-security/secure-repo
contents: read

jobs:
golangci:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: install Go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: 1.20.x
go-version: 1.22.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'
- name: Lint
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0
with:
version: v1.54.2
version: v1.56.2
9 changes: 9 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
linters:
enable:
- depguard
- misspell
- revive
disable:
Expand All @@ -19,6 +20,14 @@ issues:
- errcheck

linters-settings:
depguard:
rules:
no_exec_policy:
files:
- "!$test"
deny:
- pkg: "os/exec"
desc: "Using os/exec to run sub processes it not allowed by policy"
errcheck:
exclude-functions:
# Used in HTTP handlers, any error is handled by the server itself.
Expand Down
3 changes: 1 addition & 2 deletions .promu-cgo.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
go:
# Whenever the Go version is updated here, .circle/config.yml and
# .promu.yml should also be updated.
version: 1.21
version: 1.22
cgo: true
repository:
path: github.com/prometheus/node_exporter
build:
binaries:
- name: node_exporter
flags: -a -tags 'netgo osusergo static_build'
ldflags: |
-X github.com/prometheus/common/version.Version={{.Version}}
-X github.com/prometheus/common/version.Revision={{.Revision}}
Expand Down
3 changes: 1 addition & 2 deletions .promu.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
go:
# Whenever the Go version is updated here, .circle/config.yml and
# .promu-cgo.yml should also be updated.
version: 1.21
version: 1.22
repository:
path: github.com/prometheus/node_exporter
build:
binaries:
- name: node_exporter
flags: -a -tags 'netgo osusergo static_build'
ldflags: |
-X github.com/prometheus/common/version.Version={{.Version}}
-X github.com/prometheus/common/version.Revision={{.Revision}}
Expand Down
2 changes: 2 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
extends: default
ignore: |
ui/react-app/node_modules

rules:
braces:
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@
* [ENHANCEMENT]
* [BUGFIX]

## 1.8.0 / 2024-04-24

* [CHANGE] exec_bsd: Fix labels for `vm.stats.sys.v_syscall` sysctl #2895
* [CHANGE] diskstats: Ignore zram devices on linux systems #2898
* [CHANGE] textfile: Avoid inconsistent help-texts #2962
* [CHANGE] os: Removed caching of modtime/filename of os-release file #2987
* [FEATURE] xfrm: Add new collector #2866
* [FEATURE] watchdog: Add new collector #2880
* [ENHANCEMENT] cpu_vulnerabilities: Add mitigation information label #2806
* [ENHANCEMENT] nfsd: Handle new `wdeleg_getattr` attribute #2810
* [ENHANCEMENT] netstat: Add TCPOFOQueue to default netstat metrics #2867
* [ENHANCEMENT] filesystem: surface device errors #2923
* [ENHANCEMENT] os: Add support end parsing #2982
* [ENHANCEMENT] zfs: Log mib when sysctl read fails on FreeBSD #2975
* [ENHANCEMENT] fibre_channel: update procfs to take into account optional attributes #2933
* [BUGFIX] cpu: Fix debug log in cpu collector #2857
* [BUGFIX] hwmon: Fix hwmon nil ptr #2873
* [BUGFIX] hwmon: Fix hwmon error capture #2915
* [BUGFIX] zfs: Revert "Add ZFS freebsd per dataset stats #2925
* [BUGFIX] ethtool: Sanitize ethtool metric name keys #2940
* [BUGFIX] fix: data race of NetClassCollector metrics initialization #2995

## 1.7.0 / 2023-11-11

* [FEATURE] Add ZFS freebsd per dataset stats #2753
Expand Down
24 changes: 16 additions & 8 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ endif
GOTEST := $(GO) test
GOTEST_DIR :=
ifneq ($(CIRCLE_JOB),)
ifneq ($(shell command -v gotestsum > /dev/null),)
ifneq ($(shell command -v gotestsum 2> /dev/null),)
GOTEST_DIR := test-results
GOTEST := gotestsum --junitfile $(GOTEST_DIR)/unit-tests.xml --
endif
Expand All @@ -61,11 +61,11 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
SKIP_GOLANGCI_LINT :=
GOLANGCI_LINT :=
GOLANGCI_LINT_OPTS ?=
GOLANGCI_LINT_VERSION ?= v1.54.2
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
GOLANGCI_LINT_VERSION ?= v1.56.2
# 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.
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386))
ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386 arm64))
# If we're in CI and there is an Actions file, that means the linter
# is being run in Actions, so we don't need to run it here.
ifneq (,$(SKIP_GOLANGCI_LINT))
Expand Down Expand Up @@ -169,16 +169,20 @@ common-vet:
common-lint: $(GOLANGCI_LINT)
ifdef GOLANGCI_LINT
@echo ">> running golangci-lint"
# 'go list' needs to be executed before staticcheck to prepopulate the modules cache.
# Otherwise staticcheck might fail randomly for some reason not yet explained.
$(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
$(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
endif

.PHONY: common-lint-fix
common-lint-fix: $(GOLANGCI_LINT)
ifdef GOLANGCI_LINT
@echo ">> running golangci-lint fix"
$(GOLANGCI_LINT) run --fix $(GOLANGCI_LINT_OPTS) $(pkgs)
endif

.PHONY: common-yamllint
common-yamllint:
@echo ">> running yamllint on all YAML files in the repository"
ifeq (, $(shell command -v yamllint > /dev/null))
ifeq (, $(shell command -v yamllint 2> /dev/null))
@echo "yamllint not installed so skipping"
else
yamllint .
Expand All @@ -204,6 +208,10 @@ common-tarball: promu
@echo ">> building release tarball"
$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)

.PHONY: common-docker-repo-name
common-docker-repo-name:
@echo "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)"

.PHONY: common-docker $(BUILD_DOCKER_ARCHS)
common-docker: $(BUILD_DOCKER_ARCHS)
$(BUILD_DOCKER_ARCHS): common-docker-%:
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ For automated installs with [Ansible](https://www.ansible.com/), there is the [P

### Docker

The `node_exporter` is designed to monitor the host system. It's not recommended
to deploy it as a Docker container because it requires access to the host system.
The `node_exporter` is designed to monitor the host system. Deploying in containers requires
extra care in order to avoid monitoring the container itself.

For situations where Docker deployment is needed, some extra flags must be used to allow
For situations where containerized deployment is needed, some extra flags must be used to allow
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
Expand Down Expand Up @@ -158,6 +158,7 @@ timex | Exposes selected adjtimex(2) system call stats. | Linux
udp_queues | Exposes UDP total lengths of the rx_queue and tx_queue from `/proc/net/udp` and `/proc/net/udp6`. | Linux
uname | Exposes system information as provided by the uname system call. | Darwin, FreeBSD, Linux, OpenBSD
vmstat | Exposes statistics from `/proc/vmstat`. | Linux
watchdog | Exposes statistics from `/sys/class/watchdog` | Linux
xfs | Exposes XFS runtime statistics. | Linux (kernel 4.4+)
zfs | Exposes [ZFS](http://open-zfs.org/) performance statistics. | FreeBSD, [Linux](http://zfsonlinux.org/), Solaris

Expand Down Expand Up @@ -205,6 +206,7 @@ sysctl | Expose sysctl values from `/proc/sys`. Use `--collector.sysctl.include(
systemd | Exposes service and system status from [systemd](http://www.freedesktop.org/wiki/Software/systemd/). | 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
zoneinfo | Exposes NUMA memory zone metrics. | Linux

### Deprecated
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.7.0
1.8.0
4 changes: 2 additions & 2 deletions collector/cpu_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"os"
"path/filepath"
"regexp"
"slices"
"strconv"
"sync"

Expand All @@ -31,7 +32,6 @@ import (
"github.com/prometheus/procfs"
"github.com/prometheus/procfs/sysfs"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
)

type cpuCollector struct {
Expand Down Expand Up @@ -205,7 +205,7 @@ func (c *cpuCollector) updateInfo(ch chan<- prometheus.Metric) error {

cpuFreqEnabled, ok := collectorState["cpufreq"]
if !ok || cpuFreqEnabled == nil {
level.Debug(c.logger).Log("cpufreq key missing or nil value in collectorState map", err)
level.Debug(c.logger).Log("msg", "cpufreq key missing or nil value in collectorState map")
} else if !*cpuFreqEnabled {
for _, cpu := range info {
ch <- prometheus.MustNewConstMetric(c.cpuFrequencyHz,
Expand Down
3 changes: 2 additions & 1 deletion collector/cpu_vulnerabilities_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var (
vulnerabilityDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuVulerabilitiesCollector, "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"},
[]string{"codename", "state", "mitigation"},
nil,
)
)
Expand Down Expand Up @@ -62,6 +62,7 @@ func (v *cpuVulnerabilitiesCollector) Update(ch chan<- prometheus.Metric) error
1.0,
vulnerability.CodeName,
sysfs.VulnerabilityHumanEncoding[vulnerability.State],
vulnerability.Mitigation,
)
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion collector/diskstats_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const (
// See also https://www.kernel.org/doc/Documentation/block/stat.txt
unixSectorSize = 512.0

diskstatsDefaultIgnoredDevices = "^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$"
diskstatsDefaultIgnoredDevices = "^(z?ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$"

// See udevadm(8).
udevDevicePropertyPrefix = "E:"
Expand Down
2 changes: 1 addition & 1 deletion collector/diskstats_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestDiskStats(t *testing.T) {
*sysPath = "fixtures/sys"
*procPath = "fixtures/proc"
*udevDataPath = "fixtures/udev/data"
*diskstatsDeviceExclude = "^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$"
*diskstatsDeviceExclude = "^(z?ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$"
testcase := `# HELP node_disk_ata_rotation_rate_rpm ATA disk rotation rate in RPMs (0 for SSDs).
# TYPE node_disk_ata_rotation_rate_rpm gauge
node_disk_ata_rotation_rate_rpm{device="sda"} 7200
Expand Down
11 changes: 6 additions & 5 deletions collector/ethtool_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,18 +445,19 @@ func (c *ethtoolCollector) Update(ch chan<- prometheus.Metric) error {
// Sanitizing the metric names can lead to duplicate metric names. Therefore check for clashes beforehand.
metricFQNames := make(map[string]string)
for metric := range stats {
if !c.metricsPattern.MatchString(metric) {
metricName := SanitizeMetricName(metric)
if !c.metricsPattern.MatchString(metricName) {
continue
}
metricFQName := buildEthtoolFQName(metric)
metricFQName := buildEthtoolFQName(metricName)
existingMetric, exists := metricFQNames[metricFQName]
if exists {
level.Debug(c.logger).Log("msg", "dropping duplicate metric name", "device", device,
"metricFQName", metricFQName, "metric1", existingMetric, "metric2", metric)
// Keep the metric as "deleted" in the dict in case there are 3 duplicates.
"metricFQName", metricFQName, "metric1", existingMetric, "metric2", metricName)
// Keep the metricName as "deleted" in the dict in case there are 3 duplicates.
metricFQNames[metricFQName] = ""
} else {
metricFQNames[metricFQName] = metric
metricFQNames[metricFQName] = metricName
}
}

Expand Down
Loading