Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update prometheus to v2.51.1 #167

Merged
merged 4 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ jobs:
- name: install Go
uses: actions/setup-go@v5
with:
go-version: 1.18.x
go-version: 1.21.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/[email protected]
with:
version: v1.50.1
version: v1.54
5 changes: 2 additions & 3 deletions cmd/mixtool/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"

Expand Down Expand Up @@ -143,15 +142,15 @@ func generateAlerts(filename string, options mixer.GenerateOptions) error {
return err
}

return ioutil.WriteFile(options.AlertsFilename, out, 0644)
return os.WriteFile(options.AlertsFilename, out, 0644)
}

func generateRules(filename string, options mixer.GenerateOptions) error {
out, err := mixer.GenerateRules(filename, options)
if err != nil {
return err
}
return ioutil.WriteFile(options.RulesFilename, out, 0644)
return os.WriteFile(options.RulesFilename, out, 0644)
}

func generateDashboards(filename string, opts mixer.GenerateOptions) error {
Expand Down
4 changes: 2 additions & 2 deletions cmd/mixtool/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package main
import (
"bytes"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -145,7 +145,7 @@ func putMixin(content []byte, bindAddress string) error {
if resp.StatusCode == 200 {
fmt.Println("PUT alerts OK")
} else {
responseData, err := ioutil.ReadAll(resp.Body)
responseData, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("failed to response body in putMixin, %w", err)
}
Expand Down
7 changes: 3 additions & 4 deletions cmd/mixtool/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package main

import (
"fmt"
"io/ioutil"
"os"
"path"
"testing"
Expand Down Expand Up @@ -48,9 +47,9 @@ func TestInstallMixin(t *testing.T) {
}

func testInstallMixin(t *testing.T, m mixin) {
tmpdir, err := ioutil.TempDir("", "mixtool-install")
tmpdir, err := os.CreateTemp("", "mixtool-install")
assert.NoError(t, err)
defer os.RemoveAll(tmpdir)
defer os.RemoveAll(tmpdir.Name())

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

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

err = os.Mkdir(dldir, 0755)
assert.NoError(t, err)
Expand Down
8 changes: 4 additions & 4 deletions cmd/mixtool/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -68,7 +68,7 @@ func queryWebsite(mixinsWebsite string) ([]byte, error) {
return nil, err
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
body, err := io.ReadAll(res.Body)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -129,7 +129,7 @@ func listAction(c *cli.Context) error {
if err != nil {
return err
}
body, err = ioutil.ReadFile(path)
body, err = os.ReadFile(path)
if err != nil {
return err
}
Expand All @@ -149,6 +149,6 @@ func listAction(c *cli.Context) error {
if err != nil {
return err
}

return printMixins(mixins)
}
7 changes: 3 additions & 4 deletions cmd/mixtool/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package main

import (
"io/ioutil"
"os"
"testing"

Expand Down Expand Up @@ -47,14 +46,14 @@ const exampleMixins = `
`

func TestList(t *testing.T) {
tempFile, err := ioutil.TempFile("", "exampleMixinsTest.json")
tempFile, err := os.CreateTemp("", "exampleMixinsTest.json")
assert.NoError(t, err)
defer os.Remove(tempFile.Name())

err = ioutil.WriteFile(tempFile.Name(), []byte(exampleMixins), 0644)
err = os.WriteFile(tempFile.Name(), []byte(exampleMixins), 0644)
assert.NoError(t, err)

body, err := ioutil.ReadFile(tempFile.Name())
body, err := os.ReadFile(tempFile.Name())
assert.NoError(t, err)

mixins, err := parseMixinJSON([]byte(body))
Expand Down
7 changes: 3 additions & 4 deletions cmd/mixtool/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -99,12 +98,12 @@ type ruleProvisioner struct {
// to existing, does not provision them. It returns whether Prometheus should
// be reloaded and if an error has occurred.
func (p *ruleProvisioner) provision(r io.Reader) (bool, error) {
newData, err := ioutil.ReadAll(r)
newData, err := io.ReadAll(r)
if err != nil {
return false, fmt.Errorf("unable to read new rules: %w", err)
}

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

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

Expand Down
73 changes: 41 additions & 32 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
module github.com/monitoring-mixins/mixtool

go 1.18
go 1.21

toolchain go1.22.1

require (
github.com/fatih/color v1.16.0
github.com/grafana/dashboard-linter v0.0.0-20231114210226-c458893a5731
github.com/prometheus/prometheus v0.47.2
github.com/prometheus/prometheus v0.51.1
)

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.10.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/aws/aws-sdk-go v1.44.302 // indirect
github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 // indirect
github.com/aws/aws-sdk-go v1.50.32 // indirect
github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3 // indirect
github.com/edsrzf/mmap-go v1.1.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gobuffalo/logger v1.0.6 // indirect
github.com/gobuffalo/packd v1.0.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang-jwt/jwt/v5 v5.2.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/karrick/godirwalk v1.17.0 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/markbates/errx v1.1.0 // indirect
github.com/markbates/oncer v1.0.0 // indirect
Expand All @@ -44,23 +49,28 @@ require (
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/prometheus/common/sigv4 v0.1.0 // indirect
github.com/rs/zerolog v1.30.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/stretchr/objx v0.5.2 // indirect
go.opentelemetry.io/otel v1.16.0 // indirect
go.opentelemetry.io/otel/metric v1.16.0 // indirect
go.opentelemetry.io/otel/trace v1.16.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/term v0.15.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
k8s.io/apimachinery v0.29.2 // indirect
k8s.io/client-go v0.29.2 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

Expand All @@ -77,20 +87,19 @@ require (
github.com/google/go-jsonnet v0.20.0
github.com/grafana/tanka v0.26.0
github.com/jsonnet-bundler/jsonnet-bundler v0.5.1
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.0 // indirect
github.com/prometheus/client_golang v1.19.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.49.1-0.20240306132007-4199f18c3e92 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/stretchr/testify v1.9.0
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/goleak v1.2.1 // indirect
golang.org/x/sys v0.15.0 // indirect
go.uber.org/goleak v1.3.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Expand Down
Loading