From ca5d91d5945ea1b8e6cc25575297d744b93328ec Mon Sep 17 00:00:00 2001 From: Paschalis Tsilias Date: Wed, 4 Oct 2023 18:17:21 +0300 Subject: [PATCH] go.mod: update Prometheus to v2.46.0 with retry behavior cherry-picks (#5355) Signed-off-by: Paschalis Tsilias --- CHANGELOG.md | 2 ++ component/common/loki/wal/wal.go | 2 +- component/prometheus/receive_http/receive_http.go | 2 +- go.mod | 7 ++++--- go.sum | 12 ++++++------ pkg/agentctl/waltools/walstats_test.go | 2 +- pkg/metrics/http.go | 2 +- pkg/metrics/wal/wal.go | 2 +- 8 files changed, 17 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 787dd4946f7c..2eb6bc33c851 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -147,6 +147,8 @@ Main (unreleased) of each node separately, instead of all the directly and indirectly dependant nodes. (@thampiotr) +- Update Prometheus dependency to v2.46.0. (@tpaschalis) + ### Bugfixes - Fixed `otelcol.exporter.prometheus` label names for the `otel_scope_info` diff --git a/component/common/loki/wal/wal.go b/component/common/loki/wal/wal.go index 675ac52c35e2..384e98235e6d 100644 --- a/component/common/loki/wal/wal.go +++ b/component/common/loki/wal/wal.go @@ -37,7 +37,7 @@ type wrapper struct { func New(cfg Config, log log.Logger, registerer prometheus.Registerer) (WAL, error) { // TODO: We should fine-tune the WAL instantiated here to allow some buffering of written entries, but not written to disk // yet. This will attest for the lack of buffering in the channel Writer exposes. - tsdbWAL, err := wlog.NewSize(log, registerer, cfg.Dir, wlog.DefaultSegmentSize, false) + tsdbWAL, err := wlog.NewSize(log, registerer, cfg.Dir, wlog.DefaultSegmentSize, wlog.CompressionNone) if err != nil { return nil, fmt.Errorf("failde to create tsdb WAL: %w", err) } diff --git a/component/prometheus/receive_http/receive_http.go b/component/prometheus/receive_http/receive_http.go index eba12ecb9759..526488ce7fd6 100644 --- a/component/prometheus/receive_http/receive_http.go +++ b/component/prometheus/receive_http/receive_http.go @@ -59,7 +59,7 @@ func New(opts component.Options, args Arguments) (*Component, error) { c := &Component{ opts: opts, - handler: remote.NewWriteHandler(opts.Logger, fanout), + handler: remote.NewWriteHandler(opts.Logger, opts.Registerer, fanout), fanout: fanout, uncheckedCollector: uncheckedCollector, } diff --git a/go.mod b/go.mod index 17abf2e70658..369628711844 100644 --- a/go.mod +++ b/go.mod @@ -56,7 +56,8 @@ require ( github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2 github.com/grafana/dskit v0.0.0-20230829141140-06955c011ffd github.com/grafana/go-gelf/v2 v2.0.1 - github.com/grafana/loki v1.6.2-0.20230927083715-42fba5b19183 // k169 branch + // Loki main commit where the Prometheus dependency matches ours. TODO(@tpaschalis) Update to kXYZ branch once it's available + github.com/grafana/loki v1.6.2-0.20231004111112-07cbef92268a github.com/grafana/pyroscope-go/godeltaprof v0.1.3 github.com/grafana/pyroscope/api v0.2.0 github.com/grafana/pyroscope/ebpf v0.2.3 @@ -427,7 +428,6 @@ require ( github.com/hashicorp/vault/sdk v0.5.1 // indirect github.com/hashicorp/vic v1.5.1-0.20190403131502-bbfe86ec9443 // indirect github.com/hashicorp/yamux v0.0.0-20190923154419-df201c70410d // indirect - github.com/hetznercloud/hcloud-go v1.45.1 // indirect github.com/hodgesds/perf-utils v0.7.0 // indirect github.com/huandu/xstrings v1.3.3 // indirect github.com/iancoleman/strcase v0.3.0 // indirect @@ -632,6 +632,7 @@ require ( github.com/Workiva/go-datastructures v1.1.0 // indirect github.com/drone/envsubst v1.0.3 // indirect github.com/google/gnostic-models v0.6.8 // indirect + github.com/hetznercloud/hcloud-go/v2 v2.0.0 // indirect github.com/julienschmidt/httprouter v1.3.0 // indirect github.com/knadh/koanf/v2 v2.0.1 // indirect github.com/leoluk/perflib_exporter v0.2.0 // indirect @@ -677,7 +678,7 @@ replace ( // prometheus/prometheus#12677 and prometheus/prometheus#12729. // We use the last v1-related tag as the replace statement does not work for v2 // tags without the v2 suffix to the module root -replace github.com/prometheus/prometheus => github.com/grafana/prometheus v1.8.2-0.20231002111159-38991b77eb53 // grafana:prometheus:v0.45.0-retry-improvements +replace github.com/prometheus/prometheus => github.com/grafana/prometheus v1.8.2-0.20231003113207-17e15326a784 // grafana:prometheus:v0.46.0-retry-improvements replace gopkg.in/yaml.v2 => github.com/rfratto/go-yaml v0.0.0-20211119180816-77389c3526dc diff --git a/go.sum b/go.sum index aa5842e43470..32a65a7c12d4 100644 --- a/go.sum +++ b/go.sum @@ -1059,8 +1059,8 @@ github.com/grafana/go-gelf/v2 v2.0.1/go.mod h1:lexHie0xzYGwCgiRGcvZ723bSNyNI8ZRD github.com/grafana/gocql v0.0.0-20200605141915-ba5dc39ece85/go.mod h1:crI9WX6p0IhrqB+DqIUHulRW853PaNFf7o4UprV//3I= github.com/grafana/gomemcache v0.0.0-20230316202710-a081dae0aba9 h1:WB3bGH2f1UN6jkd6uAEWfHB8OD7dKJ0v2Oo6SNfhpfQ= github.com/grafana/gomemcache v0.0.0-20230316202710-a081dae0aba9/go.mod h1:PGk3RjYHpxMM8HFPhKKo+vve3DdlPUELZLSDEFehPuU= -github.com/grafana/loki v1.6.2-0.20230927083715-42fba5b19183 h1:klVM7g0Tl31QSd9dvypCe5XAQ49AM+acGAH2DwXdllA= -github.com/grafana/loki v1.6.2-0.20230927083715-42fba5b19183/go.mod h1:hiGUcnMCZ86m122rzu8xySnRiGDQ8TzPowVmCvWZAJ4= +github.com/grafana/loki v1.6.2-0.20231004111112-07cbef92268a h1:lvSHlNONeo/H+aWRk86QEfBpRDCEX1yoqpsCK0Tys+g= +github.com/grafana/loki v1.6.2-0.20231004111112-07cbef92268a/go.mod h1:a5c5ZTC6FNufKkvF8NeDAb2nCWJpgkVDrejmV+O9hac= github.com/grafana/loki/pkg/push v0.0.0-20230904153656-e4cc2a4f5ec8 h1:yQK/dX7WBva5QvITvmIcbv4boLwSo65a8zjuZcucnko= github.com/grafana/loki/pkg/push v0.0.0-20230904153656-e4cc2a4f5ec8/go.mod h1:5ll3An1wAxYejo6aM04+3/lc6N4joYVYLY5U+Z4O6vI= github.com/grafana/mysqld_exporter v0.12.2-0.20201015182516-5ac885b2d38a h1:D5NSR64/6xMXnSFD9y1m1DPYIcBcHvtfeuI9/M/0qtI= @@ -1071,8 +1071,8 @@ github.com/grafana/perflib_exporter v0.1.1-0.20230511173423-6166026bd090 h1:Ko80 github.com/grafana/perflib_exporter v0.1.1-0.20230511173423-6166026bd090/go.mod h1:MinSWm88jguXFFrGsP56PtleUb4Qtm4tNRH/wXNXRTI= github.com/grafana/postgres_exporter v0.8.1-0.20210722175051-db35d7c2f520 h1:HnFWqxhoSF3WC7sKAdMZ+SRXvHLVZlZ3sbQjuUlTqkw= github.com/grafana/postgres_exporter v0.8.1-0.20210722175051-db35d7c2f520/go.mod h1:+HPXgiOV0InDHcZ2jNijL1SOKvo0eEPege5fQA0+ICI= -github.com/grafana/prometheus v1.8.2-0.20231002111159-38991b77eb53 h1:nX3bUvvnjugac9y7RyxNAG/yNLGR8xSExqwWwVFQ1yk= -github.com/grafana/prometheus v1.8.2-0.20231002111159-38991b77eb53/go.mod h1:jC5hyO8ItJBnDWGecbEucMyXjzxGv9cxsxsjS9u5s1w= +github.com/grafana/prometheus v1.8.2-0.20231003113207-17e15326a784 h1:B8AAFKq7WQPUYdoGwWjgxFARn5XodYlKJNHCYUopah8= +github.com/grafana/prometheus v1.8.2-0.20231003113207-17e15326a784/go.mod h1:10L5IJE5CEsjee1FnOcVswYXlPIscDWWt3IJ2UDYrz4= github.com/grafana/pyroscope-go/godeltaprof v0.1.3 h1:eunWpv1B3Z7ZK9o4499EmQGlY+CsDmSZ4FbxjRx37uk= github.com/grafana/pyroscope-go/godeltaprof v0.1.3/go.mod h1:1HSPtjU8vLG0jE9JrTdzjgFqdJ/VgN7fvxBNq3luJko= github.com/grafana/pyroscope/api v0.2.0 h1:TzOxL0s6SiaLEy944ZAKgHcx/JDRJXu4O8ObwkqR6p4= @@ -1271,8 +1271,8 @@ github.com/hashicorp/yamux v0.0.0-20190923154419-df201c70410d h1:W+SIwDdl3+jXWei github.com/hashicorp/yamux v0.0.0-20190923154419-df201c70410d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/heroku/x v0.0.61 h1:yfoAAtnFWSFZj+UlS+RZL/h8QYEp1R4wHVEg0G+Hwh4= github.com/heroku/x v0.0.61/go.mod h1:C7xYbpMdond+s6L5VpniDUSVPRwm3kZum1o7XiD5ZHk= -github.com/hetznercloud/hcloud-go v1.45.1 h1:nl0OOklFfQT5J6AaNIOhl5Ruh3fhmGmhvZEqHbibVuk= -github.com/hetznercloud/hcloud-go v1.45.1/go.mod h1:aAUGxSfSnB8/lVXHNEDxtCT1jykaul8kqjD7f5KQXF8= +github.com/hetznercloud/hcloud-go/v2 v2.0.0 h1:Sg1DJ+MAKvbYAqaBaq9tPbwXBS2ckPIaMtVdUjKu+4g= +github.com/hetznercloud/hcloud-go/v2 v2.0.0/go.mod h1:4iUG2NG8b61IAwNx6UsMWQ6IfIf/i1RsG0BbsKAyR5Q= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= github.com/hjson/hjson-go/v4 v4.0.0/go.mod h1:KaYt3bTw3zhBjYqnXkYywcYctk0A2nxeEFTse3rH13E= diff --git a/pkg/agentctl/waltools/walstats_test.go b/pkg/agentctl/waltools/walstats_test.go index f3a9dea7eaac..cb0a0e42b09c 100644 --- a/pkg/agentctl/waltools/walstats_test.go +++ b/pkg/agentctl/waltools/walstats_test.go @@ -51,7 +51,7 @@ func setupTestWAL(t *testing.T) string { walDir := t.TempDir() reg := prometheus.NewRegistry() - w, err := wlog.NewSize(log.NewNopLogger(), reg, filepath.Join(walDir, "wal"), wlog.DefaultSegmentSize, true) + w, err := wlog.NewSize(log.NewNopLogger(), reg, filepath.Join(walDir, "wal"), wlog.DefaultSegmentSize, wlog.CompressionSnappy) require.NoError(t, err) defer w.Close() diff --git a/pkg/metrics/http.go b/pkg/metrics/http.go index 434996428609..6f7f673066ad 100644 --- a/pkg/metrics/http.go +++ b/pkg/metrics/http.go @@ -151,7 +151,7 @@ func (a *Agent) PushMetricsHandler(w http.ResponseWriter, r *http.Request) { return } - handler := remote.NewWriteHandler(a.logger, managedInstance) + handler := remote.NewWriteHandler(a.logger, a.reg, managedInstance) handler.ServeHTTP(w, r) } diff --git a/pkg/metrics/wal/wal.go b/pkg/metrics/wal/wal.go index 724b08e1cad3..13c0b441d437 100644 --- a/pkg/metrics/wal/wal.go +++ b/pkg/metrics/wal/wal.go @@ -145,7 +145,7 @@ type Storage struct { // NewStorage makes a new Storage. func NewStorage(logger log.Logger, registerer prometheus.Registerer, path string) (*Storage, error) { - w, err := wlog.NewSize(logger, registerer, SubDirectory(path), wlog.DefaultSegmentSize, true) + w, err := wlog.NewSize(logger, registerer, SubDirectory(path), wlog.DefaultSegmentSize, wlog.CompressionSnappy) if err != nil { return nil, err }