Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
chore(deps): qualify the Prometheus dependency update
pulse-triage[bot]ab21ae4503b7
diff --git a/go.mod b/go.modindex 766b9b784a..83860ba101 100644--- a/go.mod+++ b/go.mod@@ -15,12 +15,14 @@ require (github.com/google/uuid v1.6.0github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674github.com/joho/godotenv v1.5.1+ github.com/klauspost/compress v1.19.1github.com/moby/moby/api v1.56.0github.com/moby/moby/client v0.6.0github.com/oklog/ulid/v2 v2.1.1github.com/opencontainers/image-spec v1.1.1- github.com/prometheus/client_golang v1.23.2- github.com/prometheus/client_model v0.6.2+ github.com/prometheus/client_golang v1.24.1+ github.com/prometheus/client_model v0.6.3+ github.com/prometheus/common v0.70.1github.com/rs/dnscache v0.0.0-20230804202142-fc85eb664529github.com/rs/zerolog v1.35.1github.com/shirou/gopsutil/v4 v4.26.6@@ -77,7 +79,6 @@ require (github.com/jonboulle/clockwork v0.5.0 // indirectgithub.com/josharian/intern v1.0.0 // indirectgithub.com/json-iterator/go v1.1.12 // indirect- github.com/klauspost/compress v1.18.2 // indirectgithub.com/kylelemons/godebug v1.1.0 // indirectgithub.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirectgithub.com/mailru/easyjson v0.7.7 // indirect@@ -93,8 +94,7 @@ require (github.com/pkg/errors v0.9.1 // indirectgithub.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirectgithub.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect- github.com/prometheus/common v0.67.4 // indirect- github.com/prometheus/procfs v0.19.2 // indirect+ github.com/prometheus/procfs v0.21.1 // indirectgithub.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirectgithub.com/russellhaering/goxmldsig v1.6.0 // indirectgithub.com/spf13/pflag v1.0.10 // indirect@@ -113,7 +113,7 @@ require (golang.org/x/net v0.57.0 // indirectgolang.org/x/text v0.41.0 // indirectgolang.org/x/time v0.15.0 // indirect- google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect+ google.golang.org/protobuf v1.36.12 // indirectgopkg.in/evanphx/json-patch.v4 v4.13.0 // indirectgopkg.in/inf.v0 v0.9.1 // indirectk8s.io/klog/v2 v2.140.0 // indirectdiff --git a/go.sum b/go.sumindex 348932b7a7..c3c106196b 100644--- a/go.sum+++ b/go.sum@@ -119,6 +119,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrgithub.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=github.com/klauspost/compress v1.18.2 h1:iiPHWW0YrcFgpBYhsA6D1+fqHssJscY/Tm/y2Uqnapk=github.com/klauspost/compress v1.18.2/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=+github.com/klauspost/compress v1.19.1 h1:VsB4HPswih7mmZ8WleSFQ75c/Ui1M4trX5oAsJnhSlk=+github.com/klauspost/compress v1.19.1/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=@@ -170,12 +172,20 @@ github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVtgithub.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=+github.com/prometheus/client_golang v1.24.1 h1:JnJkREXzWxUdCuPFpIWZiPispT9xVV59uiuyR2bPlnU=+github.com/prometheus/client_golang v1.24.1/go.mod h1:F+oSRECHg4sse5ucfYpYDeIv/hu68Zo0uoHKetWnzcE=github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=+github.com/prometheus/client_model v0.6.3 h1:O0jaTVAYNxTHYInEPFJt5I3+sN8zqBtVMPTB1qyxiEo=+github.com/prometheus/client_model v0.6.3/go.mod h1:gpN5P9S7Rr6Yr92PiQ+Ixvhf6JZEkF1dnxsYL2aPBEM=github.com/prometheus/common v0.67.4 h1:yR3NqWO1/UyO1w2PhUvXlGQs/PtFmoveVO0KZ4+Lvsc=github.com/prometheus/common v0.67.4/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI=+github.com/prometheus/common v0.70.1 h1:1HvjP4D5oL3t8RsPlwxA9onvvStjtIHYE5XuuwOi/PY=+github.com/prometheus/common v0.70.1/go.mod h1:VdFUQDMZK3VLkurFUVhia6uys/0suUp86TJz5qbJRhc=github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws=github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw=+github.com/prometheus/procfs v0.21.1 h1:GljZCt+zSTS+NZq88cyQ1LjZ+RCHp3uVuabBWA5+OJI=+github.com/prometheus/procfs v0.21.1/go.mod h1:aB55Cww9pdSJVHk0hUf0inxWyyjPogFIjmHKYgMKmtY=github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=@@ -269,6 +279,8 @@ golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lkgolang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af h1:+5/Sw3GsDNlEmu7TfklWKPdQ0Ykja5VEmq2i817+jbI=google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=+google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=+google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=diff --git a/pkg/server/metrics_wire_test.go b/pkg/server/metrics_wire_test.gonew file mode 100644index 0000000000..168d6c0da5--- /dev/null+++ b/pkg/server/metrics_wire_test.go@@ -0,0 +1,126 @@+package server++import (+ "bytes"+ "compress/gzip"+ "io"+ "net/http/httptest"+ "testing"++ "github.com/klauspost/compress/zstd"+ "github.com/prometheus/client_golang/prometheus"+ "github.com/prometheus/client_golang/prometheus/promhttp"+ dto "github.com/prometheus/client_model/go"+ "github.com/prometheus/common/expfmt"+ "github.com/rcourtman/pulse-go-rewrite/pkg/metrics"+)++// Exercise the same handler used by Pulse's metrics server, with actual Pulse+// collectors. Unsupported zstd requests retain the identity fallback; Pulse+// does not opt into promhttp/zstd. Protobuf remains a transitive dependency.+func TestAlertExporterWireFormats(t *testing.T) {+ const kind = "wire_contract"+ metrics.AlertsActive.WithLabelValues("warning", kind).Set(7)+ t.Cleanup(func() { metrics.AlertsActive.DeleteLabelValues("warning", kind) })+ registry := prometheus.NewPedanticRegistry()+ registry.MustRegister(metrics.AlertsActive)+ if err := registry.Register(metrics.AlertsActive); err == nil {+ t.Fatal("duplicate collector registration accepted")+ }+ handler := promhttp.HandlerFor(registry, promhttp.HandlerOpts{})+ for _, format := range []struct{ name, accept string }{+ {"text", "text/plain; version=0.0.4"},+ {"protobuf", "application/vnd.google.protobuf; proto=io.prometheus.client.MetricFamily; encoding=delimited"},+ } {+ for _, encoding := range []string{"identity", "gzip", "zstd"} {+ t.Run(format.name+"/"+encoding, func(t *testing.T) {+ request := httptest.NewRequest("GET", "/metrics", nil)+ request.Header.Set("Accept", format.accept)+ request.Header.Set("Accept-Encoding", encoding)+ response := httptest.NewRecorder()+ handler.ServeHTTP(response, request)+ if response.Code != 200 {+ t.Fatalf("status: %d: %s", response.Code, response.Body)+ }+ var body io.Reader = response.Body+ switch encoding {+ case "gzip":+ if response.Header().Get("Content-Encoding") != encoding {+ t.Fatal("gzip not negotiated")+ }+ reader, err := gzip.NewReader(body)+ if err != nil {+ t.Fatal(err)+ }+ defer reader.Close()+ body = reader+ default:+ if response.Header().Get("Content-Encoding") != "" {+ t.Fatal("unexpected compression")+ }+ }+ negotiated := expfmt.ResponseFormat(response.Header())+ if format.name == "protobuf" && negotiated.FormatType() != expfmt.TypeProtoDelim {+ t.Fatalf("not protobuf: %s", negotiated)+ }+ if format.name == "text" && negotiated.FormatType() != expfmt.TypeTextPlain {+ t.Fatalf("not text: %s", negotiated)+ }+ decoder := expfmt.NewDecoder(body, negotiated)+ family := &dto.MetricFamily{}+ if err := decoder.Decode(family); err != nil {+ t.Fatal(err)+ }+ if family.GetName() != "pulse_alerts_active" || family.GetType() != dto.MetricType_GAUGE {+ t.Fatalf("unexpected family: %v", family)+ }+ found := false+ for _, metric := range family.Metric {+ labels := map[string]string{}+ for _, label := range metric.Label {+ labels[label.GetName()] = label.GetValue()+ }+ if labels["type"] == kind && labels["level"] == "warning" {+ found = true+ if len(labels) != 2 || metric.GetGauge().GetValue() != 7 {+ t.Fatalf("changed sample: %v", metric)+ }+ }+ }+ if !found {+ t.Fatal("Pulse labelled sample missing")+ }+ if err := decoder.Decode(&dto.MetricFamily{}); err != io.EOF {+ t.Fatalf("trailing decode: %v", err)+ }+ })+ }+ }+}++// The module requires klauspost/compress even though Pulse does not enable+// promhttp's optional zstd integration. Qualify the codec without enabling it.+func TestOptionalExporterZstdCodec(t *testing.T) {+ payload := []byte("pulse_alerts_active{level=\"warning\",type=\"wire_contract\"} 7\n")+ writer, err := zstd.NewWriter(nil)+ if err != nil {+ t.Fatal(err)+ }+ defer writer.Close()+ encoded := writer.EncodeAll(payload, nil)+ reader, err := zstd.NewReader(nil)+ if err != nil {+ t.Fatal(err)+ }+ defer reader.Close()+ decoded, err := reader.DecodeAll(encoded, nil)+ if err != nil {+ t.Fatal(err)+ }+ if !bytes.Equal(decoded, payload) {+ t.Fatal("zstd round trip changed payload")+ }+ if _, err := reader.DecodeAll([]byte("not a zstd frame"), nil); err == nil {+ t.Fatal("invalid frame accepted")+ }+}