Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafouf69 committed Apr 30, 2024
2 parents fab2fab + 66a8900 commit 2d4f2cb
Show file tree
Hide file tree
Showing 34 changed files with 480 additions and 144 deletions.
30 changes: 16 additions & 14 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
.dockerignore
/.dockerignore
.DS_Store
# TODO: uncomment when applications no longer use git to get version information
#.git/
.github/
.gitignore
.goreleaser.yml
/.github/
/.gitignore
/.goreleaser.yml
/*.env*
.golangci.yaml
build/
CONTRIBUTING.md
Dockerfile
docs/
LICENSE*
Makefile.maker.yaml
README.md
report.html
shell.nix
/.golangci.yaml
/.vscode/
/build/
/CONTRIBUTING.md
/Dockerfile
/docs/
/LICENSE*
/Makefile.maker.yaml
/README.md
/report.html
/shell.nix
/testing/
dist/
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# @majewsky = lead developer
# @SuperSandro2000 @VoigtS = collaborators
# @Nuckal777 = backup reviewer
* @majewsky @SuperSandro2000 @VoigtS @Nuckal777
2 changes: 1 addition & 1 deletion .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
uses: actions/setup-go@v5
with:
check-latest: true
go-version: "1.22"
go-version: 1.22.2
- name: Dependency Licenses Review
run: make check-dependency-licenses
- name: Run govulncheck
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ jobs:
uses: actions/setup-go@v5
with:
check-latest: true
go-version: "1.22"
go-version: 1.22.2
- name: Build all binaries
run: make build-all
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v5
with:
version: latest
test:
Expand All @@ -47,6 +47,6 @@ jobs:
uses: actions/setup-go@v5
with:
check-latest: true
go-version: "1.22"
go-version: 1.22.2
- name: Run tests and generate coverage report
run: make build/cover.out
5 changes: 3 additions & 2 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ permissions:
security-events: write
jobs:
analyze:
name: Analyze
name: CodeQL
runs-on: ubuntu-latest
steps:
- name: Check out code
Expand All @@ -28,11 +28,12 @@ jobs:
uses: actions/setup-go@v5
with:
check-latest: true
go-version: "1.22"
go-version: 1.22.2
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: go
queries: security-extended
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: actions/setup-go@v5
with:
check-latest: true
go-version: "1.22"
go-version: 1.22.2
- name: Generate release info
run: |
go install github.com/sapcc/go-bits/tools/release-info@latest
Expand Down
18 changes: 15 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ issues:
- path: _test\.go
linters:
- bodyclose
- dupl
# '0' disables the following options.
max-issues-per-linter: 0
max-same-issues: 0

linters-settings:
copyloopvar:
ignore-alias: true
dupl:
# Tokens count to trigger issue, 150 by default.
threshold: 100
Expand All @@ -41,6 +44,9 @@ linters-settings:
# Applications wishing to use http.ServeMux should obtain local instances through http.NewServeMux() instead of using the global default instance.
- ^http\.DefaultServeMux$
- ^http\.Handle(?:Func)?$
goconst:
ignore-tests: true
min-occurrences: 5
gocritic:
enabled-checks:
- boolExprSimplify
Expand Down Expand Up @@ -76,8 +82,9 @@ linters-settings:
# created file permissions are restricted by umask if necessary
- G306
govet:
# Report about shadowed variables.
check-shadowing: true
enable-all: true
disable:
- fieldalignment
nolintlint:
require-specific: true
stylecheck:
Expand Down Expand Up @@ -108,27 +115,32 @@ linters:
enable:
- bodyclose
- containedctx
- copyloopvar
- dupl
- dupword
- durationcheck
- errcheck
- errname
- errorlint
- exportloopref
- forbidigo
- ginkgolinter
- gocheckcompilerdirectives
- goconst
- gocritic
- gofmt
- goimports
- gosec
- gosimple
- govet
- ineffassign
- intrange
- misspell
- nilerr
- noctx
- nolintlint
- nosprintfhostport
- perfsprint
- predeclared
- rowserrcheck
- sqlclosecheck
- staticcheck
Expand Down
3 changes: 3 additions & 0 deletions .license-scan-overrides.jsonl
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
{"name": "github.com/hashicorp/vault/api/auth/approle", "licenceType": "MPL-2.0"}
{"name": "github.com/jpillora/longestcommon", "licenceType": "MIT"}
{"name": "github.com/spdx/tools-golang", "licenceTextOverrideFile": "vendor/github.com/spdx/tools-golang/LICENSE.code"}
{"name": "github.com/xeipuuv/gojsonpointer", "licenceType": "Apache-2.0"}
{"name": "github.com/xeipuuv/gojsonreference", "licenceType": "Apache-2.0"}
{"name": "github.com/xeipuuv/gojsonschema", "licenceType": "Apache-2.0"}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22.1-alpine3.19 as builder
FROM golang:1.22.2-alpine3.19 as builder

RUN apk add --no-cache --no-progress ca-certificates gcc git make musl-dev

Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ install: FORCE build/ntp_exporter

# which packages to test with test runner
GO_TESTPKGS := $(shell go list -f '{{if or .TestGoFiles .XTestGoFiles}}{{.ImportPath}}{{end}}' ./...)
ifeq ($(GO_TESTPKGS),)
GO_TESTPKGS := ./...
endif
# which packages to measure coverage for
GO_COVERPKGS := $(shell go list ./...)
# to get around weird Makefile syntax restrictions, we need variables containing nothing, a space and comma
Expand Down
9 changes: 1 addition & 8 deletions Makefile.maker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dockerfile:
- "dist/"

golang:
enableVendoring: true
setGoModVersion: true

golangciLint:
Expand All @@ -25,18 +24,12 @@ goReleaser:

githubWorkflow:
ci:
# Even though there are no tests, we can still use the CI workflow for linting and
# successful build compilation.
enabled: true
ignorePaths: [ "**.md" ] # all Markdown files
license:
enabled: true
pushContainerToGhcr:
enabled: true
release:
enabled: true
securityChecks:
enabled: true

renovate:
enabled: true
assignees:
Expand Down
6 changes: 3 additions & 3 deletions collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (c Collector) Collect(ch chan<- prometheus.Metric) {

c.serverReachable.Collect(ch)

//only report data when measurement was successful
// only report data when measurement was successful
if err == nil {
c.buildInfo.Collect(ch)
c.drift.Collect(ch)
Expand Down Expand Up @@ -183,9 +183,9 @@ func (c Collector) measure() error {
return fmt.Errorf("couldn't get NTP measurement: %w", err)
}

//if clock drift is unusually high (e.g. >10ms): repeat measurements for 30 seconds and submit median value
// if clock drift is unusually high (e.g. >10ms): repeat measurements for 30 seconds and submit median value
if measurement.clockOffset > c.NtpHighDrift.Seconds() {
//arrays of measurements used to calculate median
// arrays of measurements used to calculate median
var measurementsClockOffset []float64
var measurementsStratum []float64
var measurementsRTT []float64
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ go 1.22
require (
github.com/beevik/ntp v1.3.1
github.com/prometheus/client_golang v1.19.0
github.com/sapcc/go-api-declarations v1.10.9
github.com/sapcc/go-bits v0.0.0-20240307080654-364c083fcdf1
github.com/sapcc/go-api-declarations v1.11.0
github.com/sapcc/go-bits v0.0.0-20240425084953-de3210f2772e
go.uber.org/automaxprocs v1.5.3
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.49.0 // indirect
github.com/prometheus/common v0.53.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
)
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7km
github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k=
github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos=
github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8=
github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI=
github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE=
github.com/prometheus/common v0.53.0 h1:U2pL9w9nmJwJDa4qqLQ3ZaePJ6ZTwt7cMD3AG3+aLCE=
github.com/prometheus/common v0.53.0/go.mod h1:BrxBKv3FWBIGXw89Mg1AeBq7FSyRzXWI3l3e7W3RN5U=
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
github.com/sapcc/go-api-declarations v1.10.9 h1:k+F3W0FTyYLazII4hdFaWLJ7L+MQRcFBD9I9P/hUNBs=
github.com/sapcc/go-api-declarations v1.10.9/go.mod h1:83R3hTANhuRXt/pXDby37IJetw8l7DG41s33Tp9NXxI=
github.com/sapcc/go-bits v0.0.0-20240307080654-364c083fcdf1 h1:GpA29LYGZTmX279lMWyZTZhGCNnY4PI/ssjFcElUgnw=
github.com/sapcc/go-bits v0.0.0-20240307080654-364c083fcdf1/go.mod h1:/EltzUoec+W/6oEtfsvbPDs5vqgUzdfLwUFSxeL1WHg=
github.com/sapcc/go-api-declarations v1.11.0 h1:k/U/Hdv2UbBdAyxfnWUyhs8hl74fCrNn8aIWj+k42u4=
github.com/sapcc/go-api-declarations v1.11.0/go.mod h1:83R3hTANhuRXt/pXDby37IJetw8l7DG41s33Tp9NXxI=
github.com/sapcc/go-bits v0.0.0-20240425084953-de3210f2772e h1:FaUDgHrifVrnBXvZrHnK+CMVEPBlxKFlVpCrjvih/Cs=
github.com/sapcc/go-bits v0.0.0-20240425084953-de3210f2772e/go.mod h1:4gsmI0EEDRETgw6+TWm/l627KZMA9/MAxNxMsY1S7bs=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8=
go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
6 changes: 3 additions & 3 deletions vendor/github.com/prometheus/common/expfmt/decode.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 16 additions & 6 deletions vendor/github.com/prometheus/common/expfmt/expfmt.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2d4f2cb

Please sign in to comment.