From 39b800df6ba00cd6b0e264ee976c45e65a878339 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 22 Aug 2024 10:25:13 +0000 Subject: [PATCH] fix(deps): update github.com/grafana/dskit digest to f25f206 --- go.mod | 2 +- go.sum | 4 +-- tools/lambda-promtail/go.mod | 2 +- tools/lambda-promtail/go.sum | 4 +-- .../grafana/dskit/httpgrpc/httpgrpc.go | 13 ++++++-- .../grafana/dskit/ring/replication_set.go | 2 +- .../grafana/dskit/runtimeconfig/manager.go | 32 +++++++++++++++++-- vendor/modules.txt | 2 +- 8 files changed, 48 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 5e5556fb96e67..2563d7dc12c22 100644 --- a/go.mod +++ b/go.mod @@ -48,7 +48,7 @@ require ( github.com/gorilla/mux v1.8.1 github.com/gorilla/websocket v1.5.0 github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2 - github.com/grafana/dskit v0.0.0-20240819131358-463219e80ea0 + github.com/grafana/dskit v0.0.0-20240822084815-f25f20668f96 github.com/grafana/go-gelf/v2 v2.0.1 github.com/grafana/gomemcache v0.0.0-20240229205252-cd6a66d6fb56 github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc diff --git a/go.sum b/go.sum index f674513c007b0..6b34bf4295a09 100644 --- a/go.sum +++ b/go.sum @@ -1048,8 +1048,8 @@ github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWm github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2 h1:qhugDMdQ4Vp68H0tp/0iN17DM2ehRo1rLEdOFe/gB8I= github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2/go.mod h1:w/aiO1POVIeXUQyl0VQSZjl5OAGDTL5aX+4v0RA1tcw= -github.com/grafana/dskit v0.0.0-20240819131358-463219e80ea0 h1:iMShjkEYATnBMbEa2wV4QiK5PU2trw24FOCON3v7+K4= -github.com/grafana/dskit v0.0.0-20240819131358-463219e80ea0/go.mod h1:c4ASJAo1QFmXGydDzNed2o0+Fncx+x4YmQ1r9HfYU3c= +github.com/grafana/dskit v0.0.0-20240822084815-f25f20668f96 h1:8WSVfqXC2S1bQLu30TsKfW7e+1ArAr4j5TQEFaVcB74= +github.com/grafana/dskit v0.0.0-20240822084815-f25f20668f96/go.mod h1:c4ASJAo1QFmXGydDzNed2o0+Fncx+x4YmQ1r9HfYU3c= github.com/grafana/go-gelf/v2 v2.0.1 h1:BOChP0h/jLeD+7F9mL7tq10xVkDG15he3T1zHuQaWak= github.com/grafana/go-gelf/v2 v2.0.1/go.mod h1:lexHie0xzYGwCgiRGcvZ723bSNyNI8ZRD4s0CLobh90= github.com/grafana/gocql v0.0.0-20200605141915-ba5dc39ece85 h1:xLuzPoOzdfNb/RF/IENCw+oLVdZB4G21VPhkHBgwSHY= diff --git a/tools/lambda-promtail/go.mod b/tools/lambda-promtail/go.mod index fb35609574b72..c6a9c3aa40a22 100644 --- a/tools/lambda-promtail/go.mod +++ b/tools/lambda-promtail/go.mod @@ -10,7 +10,7 @@ require ( github.com/go-kit/log v0.2.1 github.com/gogo/protobuf v1.3.2 github.com/golang/snappy v0.0.4 - github.com/grafana/dskit v0.0.0-20240814201308-442170dfed1b + github.com/grafana/dskit v0.0.0-20240822084815-f25f20668f96 github.com/grafana/loki/v3 v3.0.0-20240809103847-9315b3d03d79 github.com/prometheus/common v0.55.0 github.com/stretchr/testify v1.9.0 diff --git a/tools/lambda-promtail/go.sum b/tools/lambda-promtail/go.sum index 2627682cc9454..3e22ce97e7032 100644 --- a/tools/lambda-promtail/go.sum +++ b/tools/lambda-promtail/go.sum @@ -216,8 +216,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= -github.com/grafana/dskit v0.0.0-20240814201308-442170dfed1b h1:w3iQfdftNWfmU86f3Y4Cjzjx/+3AnKfpXzzq2cV8H/Y= -github.com/grafana/dskit v0.0.0-20240814201308-442170dfed1b/go.mod h1:c4ASJAo1QFmXGydDzNed2o0+Fncx+x4YmQ1r9HfYU3c= +github.com/grafana/dskit v0.0.0-20240822084815-f25f20668f96 h1:8WSVfqXC2S1bQLu30TsKfW7e+1ArAr4j5TQEFaVcB74= +github.com/grafana/dskit v0.0.0-20240822084815-f25f20668f96/go.mod h1:c4ASJAo1QFmXGydDzNed2o0+Fncx+x4YmQ1r9HfYU3c= github.com/grafana/gomemcache v0.0.0-20240229205252-cd6a66d6fb56 h1:X8IKQ0wu40wpvYcKfBcc5T4QnhdQjUhtUtB/1CY89lE= github.com/grafana/gomemcache v0.0.0-20240229205252-cd6a66d6fb56/go.mod h1:PGk3RjYHpxMM8HFPhKKo+vve3DdlPUELZLSDEFehPuU= github.com/grafana/jsonparser v0.0.0-20240425183733-ea80629e1a32 h1:NznuPwItog+rwdVg8hAuGKP29ndRSzJAwhxKldkP8oQ= diff --git a/vendor/github.com/grafana/dskit/httpgrpc/httpgrpc.go b/vendor/github.com/grafana/dskit/httpgrpc/httpgrpc.go index 02e6e493736b4..616023899b7ec 100644 --- a/vendor/github.com/grafana/dskit/httpgrpc/httpgrpc.go +++ b/vendor/github.com/grafana/dskit/httpgrpc/httpgrpc.go @@ -106,16 +106,23 @@ func FromHeader(hs http.Header) []*Header { return result } -// Errorf returns a HTTP gRPC error than is correctly forwarded over +// Error returns a HTTP gRPC error that is correctly forwarded over // gRPC, and can eventually be converted back to a HTTP response with // HTTPResponseFromError. -func Errorf(code int, tmpl string, args ...interface{}) error { +func Error(code int, msg string) error { return ErrorFromHTTPResponse(&HTTPResponse{ Code: int32(code), - Body: []byte(fmt.Sprintf(tmpl, args...)), + Body: []byte(msg), }) } +// Errorf returns a HTTP gRPC error that is correctly forwarded over +// gRPC, and can eventually be converted back to a HTTP response with +// HTTPResponseFromError. +func Errorf(code int, tmpl string, args ...interface{}) error { + return Error(code, fmt.Sprintf(tmpl, args...)) +} + // ErrorFromHTTPResponse converts an HTTP response into a grpc error, and uses HTTP response body as an error message. // Note that if HTTP response body contains non-utf8 string, then returned error cannot be marshalled by protobuf. func ErrorFromHTTPResponse(resp *HTTPResponse) error { diff --git a/vendor/github.com/grafana/dskit/ring/replication_set.go b/vendor/github.com/grafana/dskit/ring/replication_set.go index ffdcf80ab5268..ae37820202561 100644 --- a/vendor/github.com/grafana/dskit/ring/replication_set.go +++ b/vendor/github.com/grafana/dskit/ring/replication_set.go @@ -316,7 +316,7 @@ func DoUntilQuorumWithoutSuccessfulContextCancellation[T any](ctx context.Contex ext.Error.Set(cfg.Logger.Span, true) } - contextTracker.cancelAllContexts(cancellation.NewErrorf(cause)) + contextTracker.cancelAllContexts(cancellation.NewError(errors.New(cause))) cleanupResultsAlreadyReceived() return nil, err } diff --git a/vendor/github.com/grafana/dskit/runtimeconfig/manager.go b/vendor/github.com/grafana/dskit/runtimeconfig/manager.go index 84b69de766d00..e74d011d99501 100644 --- a/vendor/github.com/grafana/dskit/runtimeconfig/manager.go +++ b/vendor/github.com/grafana/dskit/runtimeconfig/manager.go @@ -2,12 +2,14 @@ package runtimeconfig import ( "bytes" + "compress/gzip" "context" "crypto/sha256" "flag" "fmt" "io" "os" + "strings" "sync" "time" @@ -183,8 +185,8 @@ func (om *Manager) loadConfig() error { mergedConfig := map[string]interface{}{} for _, f := range om.cfg.LoadPath { - yamlFile := map[string]interface{}{} - err := yaml.Unmarshal(rawData[f], &yamlFile) + data := rawData[f] + yamlFile, err := om.unmarshalMaybeGzipped(f, data) if err != nil { om.configLoadSuccess.Set(0) return errors.Wrapf(err, "unmarshal file %q", f) @@ -218,6 +220,32 @@ func (om *Manager) loadConfig() error { return nil } +func (om *Manager) unmarshalMaybeGzipped(filename string, data []byte) (map[string]any, error) { + yamlFile := map[string]any{} + if strings.HasSuffix(filename, ".gz") { + r, err := gzip.NewReader(bytes.NewReader(data)) + if err != nil { + return nil, errors.Wrap(err, "read gzipped file") + } + defer r.Close() + err = yaml.NewDecoder(r).Decode(&yamlFile) + return yamlFile, errors.Wrap(err, "uncompress/unmarshal gzipped file") + } + + if err := yaml.Unmarshal(data, &yamlFile); err != nil { + // Give a hint if we think that file is gzipped. + if isGzip(data) { + return nil, errors.Wrap(err, "file looks gzipped but doesn't have a .gz extension") + } + return nil, err + } + return yamlFile, nil +} + +func isGzip(data []byte) bool { + return len(data) > 2 && data[0] == 0x1f && data[1] == 0x8b +} + func mergeConfigMaps(a, b map[string]interface{}) map[string]interface{} { out := make(map[string]interface{}, len(a)) for k, v := range a { diff --git a/vendor/modules.txt b/vendor/modules.txt index e89a1e05b1dcf..cb882b7873e22 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -985,7 +985,7 @@ github.com/gorilla/websocket # github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2 ## explicit; go 1.17 github.com/grafana/cloudflare-go -# github.com/grafana/dskit v0.0.0-20240819131358-463219e80ea0 +# github.com/grafana/dskit v0.0.0-20240822084815-f25f20668f96 ## explicit; go 1.21 github.com/grafana/dskit/aws github.com/grafana/dskit/backoff