Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
Signed-off-by: Alper Polat <101826653+gitperr@users.noreply.github.com>
  • Loading branch information
gitperr committed Apr 30, 2024
2 parents 3b8388d + 9572e7a commit 2e93193
Show file tree
Hide file tree
Showing 42 changed files with 811 additions and 263 deletions.
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 @@ -66,7 +66,7 @@ jobs:
machine:
image: ubuntu-2204:current
environment:
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.21-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'
8 changes: 4 additions & 4 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ jobs:
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@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: 1.21.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.55.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
20 changes: 14 additions & 6 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,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 ?= v1.55.2
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))
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
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
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
2 changes: 1 addition & 1 deletion 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
21 changes: 16 additions & 5 deletions collector/ethtool_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ func makeEthtoolCollector(logger log.Logger) (*ethtoolCollector, error) {
return nil, fmt.Errorf("failed to initialize ethtool library: %w", err)
}

if *ethtoolDeviceInclude != "" {
level.Info(logger).Log("msg", "Parsed flag --collector.ethtool.device-include", "flag", *ethtoolDeviceInclude)
}
if *ethtoolDeviceExclude != "" {
level.Info(logger).Log("msg", "Parsed flag --collector.ethtool.device-exclude", "flag", *ethtoolDeviceExclude)
}
if *ethtoolIncludedMetrics != "" {
level.Info(logger).Log("msg", "Parsed flag --collector.ethtool.metrics-include", "flag", *ethtoolIncludedMetrics)
}

// Pre-populate some common ethtool metrics.
return &ethtoolCollector{
fs: fs,
Expand Down Expand Up @@ -445,18 +455,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
5 changes: 0 additions & 5 deletions collector/exec_bsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ func NewExecCollector(logger log.Logger) (Collector, error) {
name: "exec_context_switches_total",
description: "Context switches since system boot. Resets at architecture unsigned integer.",
mib: "vm.stats.sys.v_swtch",
labels: nil,
},
{
name: "exec_traps_total",
description: "Traps since system boot. Resets at architecture unsigned integer.",
mib: "vm.stats.sys.v_trap",
labels: nil,
},
{
name: "exec_system_calls_total",
Expand All @@ -67,19 +65,16 @@ func NewExecCollector(logger log.Logger) (Collector, error) {
name: "exec_device_interrupts_total",
description: "Device interrupts since system boot. Resets at architecture unsigned integer.",
mib: "vm.stats.sys.v_intr",
labels: nil,
},
{
name: "exec_software_interrupts_total",
description: "Software interrupts since system boot. Resets at architecture unsigned integer.",
mib: "vm.stats.sys.v_soft",
labels: nil,
},
{
name: "exec_forks_total",
description: "Number of fork() calls since system boot. Resets at architecture unsigned integer.",
mib: "vm.stats.vm.v_forks",
labels: nil,
},
},
logger: logger,
Expand Down
12 changes: 0 additions & 12 deletions collector/fibrechannel_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,6 @@ func NewFibreChannelCollector(logger log.Logger) (Collector, error) {
"rx_words_total": "Number of words received by host port",
"tx_frames_total": "Number of frames transmitted by host port",
"link_failure_total": "Number of times the host port link has failed",
"name": "Name of Fibre Channel HBA",
"speed": "Current operating speed",
"port_state": "Current port state",
"port_type": "Port type, what the port is connected to",
"symbolic_name": "Symbolic Name",
"node_name": "Node Name as hexadecimal string",
"port_id": "Port ID as string",
"port_name": "Port Name as hexadecimal string",
"fabric_name": "Fabric Name; 0 if PTP",
"dev_loss_tmo": "Device Loss Timeout in seconds",
"supported_classes": "The FC classes supported",
"supported_speeds": "The FC speeds supported",
}

i.metricDescs = make(map[string]*prometheus.Desc)
Expand Down
Loading

0 comments on commit 2e93193

Please sign in to comment.