Skip to content

Commit

Permalink
Release v0.6.0
Browse files Browse the repository at this point in the history
* [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 <[email protected]>
  • Loading branch information
SuperQ committed Oct 30, 2023
1 parent 3edb372 commit 824134a
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 54 deletions.
45 changes: 3 additions & 42 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ executors:
# also be updated.
golang:
docker:
- image: cimg/go:1.20
- image: cimg/go:1.21

jobs:
test:
Expand All @@ -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:
Expand All @@ -73,7 +33,8 @@ workflows:
filters:
tags:
only: /.*/
- codespell:
- prometheus/build:
name: build
filters:
tags:
only: /.*/
Expand Down
11 changes: 10 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---
linters:
enable:
- misspell
- revive

issues:
exclude-rules:
- path: _test.go
Expand All @@ -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
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, .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}}
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0
0.6.0
3 changes: 1 addition & 2 deletions examples/kubernetes/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions scripts/errcheck_excludes.txt

This file was deleted.

4 changes: 2 additions & 2 deletions systemd/systemd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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")

Expand Down

0 comments on commit 824134a

Please sign in to comment.