Skip to content

Commit 26d9c7a

Browse files
krajoramadependabot[bot]tomwilkie
authored
Update prometheus to v2.51.1 (#167)
* Bump github.com/prometheus/prometheus from 0.47.2 to 0.51.1 Bumps [github.com/prometheus/prometheus](https://github.com/prometheus/prometheus) from 0.47.2 to 0.51.1. - [Release notes](https://github.com/prometheus/prometheus/releases) - [Changelog](https://github.com/prometheus/prometheus/blob/main/CHANGELOG.md) - [Commits](prometheus/prometheus@v0.47.2...v0.51.1) --- updated-dependencies: - dependency-name: github.com/prometheus/prometheus dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * run golangci with go 1.21 * Update golangci-lint * Remove ioutil. --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tom Wilkie <[email protected]>
1 parent 24be89b commit 26d9c7a

File tree

13 files changed

+252
-174
lines changed

13 files changed

+252
-174
lines changed

.github/workflows/golangci-lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ jobs:
2020
- name: install Go
2121
uses: actions/setup-go@v5
2222
with:
23-
go-version: 1.18.x
23+
go-version: 1.21.x
2424
- name: Install snmp_exporter/generator dependencies
2525
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
2626
if: github.repository == 'prometheus/snmp_exporter'
2727
- name: Lint
2828
uses: golangci/[email protected]
2929
with:
30-
version: v1.50.1
30+
version: v1.54

cmd/mixtool/generate.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package main
1717
import (
1818
"encoding/json"
1919
"fmt"
20-
"io/ioutil"
2120
"os"
2221
"path/filepath"
2322

@@ -143,15 +142,15 @@ func generateAlerts(filename string, options mixer.GenerateOptions) error {
143142
return err
144143
}
145144

146-
return ioutil.WriteFile(options.AlertsFilename, out, 0644)
145+
return os.WriteFile(options.AlertsFilename, out, 0644)
147146
}
148147

149148
func generateRules(filename string, options mixer.GenerateOptions) error {
150149
out, err := mixer.GenerateRules(filename, options)
151150
if err != nil {
152151
return err
153152
}
154-
return ioutil.WriteFile(options.RulesFilename, out, 0644)
153+
return os.WriteFile(options.RulesFilename, out, 0644)
155154
}
156155

157156
func generateDashboards(filename string, opts mixer.GenerateOptions) error {

cmd/mixtool/install.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package main
1717
import (
1818
"bytes"
1919
"fmt"
20-
"io/ioutil"
20+
"io"
2121
"net/http"
2222
"net/url"
2323
"os"
@@ -145,7 +145,7 @@ func putMixin(content []byte, bindAddress string) error {
145145
if resp.StatusCode == 200 {
146146
fmt.Println("PUT alerts OK")
147147
} else {
148-
responseData, err := ioutil.ReadAll(resp.Body)
148+
responseData, err := io.ReadAll(resp.Body)
149149
if err != nil {
150150
return fmt.Errorf("failed to response body in putMixin, %w", err)
151151
}

cmd/mixtool/install_test.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package main
1616

1717
import (
1818
"fmt"
19-
"io/ioutil"
2019
"os"
2120
"path"
2221
"testing"
@@ -48,9 +47,9 @@ func TestInstallMixin(t *testing.T) {
4847
}
4948

5049
func testInstallMixin(t *testing.T, m mixin) {
51-
tmpdir, err := ioutil.TempDir("", "mixtool-install")
50+
tmpdir, err := os.CreateTemp("", "mixtool-install")
5251
assert.NoError(t, err)
53-
defer os.RemoveAll(tmpdir)
52+
defer os.RemoveAll(tmpdir.Name())
5453

5554
generateCfg := mixer.GenerateOptions{
5655
AlertsFilename: "alerts.yaml",
@@ -63,7 +62,7 @@ func testInstallMixin(t *testing.T, m mixin) {
6362
mixinURL := path.Join(m.URL, m.Subdir)
6463

6564
fmt.Printf("installing %v\n", mixinURL)
66-
dldir := path.Join(tmpdir, m.Name+"mixin-test")
65+
dldir := path.Join(tmpdir.Name(), m.Name+"mixin-test")
6766

6867
err = os.Mkdir(dldir, 0755)
6968
assert.NoError(t, err)

cmd/mixtool/list.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package main
1717
import (
1818
"encoding/json"
1919
"fmt"
20-
"io/ioutil"
20+
"io"
2121
"net/http"
2222
"net/url"
2323
"os"
@@ -68,7 +68,7 @@ func queryWebsite(mixinsWebsite string) ([]byte, error) {
6868
return nil, err
6969
}
7070
defer res.Body.Close()
71-
body, err := ioutil.ReadAll(res.Body)
71+
body, err := io.ReadAll(res.Body)
7272
if err != nil {
7373
return nil, err
7474
}
@@ -129,7 +129,7 @@ func listAction(c *cli.Context) error {
129129
if err != nil {
130130
return err
131131
}
132-
body, err = ioutil.ReadFile(path)
132+
body, err = os.ReadFile(path)
133133
if err != nil {
134134
return err
135135
}
@@ -149,6 +149,6 @@ func listAction(c *cli.Context) error {
149149
if err != nil {
150150
return err
151151
}
152-
152+
153153
return printMixins(mixins)
154154
}

cmd/mixtool/list_test.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package main
1616

1717
import (
18-
"io/ioutil"
1918
"os"
2019
"testing"
2120

@@ -47,14 +46,14 @@ const exampleMixins = `
4746
`
4847

4948
func TestList(t *testing.T) {
50-
tempFile, err := ioutil.TempFile("", "exampleMixinsTest.json")
49+
tempFile, err := os.CreateTemp("", "exampleMixinsTest.json")
5150
assert.NoError(t, err)
5251
defer os.Remove(tempFile.Name())
5352

54-
err = ioutil.WriteFile(tempFile.Name(), []byte(exampleMixins), 0644)
53+
err = os.WriteFile(tempFile.Name(), []byte(exampleMixins), 0644)
5554
assert.NoError(t, err)
5655

57-
body, err := ioutil.ReadFile(tempFile.Name())
56+
body, err := os.ReadFile(tempFile.Name())
5857
assert.NoError(t, err)
5958

6059
mixins, err := parseMixinJSON([]byte(body))

cmd/mixtool/server.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"errors"
2121
"fmt"
2222
"io"
23-
"io/ioutil"
2423
"net/http"
2524
"os"
2625
"path/filepath"
@@ -99,12 +98,12 @@ type ruleProvisioner struct {
9998
// to existing, does not provision them. It returns whether Prometheus should
10099
// be reloaded and if an error has occurred.
101100
func (p *ruleProvisioner) provision(r io.Reader) (bool, error) {
102-
newData, err := ioutil.ReadAll(r)
101+
newData, err := io.ReadAll(r)
103102
if err != nil {
104103
return false, fmt.Errorf("unable to read new rules: %w", err)
105104
}
106105

107-
tempfile, err := ioutil.TempFile(filepath.Dir(p.ruleFile), "temp-mixtool")
106+
tempfile, err := os.CreateTemp(filepath.Dir(p.ruleFile), "temp-mixtool")
108107
if err != nil {
109108
return false, fmt.Errorf("unable to create temp file: %w", err)
110109
}
@@ -184,7 +183,7 @@ func (r *prometheusReloader) triggerReload(ctx context.Context) error {
184183
return fmt.Errorf("reload request: %w", err)
185184
}
186185

187-
if _, err := io.Copy(ioutil.Discard, resp.Body); err != nil {
186+
if _, err := io.Copy(io.Discard, resp.Body); err != nil {
188187
return fmt.Errorf("exhausting request body: %w", err)
189188
}
190189

go.mod

+41-32
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,44 @@
11
module github.com/monitoring-mixins/mixtool
22

3-
go 1.18
3+
go 1.21
4+
5+
toolchain go1.22.1
46

57
require (
68
github.com/fatih/color v1.16.0
79
github.com/grafana/dashboard-linter v0.0.0-20231114210226-c458893a5731
8-
github.com/prometheus/prometheus v0.47.2
10+
github.com/prometheus/prometheus v0.51.1
911
)
1012

1113
require (
12-
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 // indirect
13-
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 // indirect
14-
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
15-
github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect
14+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.10.0 // indirect
15+
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 // indirect
16+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect
17+
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 // indirect
1618
github.com/Masterminds/goutils v1.1.1 // indirect
1719
github.com/Masterminds/semver/v3 v3.2.0 // indirect
1820
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
19-
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
20-
github.com/aws/aws-sdk-go v1.44.302 // indirect
21+
github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 // indirect
22+
github.com/aws/aws-sdk-go v1.50.32 // indirect
23+
github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3 // indirect
2124
github.com/edsrzf/mmap-go v1.1.0 // indirect
22-
github.com/go-logr/logr v1.2.4 // indirect
25+
github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb // indirect
26+
github.com/go-logr/logr v1.4.1 // indirect
2327
github.com/go-logr/stdr v1.2.2 // indirect
2428
github.com/gobuffalo/logger v1.0.6 // indirect
2529
github.com/gobuffalo/packd v1.0.1 // indirect
2630
github.com/gogo/protobuf v1.3.2 // indirect
27-
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
31+
github.com/golang-jwt/jwt/v5 v5.2.0 // indirect
2832
github.com/golang/snappy v0.0.4 // indirect
29-
github.com/google/uuid v1.3.0 // indirect
33+
github.com/google/go-cmp v0.6.0 // indirect
34+
github.com/google/uuid v1.6.0 // indirect
3035
github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd // indirect
3136
github.com/huandu/xstrings v1.3.3 // indirect
3237
github.com/imdario/mergo v0.3.16 // indirect
3338
github.com/jmespath/go-jmespath v0.4.0 // indirect
3439
github.com/jpillora/backoff v1.0.0 // indirect
3540
github.com/karrick/godirwalk v1.17.0 // indirect
36-
github.com/klauspost/compress v1.16.7 // indirect
41+
github.com/klauspost/compress v1.17.7 // indirect
3742
github.com/kylelemons/godebug v1.1.0 // indirect
3843
github.com/markbates/errx v1.1.0 // indirect
3944
github.com/markbates/oncer v1.0.0 // indirect
@@ -44,23 +49,28 @@ require (
4449
github.com/mitchellh/reflectwalk v1.0.2 // indirect
4550
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
4651
github.com/oklog/ulid v1.3.1 // indirect
47-
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
52+
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
4853
github.com/prometheus/common/sigv4 v0.1.0 // indirect
4954
github.com/rs/zerolog v1.30.0 // indirect
5055
github.com/russross/blackfriday/v2 v2.1.0 // indirect
5156
github.com/shopspring/decimal v1.3.1 // indirect
52-
github.com/sirupsen/logrus v1.9.0 // indirect
57+
github.com/sirupsen/logrus v1.9.3 // indirect
5358
github.com/stretchr/objx v0.5.2 // indirect
54-
go.opentelemetry.io/otel v1.16.0 // indirect
55-
go.opentelemetry.io/otel/metric v1.16.0 // indirect
56-
go.opentelemetry.io/otel/trace v1.16.0 // indirect
57-
golang.org/x/crypto v0.17.0 // indirect
58-
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect
59-
golang.org/x/net v0.17.0 // indirect
60-
golang.org/x/oauth2 v0.10.0 // indirect
61-
golang.org/x/sync v0.3.0 // indirect
62-
golang.org/x/term v0.15.0 // indirect
63-
google.golang.org/appengine v1.6.7 // indirect
59+
go.opentelemetry.io/otel v1.24.0 // indirect
60+
go.opentelemetry.io/otel/metric v1.24.0 // indirect
61+
go.opentelemetry.io/otel/trace v1.24.0 // indirect
62+
golang.org/x/crypto v0.21.0 // indirect
63+
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect
64+
golang.org/x/net v0.22.0 // indirect
65+
golang.org/x/oauth2 v0.18.0 // indirect
66+
golang.org/x/sync v0.6.0 // indirect
67+
golang.org/x/term v0.18.0 // indirect
68+
golang.org/x/time v0.5.0 // indirect
69+
google.golang.org/appengine v1.6.8 // indirect
70+
k8s.io/apimachinery v0.29.2 // indirect
71+
k8s.io/client-go v0.29.2 // indirect
72+
k8s.io/klog/v2 v2.120.1 // indirect
73+
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
6474
sigs.k8s.io/yaml v1.3.0 // indirect
6575
)
6676

@@ -77,20 +87,19 @@ require (
7787
github.com/google/go-jsonnet v0.20.0
7888
github.com/grafana/tanka v0.26.0
7989
github.com/jsonnet-bundler/jsonnet-bundler v0.5.1
80-
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
8190
github.com/pkg/errors v0.9.1
8291
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
83-
github.com/prometheus/client_golang v1.16.0 // indirect
84-
github.com/prometheus/client_model v0.4.0 // indirect
85-
github.com/prometheus/common v0.44.0 // indirect
86-
github.com/prometheus/procfs v0.11.0 // indirect
92+
github.com/prometheus/client_golang v1.19.0 // indirect
93+
github.com/prometheus/client_model v0.6.0 // indirect
94+
github.com/prometheus/common v0.49.1-0.20240306132007-4199f18c3e92 // indirect
95+
github.com/prometheus/procfs v0.12.0 // indirect
8796
github.com/spf13/cast v1.5.1 // indirect
8897
github.com/stretchr/testify v1.9.0
8998
go.uber.org/atomic v1.11.0 // indirect
90-
go.uber.org/goleak v1.2.1 // indirect
91-
golang.org/x/sys v0.15.0 // indirect
99+
go.uber.org/goleak v1.3.0 // indirect
100+
golang.org/x/sys v0.18.0 // indirect
92101
golang.org/x/text v0.14.0 // indirect
93-
google.golang.org/protobuf v1.33.0 // indirect
102+
google.golang.org/protobuf v1.32.0 // indirect
94103
gopkg.in/yaml.v2 v2.4.0 // indirect
95104
gopkg.in/yaml.v3 v3.0.1 // indirect
96105
)

0 commit comments

Comments
 (0)