From 824134a9fd34aaedc141e503cd2d8c54f9de77ae Mon Sep 17 00:00:00 2001 From: SuperQ Date: Mon, 30 Oct 2023 11:42:47 +0100 Subject: [PATCH] Release v0.6.0 * [CHANGE] Remove broken metrics collection #68 * [CHANGE] Remove use of cgroups #105 * [FEATURE] Add unit timestamp metrics #58 Build updates: * Simplify build with CircleCI orb. * Upgrade to Go 1.21. * Switch form codespell to misspell linter. * Enable revive linter. * Removed unused func param. * Remove unnecessary promu build flags. * Move errcheck excludes inline. Signed-off-by: SuperQ --- .circleci/config.yml | 45 ++---------------------------- .golangci.yml | 11 +++++++- .promu.yml | 3 +- CHANGELOG.md | 6 ++++ VERSION | 2 +- examples/kubernetes/daemonset.yaml | 3 +- scripts/errcheck_excludes.txt | 4 --- systemd/systemd.go | 4 +-- 8 files changed, 24 insertions(+), 54 deletions(-) delete mode 100644 scripts/errcheck_excludes.txt diff --git a/.circleci/config.yml b/.circleci/config.yml index b500826..78366d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,7 +9,7 @@ executors: # also be updated. golang: docker: - - image: cimg/go:1.20 + - image: cimg/go:1.21 jobs: test: @@ -21,46 +21,6 @@ jobs: - prometheus/store_artifact: file: systemd_exporter - codespell: - docker: - - image: cimg/python:3.11 - - steps: - - checkout - - run: pip install codespell - - run: codespell --skip=".git,./vendor,ttar,go.mod,go.sum,*pem" -L uint,packages\',uptodate - - build: - machine: - image: ubuntu-2204:current - - environment: - DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.18-base - REPO_PATH: github.com/prometheus-community/systemd_exporter - - steps: - - checkout - - run: docker run --privileged linuxkit/binfmt:v0.8 - - run: make promu - - run: promu crossbuild - - run: promu --config .promu.yml crossbuild - - persist_to_workspace: - root: . - paths: - - .build - - store_artifacts: - path: .build - destination: /build - - run: - command: | - if [ -n "$CIRCLE_TAG" ]; then - make docker DOCKER_IMAGE_TAG=$CIRCLE_TAG - else - make docker - fi - - run: docker images - - run: docker run --rm -t -v "$(pwd):/app" "${DOCKER_TEST_IMAGE_NAME}" -i "${REPO_PATH}" -T - workflows: version: 2 systemd_exporter: @@ -73,7 +33,8 @@ workflows: filters: tags: only: /.*/ - - codespell: + - prometheus/build: + name: build filters: tags: only: /.*/ diff --git a/.golangci.yml b/.golangci.yml index 883547a..7d865d1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,4 +1,9 @@ --- +linters: + enable: + - misspell + - revive + issues: exclude-rules: - path: _test.go @@ -7,4 +12,8 @@ issues: linters-settings: errcheck: - exclude: scripts/errcheck_excludes.txt + exclude-functions: + # Used in HTTP handlers, any error is handled by the server itself. + - (net/http.ResponseWriter).Write + # Never check for logger errors. + - (github.com/go-kit/log.Logger).Log diff --git a/.promu.yml b/.promu.yml index 6b43f29..3199e98 100644 --- a/.promu.yml +++ b/.promu.yml @@ -1,13 +1,12 @@ go: # Whenever the Go version is updated here, .travis.yml and # .circle/config.yml should also be updated. - version: 1.20 + version: 1.21 repository: path: github.com/prometheus-community/systemd_exporter build: binaries: - name: systemd_exporter - flags: -a -tags 'netgo static_build' ldflags: | -X github.com/prometheus/common/version.Version={{.Version}} -X github.com/prometheus/common/version.Revision={{.Revision}} diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bfd7f8..a2cf861 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## main / unreleased +## 0.6.0 / 2023-10-30 + +* [CHANGE] Remove broken metrics collection #68 +* [CHANGE] Remove use of cgroups #105 +* [FEATURE] Add unit timestamp metrics #58 + ## 0.5.0 / 2022-07-20 Now released under the Prometheus Community diff --git a/VERSION b/VERSION index 8f0916f..a918a2a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.0 +0.6.0 diff --git a/examples/kubernetes/daemonset.yaml b/examples/kubernetes/daemonset.yaml index 3a92159..8272dc3 100644 --- a/examples/kubernetes/daemonset.yaml +++ b/examples/kubernetes/daemonset.yaml @@ -31,8 +31,7 @@ spec: privileged: true args: - --log.level=info - - --path.procfs=/host/proc - - --collector.unit-whitelist=kubelet.service|docker.service + - --collector.unit-include=kubelet.service|docker.service ports: - name: metrics containerPort: 9558 diff --git a/scripts/errcheck_excludes.txt b/scripts/errcheck_excludes.txt deleted file mode 100644 index 14b824f..0000000 --- a/scripts/errcheck_excludes.txt +++ /dev/null @@ -1,4 +0,0 @@ -// Used in HTTP handlers, any error is handled by the server itself. -(net/http.ResponseWriter).Write -// Never check for logger errors. -(github.com/go-kit/log.Logger).Log diff --git a/systemd/systemd.go b/systemd/systemd.go index 6387a33..85a9df7 100644 --- a/systemd/systemd.go +++ b/systemd/systemd.go @@ -289,7 +289,7 @@ func (c *Collector) collectUnit(conn *dbus.Conn, ch chan<- prometheus.Metric, un logger := log.With(c.logger, "unit", unit.Name) // Collect unit_state for all - err := c.collectUnitState(conn, ch, unit) + err := c.collectUnitState(ch, unit) if err != nil { level.Warn(logger).Log("msg", errUnitMetricsMsg, "err", err) // TODO should we continue processing here? @@ -352,7 +352,7 @@ func (c *Collector) collectUnit(conn *dbus.Conn, ch chan<- prometheus.Metric, un return nil } -func (c *Collector) collectUnitState(conn *dbus.Conn, ch chan<- prometheus.Metric, unit dbus.UnitStatus) error { +func (c *Collector) collectUnitState(ch chan<- prometheus.Metric, unit dbus.UnitStatus) error { // TODO: wrap GetUnitTypePropertyString( // serviceTypeProperty, err := conn.GetUnitTypeProperty(unit.Name, "Timer", "NextElapseUSecMonotonic")