From bf34ad1b4998244b8e1f4b7beca89bc163fbc167 Mon Sep 17 00:00:00 2001 From: Arve Knudsen Date: Tue, 17 Aug 2021 15:41:12 +0200 Subject: [PATCH 1/3] Use dskit/backoff Signed-off-by: Arve Knudsen --- CHANGELOG.md | 1 + go.mod | 9 +- go.sum | 61 ++- integration/e2e/composite_service.go | 7 +- integration/e2e/service.go | 11 +- integration/e2e/service_test.go | 9 +- ...tegration_memberlist_single_binary_test.go | 4 +- pkg/chunk/aws/dynamodb_storage_client.go | 7 +- pkg/chunk/aws/dynamodb_table_client.go | 6 +- pkg/chunk/aws/fixtures.go | 4 +- pkg/chunk/aws/retryer.go | 9 +- pkg/compactor/compactor.go | 5 +- pkg/frontend/v2/frontend_scheduler_worker.go | 5 +- pkg/ingester/transfer.go | 4 +- pkg/querier/blocks_finder_bucket_scan.go | 3 +- pkg/querier/worker/frontend_processor.go | 6 +- pkg/querier/worker/scheduler_processor.go | 4 +- pkg/ring/kv/consul/client.go | 8 +- pkg/ring/kv/etcd/etcd.go | 6 +- pkg/ring/kv/memberlist/memberlist_client.go | 6 +- pkg/ring/util.go | 4 +- pkg/storegateway/bucket_stores.go | 4 +- pkg/util/backoff_test.go | 103 ---- pkg/util/grpcclient/backoff_retry.go | 7 +- pkg/util/grpcclient/grpcclient.go | 8 +- tools/blocksconvert/builder/builder.go | 6 +- tools/blocksconvert/cleaner/cleaner.go | 4 +- tools/blocksconvert/scanner/scanner.go | 4 +- .../aws/aws-sdk-go/aws/ec2metadata/service.go | 4 +- .../aws/aws-sdk-go/aws/endpoints/defaults.go | 22 + .../aws-sdk-go/aws/signer/v4/header_rules.go | 16 +- .../aws/aws-sdk-go/aws/signer/v4/v4.go | 11 +- .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../aws-sdk-go/private/protocol/rest/build.go | 2 +- .../aws-sdk-go/private/protocol/timestamp.go | 57 ++- .../coreos/go-systemd/v22/journal/journal.go | 179 ------- .../go-systemd/v22/journal/journal_unix.go | 210 ++++++++ .../go-systemd/v22/journal/journal_windows.go | 35 ++ vendor/github.com/go-kit/kit/log/doc.go | 4 +- .../github.com/go-kit/kit/log/level/level.go | 2 +- vendor/github.com/go-kit/kit/log/log.go | 82 ++- vendor/github.com/go-kit/kit/log/stdlib.go | 45 +- vendor/github.com/go-kit/kit/log/sync.go | 15 +- vendor/github.com/go-kit/kit/log/value.go | 6 +- vendor/github.com/grafana/dskit/LICENSE | 201 ++++++++ .../grafana/dskit/backoff}/backoff.go | 18 +- vendor/github.com/sirupsen/logrus/.travis.yml | 14 +- .../github.com/sirupsen/logrus/CHANGELOG.md | 36 ++ vendor/github.com/sirupsen/logrus/README.md | 2 +- vendor/github.com/sirupsen/logrus/entry.go | 73 +-- vendor/github.com/sirupsen/logrus/go.sum | 2 - .../sirupsen/logrus/json_formatter.go | 5 +- vendor/github.com/sirupsen/logrus/logger.go | 2 +- .../sirupsen/logrus/terminal_check_unix.go | 2 +- .../sirupsen/logrus/text_formatter.go | 7 +- .../go.etcd.io/etcd/api/v3/authpb/auth.pb.go | 20 +- .../etcd/api/v3/etcdserverpb/etcdserver.pb.go | 10 +- .../api/v3/etcdserverpb/raft_internal.pb.go | 20 +- .../etcd/api/v3/etcdserverpb/rpc.pb.go | 483 ++++-------------- .../etcd/api/v3/membershippb/membership.pb.go | 30 +- vendor/go.etcd.io/etcd/api/v3/mvccpb/kv.pb.go | 10 +- .../etcd/api/v3/v3rpc/rpctypes/error.go | 4 + .../go.etcd.io/etcd/api/v3/version/version.go | 2 +- vendor/go.etcd.io/etcd/client/pkg/v3/LICENSE | 202 ++++++++ .../etcd/client/pkg/v3/logutil/doc.go | 16 + .../etcd/client/pkg/v3/logutil/log_level.go | 30 ++ .../etcd/client/pkg/v3/logutil/zap.go | 91 ++++ .../etcd/client/pkg/v3/logutil/zap_journal.go | 93 ++++ .../etcd/{ => client}/pkg/v3/pathutil/path.go | 0 .../go.etcd.io/etcd/client/pkg/v3/srv/srv.go | 142 +++++ .../etcd/client/pkg/v3/systemd/doc.go | 16 + .../etcd/client/pkg/v3/systemd/journal.go | 29 ++ .../etcd/client/pkg/v3/types/doc.go | 17 + .../go.etcd.io/etcd/client/pkg/v3/types/id.go | 39 ++ .../etcd/client/pkg/v3/types/set.go | 195 +++++++ .../etcd/client/pkg/v3/types/slice.go | 22 + .../etcd/client/pkg/v3/types/urls.go | 82 +++ .../etcd/client/pkg/v3/types/urlsmap.go | 107 ++++ vendor/go.etcd.io/etcd/client/v2/client.go | 9 +- vendor/go.etcd.io/etcd/client/v2/discover.go | 2 +- vendor/go.etcd.io/etcd/client/v2/go.mod | 13 +- vendor/go.etcd.io/etcd/client/v2/go.sum | 123 +++-- vendor/go.etcd.io/etcd/client/v2/json.go | 5 +- vendor/go.etcd.io/etcd/client/v2/keys.go | 3 +- vendor/go.etcd.io/etcd/client/v2/members.go | 2 +- vendor/go.etcd.io/etcd/client/v3/README.md | 4 +- vendor/go.etcd.io/etcd/client/v3/client.go | 49 +- vendor/go.etcd.io/etcd/client/v3/cluster.go | 2 +- vendor/go.etcd.io/etcd/client/v3/config.go | 4 + vendor/go.etcd.io/etcd/client/v3/doc.go | 2 +- vendor/go.etcd.io/etcd/client/v3/go.mod | 15 +- vendor/go.etcd.io/etcd/client/v3/go.sum | 182 ++++--- .../client/v3/internal/endpoint/endpoint.go | 2 +- vendor/go.etcd.io/etcd/client/v3/lease.go | 20 +- vendor/go.etcd.io/etcd/client/v3/logger.go | 110 ++-- vendor/go.etcd.io/etcd/client/v3/options.go | 12 +- .../etcd/client/v3/retry_interceptor.go | 16 +- vendor/go.etcd.io/etcd/client/v3/watch.go | 10 +- vendor/go.uber.org/atomic/CHANGELOG.md | 40 +- vendor/go.uber.org/atomic/bool.go | 18 +- vendor/go.uber.org/atomic/bool_ext.go | 2 +- vendor/go.uber.org/atomic/duration.go | 18 +- vendor/go.uber.org/atomic/duration_ext.go | 8 +- vendor/go.uber.org/atomic/error.go | 10 +- vendor/go.uber.org/atomic/float64.go | 17 +- vendor/go.uber.org/atomic/float64_ext.go | 34 +- vendor/go.uber.org/atomic/int32.go | 22 +- vendor/go.uber.org/atomic/int64.go | 22 +- vendor/go.uber.org/atomic/string.go | 10 +- vendor/go.uber.org/atomic/string_ext.go | 2 + vendor/go.uber.org/atomic/time.go | 55 ++ vendor/go.uber.org/atomic/time_ext.go | 36 ++ vendor/go.uber.org/atomic/uint32.go | 22 +- vendor/go.uber.org/atomic/uint64.go | 22 +- vendor/go.uber.org/atomic/uintptr.go | 22 +- vendor/go.uber.org/atomic/unsafe_pointer.go | 14 +- vendor/go.uber.org/multierr/.travis.yml | 10 +- vendor/go.uber.org/multierr/CHANGELOG.md | 6 + vendor/go.uber.org/multierr/Makefile | 6 +- vendor/go.uber.org/multierr/error.go | 2 +- vendor/go.uber.org/multierr/go.mod | 6 +- vendor/go.uber.org/multierr/go.sum | 38 +- vendor/go.uber.org/zap/.travis.yml | 23 - vendor/go.uber.org/zap/CHANGELOG.md | 28 + vendor/go.uber.org/zap/CONTRIBUTING.md | 6 - vendor/go.uber.org/zap/FAQ.md | 8 + vendor/go.uber.org/zap/Makefile | 16 +- vendor/go.uber.org/zap/README.md | 8 +- vendor/go.uber.org/zap/field.go | 10 + vendor/go.uber.org/zap/go.mod | 11 +- vendor/go.uber.org/zap/go.sum | 56 +- vendor/go.uber.org/zap/http_handler.go | 99 +++- vendor/go.uber.org/zap/logger.go | 9 +- vendor/go.uber.org/zap/sugar.go | 27 +- .../zap/zapcore/console_encoder.go | 2 +- vendor/go.uber.org/zap/zapcore/error.go | 19 +- vendor/go.uber.org/zap/zapcore/field.go | 8 +- .../go.uber.org/zap/zapcore/write_syncer.go | 3 +- vendor/go.uber.org/zap/zapgrpc/zapgrpc.go | 241 +++++++++ .../cmd/protoc-gen-go/internal_gengo/main.go | 46 +- .../protobuf/compiler/protogen/protogen.go | 9 +- .../protobuf/encoding/prototext/decode.go | 3 - .../protobuf/internal/encoding/text/encode.go | 5 + .../protobuf/internal/impl/legacy_message.go | 7 + .../protobuf/internal/version/version.go | 4 +- .../reflect/protoregistry/registry.go | 43 +- .../types/descriptorpb/descriptor.pb.go | 82 --- vendor/modules.txt | 33 +- 148 files changed, 3250 insertions(+), 1612 deletions(-) delete mode 100644 pkg/util/backoff_test.go create mode 100644 vendor/github.com/coreos/go-systemd/v22/journal/journal_unix.go create mode 100644 vendor/github.com/coreos/go-systemd/v22/journal/journal_windows.go create mode 100644 vendor/github.com/grafana/dskit/LICENSE rename {pkg/util => vendor/github.com/grafana/dskit/backoff}/backoff.go (87%) create mode 100644 vendor/go.etcd.io/etcd/client/pkg/v3/LICENSE create mode 100644 vendor/go.etcd.io/etcd/client/pkg/v3/logutil/doc.go create mode 100644 vendor/go.etcd.io/etcd/client/pkg/v3/logutil/log_level.go create mode 100644 vendor/go.etcd.io/etcd/client/pkg/v3/logutil/zap.go create mode 100644 vendor/go.etcd.io/etcd/client/pkg/v3/logutil/zap_journal.go rename vendor/go.etcd.io/etcd/{ => client}/pkg/v3/pathutil/path.go (100%) create mode 100644 vendor/go.etcd.io/etcd/client/pkg/v3/srv/srv.go create mode 100644 vendor/go.etcd.io/etcd/client/pkg/v3/systemd/doc.go create mode 100644 vendor/go.etcd.io/etcd/client/pkg/v3/systemd/journal.go create mode 100644 vendor/go.etcd.io/etcd/client/pkg/v3/types/doc.go create mode 100644 vendor/go.etcd.io/etcd/client/pkg/v3/types/id.go create mode 100644 vendor/go.etcd.io/etcd/client/pkg/v3/types/set.go create mode 100644 vendor/go.etcd.io/etcd/client/pkg/v3/types/slice.go create mode 100644 vendor/go.etcd.io/etcd/client/pkg/v3/types/urls.go create mode 100644 vendor/go.etcd.io/etcd/client/pkg/v3/types/urlsmap.go create mode 100644 vendor/go.uber.org/atomic/time.go create mode 100644 vendor/go.uber.org/atomic/time_ext.go delete mode 100644 vendor/go.uber.org/zap/.travis.yml create mode 100644 vendor/go.uber.org/zap/zapgrpc/zapgrpc.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c39cc1e19c..239e3ed8480 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## master / unreleased +* [CHANGE] Use github.com/grafana/dskit/backoff instead of pkg/util/backoff.go. * [CHANGE] Memberlist: Expose default configuration values to the command line options. Note that setting these explicitly to zero will no longer cause the default to be used. If the default is desired, then do set the option. The following are affected: #4276 - `-memberlist.stream-timeout` - `-memberlist.retransmit-factor` diff --git a/go.mod b/go.mod index 448e101d9dc..f9637fe38c4 100644 --- a/go.mod +++ b/go.mod @@ -12,14 +12,14 @@ require ( github.com/alecthomas/units v0.0.0-20210208195552-ff826a37aa15 github.com/alicebob/miniredis/v2 v2.14.3 github.com/armon/go-metrics v0.3.6 - github.com/aws/aws-sdk-go v1.38.60 + github.com/aws/aws-sdk-go v1.38.68 github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b github.com/cespare/xxhash v1.1.0 github.com/dustin/go-humanize v1.0.0 github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb github.com/felixge/fgprof v0.9.1 github.com/fsouza/fake-gcs-server v1.7.0 - github.com/go-kit/kit v0.10.0 + github.com/go-kit/kit v0.11.0 github.com/go-openapi/strfmt v0.20.1 github.com/go-openapi/swag v0.19.15 github.com/go-redis/redis/v8 v8.9.0 @@ -30,6 +30,7 @@ require ( github.com/golang/protobuf v1.5.2 github.com/golang/snappy v0.0.3 github.com/gorilla/mux v1.7.3 + github.com/grafana/dskit v0.0.0-20210817085554-1b69d2de136f github.com/grpc-ecosystem/go-grpc-middleware v1.2.2 github.com/hashicorp/consul/api v1.8.1 github.com/hashicorp/go-cleanhttp v0.5.1 @@ -59,9 +60,9 @@ require ( github.com/weaveworks/common v0.0.0-20210419092856-009d1eebd624 go.etcd.io/bbolt v1.3.5 go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489 - go.etcd.io/etcd/client/v3 v3.5.0-alpha.0.0.20210225194612-fa82d11a958a + go.etcd.io/etcd/client/v3 v3.5.0 go.etcd.io/etcd/server/v3 v3.5.0-alpha.0.0.20210225194612-fa82d11a958a - go.uber.org/atomic v1.8.0 + go.uber.org/atomic v1.9.0 golang.org/x/net v0.0.0-20210610132358-84b48f89b13b golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/time v0.0.0-20210611083556-38a9dc6acbc6 diff --git a/go.sum b/go.sum index 6e64ca13b69..e84c4728fe7 100644 --- a/go.sum +++ b/go.sum @@ -137,7 +137,6 @@ github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZ github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= @@ -257,9 +256,13 @@ github.com/aws/aws-sdk-go v1.35.31/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2z github.com/aws/aws-sdk-go v1.37.8/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go v1.38.3/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go v1.38.35/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= -github.com/aws/aws-sdk-go v1.38.60 h1:MgyEsX0IMwivwth1VwEnesBpH0vxbjp5a0w1lurMOXY= github.com/aws/aws-sdk-go v1.38.60/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= +github.com/aws/aws-sdk-go v1.38.68 h1:aOG8geU4SohNp659eKBHRBgbqSrZ6jNZlfimIuJAwL8= +github.com/aws/aws-sdk-go v1.38.68/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +github.com/aws/aws-sdk-go-v2 v1.7.0/go.mod h1:tb9wi5s61kTDA5qCkcDbt3KRVV74GGslQkl/DRdX/P4= +github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.5.0/go.mod h1:acH3+MQoiMzozT/ivU+DbRg7Ooo2298RdRaWcOv+4vM= +github.com/aws/smithy-go v1.5.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beevik/ntp v0.2.0/go.mod h1:hIHWr+l3+/clUnF44zdK+CWW7fO8dR5cIylAQ76NRpg= github.com/benbjohnson/immutable v0.2.1/go.mod h1:uc6OHo6PN2++n98KHLxW8ef4W42ylHiQSENghE1ezxI= @@ -293,6 +296,7 @@ github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3k github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/cactus/go-statsd-client/statsd v0.0.0-20191106001114-12b4e2b38748/go.mod h1:l/bIBLeOl9eX+wxJAzxS4TveKRtAqlyDpHjhkfO0MEI= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/casbin/casbin/v2 v2.31.6/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg= github.com/cenkalti/backoff v0.0.0-20181003080854-62661b46c409/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff v1.0.0/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= @@ -439,8 +443,9 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU= github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= -github.com/coreos/go-systemd/v22 v22.1.0 h1:kq/SbG2BCKLkDKkjQf5OWwKWUKj1lgs3lFI4PxnR5lg= github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= +github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= @@ -607,8 +612,9 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-kit/kit v0.11.0 h1:IGmIEl7aHTYh6E2HlT+ptILBotjo4xl8PMDl852etiI= +github.com/go-kit/kit v0.11.0/go.mod h1:73/6Ixaufkvb5Osvkls8C79vuQ49Ba1rUEUYNSf+FUw= github.com/go-kit/log v0.1.0 h1:DGJh0Sm43HbOeYDNnVZFl8BvcYVvjD5bqYJvp0REbwQ= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -783,6 +789,7 @@ github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblf github.com/godbus/dbus v0.0.0-20190402143921-271e53dc4968/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= @@ -951,6 +958,8 @@ github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grafana/dskit v0.0.0-20210817085554-1b69d2de136f h1:zCEH60Ej/qD5nISoB2DMwONGQUTZzrSwprY41RX/NqM= +github.com/grafana/dskit v0.0.0-20210817085554-1b69d2de136f/go.mod h1:QaNAQaCSFOtG/NHf6Jd/zh67H25kkrVCq36U61Y2Mhw= github.com/grafana/gocql v0.0.0-20200605141915-ba5dc39ece85 h1:xLuzPoOzdfNb/RF/IENCw+oLVdZB4G21VPhkHBgwSHY= github.com/grafana/gocql v0.0.0-20200605141915-ba5dc39ece85/go.mod h1:crI9WX6p0IhrqB+DqIUHulRW853PaNFf7o4UprV//3I= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= @@ -1083,6 +1092,7 @@ github.com/influxdata/influxdb v1.8.4/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbf github.com/influxdata/influxdb v1.8.5/go.mod h1:oFH+pbEyDln/1TKwa98oJzVrkZwdjrJOwIDGYZj7Ma0= github.com/influxdata/influxdb v1.9.2/go.mod h1:UEe3MeD9AaP5rlPIes102IhYua3FhIWZuOXNHxDjSrI= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/influxdata/influxql v1.1.0/go.mod h1:KpVI7okXjK6PRi3Z5B+mtKZli+R1DnZgb3N+tzevNgo= github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= github.com/influxdata/influxql v1.1.1-0.20210223160523-b6ab99450c93/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= @@ -1153,6 +1163,7 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.12/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.13.1 h1:wXr2uRxZTJXHLly6qhJabee5JqIhTRoLBhDOA74hDEQ= github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= @@ -1263,6 +1274,7 @@ github.com/miekg/dns v1.1.42 h1:gWGe42RGaIqXQZ+r3WUGEKBEtvPHY2SXo4dqixDNxuY= github.com/miekg/dns v1.1.42/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4= github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/mileusna/useragent v0.0.0-20190129205925-3e331f0949a5/go.mod h1:JWhYAp2EXqUtsxTKdeGlY8Wp44M7VxThC9FEoNGi2IE= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/minio/md5-simd v1.1.0 h1:QPfiOqlZH+Cj9teu0t9b1nTBfPbyTl16Of5MeuShdK4= github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw= github.com/minio/minio-go/v6 v6.0.44/go.mod h1:qD0lajrGW49lKZLtXKtCB4X/qkMf0a5tBvN2PaZg7Gg= @@ -1327,10 +1339,16 @@ github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+ github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8/go.mod h1:86wM1zFnC6/uDBfZGNwB65O+pR2OFi5q/YQaEUid1qA= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/jwt v1.2.2/go.mod h1:/xX356yQA6LuXI9xWW7mZNpxgF2mBmGecH+Fj34sP5Q= +github.com/nats-io/jwt/v2 v2.0.2/go.mod h1:VRP+deawSXyhNjXmxPCHskrR6Mq50BqpEI5SEcNiGlY= github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats-server/v2 v2.2.6/go.mod h1:sEnFaxqe09cDmfMgACxZbziXnhQFhwk+aKkZjBBRYrI= github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nats.go v1.11.0/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= +github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= github.com/ncw/swift v1.0.50/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= @@ -1416,6 +1434,7 @@ github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxS github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= +github.com/openzipkin/zipkin-go v0.2.5/go.mod h1:KpXfKdgRDnnhsxw4pNIH9Md5lyFqKUa4YDFlwRYAMyE= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= @@ -1616,8 +1635,9 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w= github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= @@ -1654,7 +1674,9 @@ github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5q github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/streadway/handy v0.0.0-20200128134331-0f66f006fb2e/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -1787,13 +1809,18 @@ go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mI go.etcd.io/etcd v0.5.0-alpha.5.0.20200520232829-54ba9589114f/go.mod h1:skWido08r9w6Lq/w70DO5XYIKMu4QFu1+4VsqLQuJy8= go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489 h1:1JFLBqwIgdyHN1ZtgjTBwO+blA6gVOmZurpiMEsETKo= go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg= -go.etcd.io/etcd/api/v3 v3.5.0-alpha.0 h1:+e5nrluATIy3GP53znpkHMFzPTHGYyzvJGFCbuI6ZLc= go.etcd.io/etcd/api/v3 v3.5.0-alpha.0/go.mod h1:mPcW6aZJukV6Aa81LSKpBjQXTWlXB5r74ymPoSWa3Sw= -go.etcd.io/etcd/client/v2 v2.305.0-alpha.0 h1:jZepGpOeJATxsbMNBZczDS2jHdK/QVHM1iPe9jURJ8o= +go.etcd.io/etcd/api/v3 v3.5.0 h1:GsV3S+OfZEOCNXdtNkBSR7kgLobAa/SO6tCxRa0GAYw= +go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/client/pkg/v3 v3.5.0 h1:2aQv6F436YnN7I4VbI8PPYrBhu+SmrTaADcf8Mi/6PU= +go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/v2 v2.305.0-alpha.0/go.mod h1:kdV+xzCJ3luEBSIeQyB/OEKkWKd8Zkux4sbDeANrosU= +go.etcd.io/etcd/client/v2 v2.305.0 h1:ftQ0nOOHMcbMS3KIaDQ0g5Qcd6bhaBrQT6b89DfwLTs= +go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= go.etcd.io/etcd/client/v3 v3.5.0-alpha.0/go.mod h1:wKt7jgDgf/OfKiYmCq5WFGxOFAkVMLxiiXgLDFhECr8= -go.etcd.io/etcd/client/v3 v3.5.0-alpha.0.0.20210225194612-fa82d11a958a h1:GZLxiPIaZ/U1Mez9rw3BqUHKt3y3+CK4HWtGAG0Pfx0= go.etcd.io/etcd/client/v3 v3.5.0-alpha.0.0.20210225194612-fa82d11a958a/go.mod h1:wKt7jgDgf/OfKiYmCq5WFGxOFAkVMLxiiXgLDFhECr8= +go.etcd.io/etcd/client/v3 v3.5.0 h1:62Eh0XOro+rDwkrypAGDfgmNh5Joq+z+W9HZdlXMzek= +go.etcd.io/etcd/client/v3 v3.5.0/go.mod h1:AIKXXVX/DQXtfTEqBryiLTUXwON+GuvO6Z7lLS/oTh0= go.etcd.io/etcd/pkg/v3 v3.5.0-alpha.0 h1:3yLUEC0nFCxw/RArImOyRUI4OAFbg4PFpBbAhSNzKNY= go.etcd.io/etcd/pkg/v3 v3.5.0-alpha.0/go.mod h1:tV31atvwzcybuqejDoY3oaNRTtlD2l/Ot78Pc9w7DMY= go.etcd.io/etcd/raft/v3 v3.5.0-alpha.0 h1:DvYJotxV9q1Lkn7pknzAbFO/CLtCVidCr2K9qRLJ8pA= @@ -1839,8 +1866,9 @@ go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.5.1/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/atomic v1.8.0 h1:CUhrE4N1rqSE6FM9ecihEjRkLQu8cDfgDyoOs83mEY4= go.uber.org/atomic v1.8.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/automaxprocs v1.2.0/go.mod h1:YfO3fm683kQpzETxlTGZhGIVmXAhaw3gxeBADbpZtnU= go.uber.org/automaxprocs v1.4.0/go.mod h1:/mTEdr7LvHhs0v7mjdxDreTz1OG5zdZGqgOnhWiR/+Q= go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= @@ -1849,17 +1877,18 @@ go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= +go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.14.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= -go.uber.org/zap v1.16.0 h1:uFRZXykJGK9lLY4HtgSw44DnIcAM+kRBP7x5m+NpAOM= go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= +go.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U= +go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180505025534-4ec37c66abab/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180608092829-8ac0e0d97ce4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1885,6 +1914,7 @@ golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20191202143827-86a70503ff7e/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200422194213-44a606286825/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -1892,6 +1922,7 @@ golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e h1:gsTQYXdTw2Gq7RBsWvlQ91b+aEQ6bXFUngBGuR8sPpI= @@ -2054,6 +2085,7 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190102155601-82a175fd1598/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -2161,6 +2193,7 @@ golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210503080704-8803ae5d1324/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -2453,8 +2486,9 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= @@ -2515,7 +2549,6 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= k8s.io/api v0.20.4 h1:xZjKidCirayzX6tHONRQyTNDVIR55TYVqgATqo6ZULY= diff --git a/integration/e2e/composite_service.go b/integration/e2e/composite_service.go index 4b89d45af64..db840ac92a6 100644 --- a/integration/e2e/composite_service.go +++ b/integration/e2e/composite_service.go @@ -5,9 +5,8 @@ import ( "fmt" "time" + "github.com/grafana/dskit/backoff" "github.com/pkg/errors" - - "github.com/cortexproject/cortex/pkg/util" ) // CompositeHTTPService abstract an higher-level service composed, under the hood, @@ -16,13 +15,13 @@ type CompositeHTTPService struct { services []*HTTPService // Generic retry backoff. - retryBackoff *util.Backoff + retryBackoff *backoff.Backoff } func NewCompositeHTTPService(services ...*HTTPService) *CompositeHTTPService { return &CompositeHTTPService{ services: services, - retryBackoff: util.NewBackoff(context.Background(), util.BackoffConfig{ + retryBackoff: backoff.New(context.Background(), backoff.Config{ MinBackoff: 300 * time.Millisecond, MaxBackoff: 600 * time.Millisecond, MaxRetries: 50, // Sometimes the CI is slow ¯\_(ツ)_/¯ diff --git a/integration/e2e/service.go b/integration/e2e/service.go index cf1f4d22c25..b0ee0c80fd5 100644 --- a/integration/e2e/service.go +++ b/integration/e2e/service.go @@ -13,11 +13,10 @@ import ( "time" "github.com/go-kit/kit/log" + "github.com/grafana/dskit/backoff" "github.com/pkg/errors" "github.com/prometheus/common/expfmt" "github.com/thanos-io/thanos/pkg/runutil" - - "github.com/cortexproject/cortex/pkg/util" ) var ( @@ -43,7 +42,7 @@ type ConcreteService struct { networkPortsContainerToLocal map[int]int // Generic retry backoff. - retryBackoff *util.Backoff + retryBackoff *backoff.Backoff // docker NetworkName used to start this container. // If empty it means service is stopped. @@ -64,7 +63,7 @@ func NewConcreteService( command: command, networkPortsContainerToLocal: map[int]int{}, readiness: readiness, - retryBackoff: util.NewBackoff(context.Background(), util.BackoffConfig{ + retryBackoff: backoff.New(context.Background(), backoff.Config{ MinBackoff: 300 * time.Millisecond, MaxBackoff: 600 * time.Millisecond, MaxRetries: 50, // Sometimes the CI is slow ¯\_(ツ)_/¯ @@ -80,8 +79,8 @@ func (s *ConcreteService) Name() string { return s.name } // Less often used options. -func (s *ConcreteService) SetBackoff(cfg util.BackoffConfig) { - s.retryBackoff = util.NewBackoff(context.Background(), cfg) +func (s *ConcreteService) SetBackoff(cfg backoff.Config) { + s.retryBackoff = backoff.New(context.Background(), cfg) } func (s *ConcreteService) SetEnvVars(env map[string]string) { diff --git a/integration/e2e/service_test.go b/integration/e2e/service_test.go index 2589cb12590..ebd36416f4a 100644 --- a/integration/e2e/service_test.go +++ b/integration/e2e/service_test.go @@ -10,10 +10,9 @@ import ( "testing" "time" + "github.com/grafana/dskit/backoff" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - "github.com/cortexproject/cortex/pkg/util" ) func TestWaitSumMetric(t *testing.T) { @@ -80,7 +79,7 @@ metric_b_summary_count 1 }, } - s.SetBackoff(util.BackoffConfig{ + s.SetBackoff(backoff.Config{ MinBackoff: 300 * time.Millisecond, MaxBackoff: 600 * time.Millisecond, MaxRetries: 50, @@ -88,7 +87,7 @@ metric_b_summary_count 1 require.NoError(t, s.WaitSumMetrics(Equals(221), "metric_a")) // No retry. - s.SetBackoff(util.BackoffConfig{ + s.SetBackoff(backoff.Config{ MinBackoff: 0, MaxBackoff: 0, MaxRetries: 1, @@ -164,7 +163,7 @@ metric_b 1000 }, } - s.SetBackoff(util.BackoffConfig{ + s.SetBackoff(backoff.Config{ MinBackoff: 300 * time.Millisecond, MaxBackoff: 600 * time.Millisecond, MaxRetries: 50, diff --git a/integration/integration_memberlist_single_binary_test.go b/integration/integration_memberlist_single_binary_test.go index ee62cd2f238..c641fa375cd 100644 --- a/integration/integration_memberlist_single_binary_test.go +++ b/integration/integration_memberlist_single_binary_test.go @@ -11,6 +11,7 @@ import ( "testing" "time" + "github.com/grafana/dskit/backoff" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" @@ -18,7 +19,6 @@ import ( "github.com/cortexproject/cortex/integration/e2e" e2edb "github.com/cortexproject/cortex/integration/e2e/db" "github.com/cortexproject/cortex/integration/e2ecortex" - "github.com/cortexproject/cortex/pkg/util" ) func TestSingleBinaryWithMemberlist(t *testing.T) { @@ -145,7 +145,7 @@ func newSingleBinary(name string, servername string, join string, testFlags map[ 8000, ) - backOff := util.BackoffConfig{ + backOff := backoff.Config{ MinBackoff: 200 * time.Millisecond, MaxBackoff: 500 * time.Millisecond, // Bump max backoff... things take little longer with memberlist. MaxRetries: 100, diff --git a/pkg/chunk/aws/dynamodb_storage_client.go b/pkg/chunk/aws/dynamodb_storage_client.go index d3c67f71054..7534b45146e 100644 --- a/pkg/chunk/aws/dynamodb_storage_client.go +++ b/pkg/chunk/aws/dynamodb_storage_client.go @@ -11,6 +11,7 @@ import ( "time" "github.com/go-kit/kit/log/level" + "github.com/grafana/dskit/backoff" ot "github.com/opentracing/opentracing-go" otlog "github.com/opentracing/opentracing-go/log" "golang.org/x/time/rate" @@ -60,7 +61,7 @@ type DynamoDBConfig struct { Metrics MetricsAutoScalingConfig `yaml:"metrics"` ChunkGangSize int `yaml:"chunk_gang_size"` ChunkGetMaxParallelism int `yaml:"chunk_get_max_parallelism"` - BackoffConfig util.BackoffConfig `yaml:"backoff_config"` + BackoffConfig backoff.Config `yaml:"backoff_config"` } // RegisterFlags adds the flags required to config this to the given FlagSet @@ -177,7 +178,7 @@ func (a dynamoDBStorageClient) BatchWrite(ctx context.Context, input chunk.Write outstanding := input.(dynamoDBWriteBatch) unprocessed := dynamoDBWriteBatch{} - backoff := util.NewBackoff(ctx, a.cfg.BackoffConfig) + backoff := backoff.New(ctx, a.cfg.BackoffConfig) for outstanding.Len()+unprocessed.Len() > 0 && backoff.Ongoing() { requests := dynamoDBWriteBatch{} @@ -433,7 +434,7 @@ func (a dynamoDBStorageClient) getDynamoDBChunks(ctx context.Context, chunks []c result := []chunk.Chunk{} unprocessed := dynamoDBReadRequest{} - backoff := util.NewBackoff(ctx, a.cfg.BackoffConfig) + backoff := backoff.New(ctx, a.cfg.BackoffConfig) for outstanding.Len()+unprocessed.Len() > 0 && backoff.Ongoing() { requests := dynamoDBReadRequest{} diff --git a/pkg/chunk/aws/dynamodb_table_client.go b/pkg/chunk/aws/dynamodb_table_client.go index fa7b5f5fad7..4af3a8de606 100644 --- a/pkg/chunk/aws/dynamodb_table_client.go +++ b/pkg/chunk/aws/dynamodb_table_client.go @@ -9,13 +9,13 @@ import ( "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface" "github.com/go-kit/kit/log/level" + "github.com/grafana/dskit/backoff" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/weaveworks/common/instrument" "golang.org/x/time/rate" "github.com/cortexproject/cortex/pkg/chunk" - "github.com/cortexproject/cortex/pkg/util" "github.com/cortexproject/cortex/pkg/util/log" ) @@ -30,7 +30,7 @@ type autoscale interface { type callManager struct { limiter *rate.Limiter - backoffConfig util.BackoffConfig + backoffConfig backoff.Config } type dynamoTableClient struct { @@ -80,7 +80,7 @@ func (d callManager) backoffAndRetry(ctx context.Context, fn func(context.Contex _ = d.limiter.Wait(ctx) } - backoff := util.NewBackoff(ctx, d.backoffConfig) + backoff := backoff.New(ctx, d.backoffConfig) for backoff.Ongoing() { if err := fn(ctx); err != nil { if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == "ThrottlingException" { diff --git a/pkg/chunk/aws/fixtures.go b/pkg/chunk/aws/fixtures.go index acc05dc0adb..90f5c384d66 100644 --- a/pkg/chunk/aws/fixtures.go +++ b/pkg/chunk/aws/fixtures.go @@ -10,7 +10,7 @@ import ( "github.com/cortexproject/cortex/pkg/chunk" "github.com/cortexproject/cortex/pkg/chunk/objectclient" "github.com/cortexproject/cortex/pkg/chunk/testutils" - "github.com/cortexproject/cortex/pkg/util" + "github.com/grafana/dskit/backoff" ) type fixture struct { @@ -73,7 +73,7 @@ func dynamoDBFixture(provisionedErr, gangsize, maxParallelism int) testutils.Fix cfg: DynamoDBConfig{ ChunkGangSize: gangsize, ChunkGetMaxParallelism: maxParallelism, - BackoffConfig: util.BackoffConfig{ + BackoffConfig: backoff.Config{ MinBackoff: 1 * time.Millisecond, MaxBackoff: 5 * time.Millisecond, MaxRetries: 20, diff --git a/pkg/chunk/aws/retryer.go b/pkg/chunk/aws/retryer.go index 94ac71f9057..5e3b7a2710b 100644 --- a/pkg/chunk/aws/retryer.go +++ b/pkg/chunk/aws/retryer.go @@ -5,23 +5,22 @@ import ( "time" "github.com/aws/aws-sdk-go/aws/request" + "github.com/grafana/dskit/backoff" ot "github.com/opentracing/opentracing-go" otlog "github.com/opentracing/opentracing-go/log" - - "github.com/cortexproject/cortex/pkg/util" ) // Map Cortex Backoff into AWS Retryer interface type retryer struct { - *util.Backoff + *backoff.Backoff maxRetries int } var _ request.Retryer = &retryer{} -func newRetryer(ctx context.Context, cfg util.BackoffConfig) *retryer { +func newRetryer(ctx context.Context, cfg backoff.Config) *retryer { return &retryer{ - Backoff: util.NewBackoff(ctx, cfg), + Backoff: backoff.New(ctx, cfg), maxRetries: cfg.MaxRetries, } } diff --git a/pkg/compactor/compactor.go b/pkg/compactor/compactor.go index cb213255ba2..ac1a9c54379 100644 --- a/pkg/compactor/compactor.go +++ b/pkg/compactor/compactor.go @@ -15,6 +15,7 @@ import ( "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" + "github.com/grafana/dskit/backoff" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" @@ -573,7 +574,7 @@ func (c *Compactor) compactUsers(ctx context.Context) { func (c *Compactor) compactUserWithRetries(ctx context.Context, userID string) error { var lastErr error - retries := util.NewBackoff(ctx, util.BackoffConfig{ + retries := backoff.New(ctx, backoff.Config{ MinBackoff: c.compactorCfg.retryMinBackoff, MaxBackoff: c.compactorCfg.retryMaxBackoff, MaxRetries: c.compactorCfg.CompactionRetries, @@ -670,7 +671,7 @@ func (c *Compactor) compactUser(ctx context.Context, userID string) error { func (c *Compactor) discoverUsersWithRetries(ctx context.Context) ([]string, error) { var lastErr error - retries := util.NewBackoff(ctx, util.BackoffConfig{ + retries := backoff.New(ctx, backoff.Config{ MinBackoff: c.compactorCfg.retryMinBackoff, MaxBackoff: c.compactorCfg.retryMaxBackoff, MaxRetries: c.compactorCfg.CompactionRetries, diff --git a/pkg/frontend/v2/frontend_scheduler_worker.go b/pkg/frontend/v2/frontend_scheduler_worker.go index 1395b9a0bb1..19f5b71ffee 100644 --- a/pkg/frontend/v2/frontend_scheduler_worker.go +++ b/pkg/frontend/v2/frontend_scheduler_worker.go @@ -8,6 +8,7 @@ import ( "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" + "github.com/grafana/dskit/backoff" "github.com/pkg/errors" "github.com/weaveworks/common/httpgrpc" "google.golang.org/grpc" @@ -197,12 +198,12 @@ func (w *frontendSchedulerWorker) stop() { } func (w *frontendSchedulerWorker) runOne(ctx context.Context, client schedulerpb.SchedulerForFrontendClient) { - backoffConfig := util.BackoffConfig{ + backoffConfig := backoff.Config{ MinBackoff: 50 * time.Millisecond, MaxBackoff: 1 * time.Second, } - backoff := util.NewBackoff(ctx, backoffConfig) + backoff := backoff.New(ctx, backoffConfig) for backoff.Ongoing() { loop, loopErr := client.FrontendLoop(ctx) if loopErr != nil { diff --git a/pkg/ingester/transfer.go b/pkg/ingester/transfer.go index 7425adbb134..6d482bfdf06 100644 --- a/pkg/ingester/transfer.go +++ b/pkg/ingester/transfer.go @@ -9,6 +9,7 @@ import ( "time" "github.com/go-kit/kit/log/level" + "github.com/grafana/dskit/backoff" "github.com/pkg/errors" "github.com/prometheus/common/model" "github.com/weaveworks/common/user" @@ -17,7 +18,6 @@ import ( "github.com/cortexproject/cortex/pkg/cortexpb" "github.com/cortexproject/cortex/pkg/ingester/client" "github.com/cortexproject/cortex/pkg/ring" - "github.com/cortexproject/cortex/pkg/util" ) var ( @@ -275,7 +275,7 @@ func (i *Ingester) TransferOut(ctx context.Context) error { if i.cfg.MaxTransferRetries <= 0 { return ring.ErrTransferDisabled } - backoff := util.NewBackoff(ctx, util.BackoffConfig{ + backoff := backoff.New(ctx, backoff.Config{ MinBackoff: 100 * time.Millisecond, MaxBackoff: 5 * time.Second, MaxRetries: i.cfg.MaxTransferRetries, diff --git a/pkg/querier/blocks_finder_bucket_scan.go b/pkg/querier/blocks_finder_bucket_scan.go index bfa20863132..182041bcec8 100644 --- a/pkg/querier/blocks_finder_bucket_scan.go +++ b/pkg/querier/blocks_finder_bucket_scan.go @@ -11,6 +11,7 @@ import ( "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" + "github.com/grafana/dskit/backoff" "github.com/oklog/ulid" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" @@ -270,7 +271,7 @@ pushJobsLoop: // scanUserBlocksWithRetries runs scanUserBlocks() retrying multiple times // in case of error. func (d *BucketScanBlocksFinder) scanUserBlocksWithRetries(ctx context.Context, userID string) (metas bucketindex.Blocks, deletionMarks map[ulid.ULID]*bucketindex.BlockDeletionMark, err error) { - retries := util.NewBackoff(ctx, util.BackoffConfig{ + retries := backoff.New(ctx, backoff.Config{ MinBackoff: time.Second, MaxBackoff: 30 * time.Second, MaxRetries: 3, diff --git a/pkg/querier/worker/frontend_processor.go b/pkg/querier/worker/frontend_processor.go index 7d25a964679..3a6928cbb24 100644 --- a/pkg/querier/worker/frontend_processor.go +++ b/pkg/querier/worker/frontend_processor.go @@ -8,17 +8,17 @@ import ( "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" + "github.com/grafana/dskit/backoff" "github.com/weaveworks/common/httpgrpc" "google.golang.org/grpc" "github.com/cortexproject/cortex/pkg/frontend/v1/frontendv1pb" "github.com/cortexproject/cortex/pkg/querier/stats" querier_stats "github.com/cortexproject/cortex/pkg/querier/stats" - "github.com/cortexproject/cortex/pkg/util" ) var ( - processorBackoffConfig = util.BackoffConfig{ + processorBackoffConfig = backoff.Config{ MinBackoff: 50 * time.Millisecond, MaxBackoff: 1 * time.Second, } @@ -57,7 +57,7 @@ func (fp *frontendProcessor) notifyShutdown(ctx context.Context, conn *grpc.Clie func (fp *frontendProcessor) processQueriesOnSingleStream(ctx context.Context, conn *grpc.ClientConn, address string) { client := frontendv1pb.NewFrontendClient(conn) - backoff := util.NewBackoff(ctx, processorBackoffConfig) + backoff := backoff.New(ctx, processorBackoffConfig) for backoff.Ongoing() { c, err := client.Process(ctx) if err != nil { diff --git a/pkg/querier/worker/scheduler_processor.go b/pkg/querier/worker/scheduler_processor.go index cc3dc799148..ee3f3c7cc19 100644 --- a/pkg/querier/worker/scheduler_processor.go +++ b/pkg/querier/worker/scheduler_processor.go @@ -6,6 +6,7 @@ import ( "net/http" "time" + "github.com/grafana/dskit/backoff" otgrpc "github.com/opentracing-contrib/go-grpc" "github.com/weaveworks/common/user" @@ -23,7 +24,6 @@ import ( querier_stats "github.com/cortexproject/cortex/pkg/querier/stats" "github.com/cortexproject/cortex/pkg/ring/client" "github.com/cortexproject/cortex/pkg/scheduler/schedulerpb" - "github.com/cortexproject/cortex/pkg/util" "github.com/cortexproject/cortex/pkg/util/grpcclient" "github.com/cortexproject/cortex/pkg/util/grpcutil" util_log "github.com/cortexproject/cortex/pkg/util/log" @@ -87,7 +87,7 @@ func (sp *schedulerProcessor) notifyShutdown(ctx context.Context, conn *grpc.Cli func (sp *schedulerProcessor) processQueriesOnSingleStream(ctx context.Context, conn *grpc.ClientConn, address string) { schedulerClient := schedulerpb.NewSchedulerForQuerierClient(conn) - backoff := util.NewBackoff(ctx, processorBackoffConfig) + backoff := backoff.New(ctx, processorBackoffConfig) for backoff.Ongoing() { c, err := schedulerClient.QuerierLoop(ctx) if err == nil { diff --git a/pkg/ring/kv/consul/client.go b/pkg/ring/kv/consul/client.go index 1c39a473ced..11c26df1088 100644 --- a/pkg/ring/kv/consul/client.go +++ b/pkg/ring/kv/consul/client.go @@ -10,13 +10,13 @@ import ( "time" "github.com/go-kit/kit/log/level" + "github.com/grafana/dskit/backoff" consul "github.com/hashicorp/consul/api" "github.com/hashicorp/go-cleanhttp" "github.com/weaveworks/common/instrument" "golang.org/x/time/rate" "github.com/cortexproject/cortex/pkg/ring/kv/codec" - "github.com/cortexproject/cortex/pkg/util" util_log "github.com/cortexproject/cortex/pkg/util/log" ) @@ -30,7 +30,7 @@ var ( // ErrNotFound is returned by ConsulClient.Get. ErrNotFound = fmt.Errorf("Not found") - backoffConfig = util.BackoffConfig{ + backoffConfig = backoff.Config{ MinBackoff: 1 * time.Second, MaxBackoff: 1 * time.Minute, } @@ -203,7 +203,7 @@ func (c *Client) cas(ctx context.Context, key string, f func(in interface{}) (ou // into. This function blocks until the context is cancelled or f returns false. func (c *Client) WatchKey(ctx context.Context, key string, f func(interface{}) bool) { var ( - backoff = util.NewBackoff(ctx, backoffConfig) + backoff = backoff.New(ctx, backoffConfig) index = uint64(0) limiter = c.createRateLimiter() ) @@ -264,7 +264,7 @@ func (c *Client) WatchKey(ctx context.Context, key string, f func(interface{}) b // Values in Consul are assumed to be JSON. This function blocks until the context is cancelled. func (c *Client) WatchPrefix(ctx context.Context, prefix string, f func(string, interface{}) bool) { var ( - backoff = util.NewBackoff(ctx, backoffConfig) + backoff = backoff.New(ctx, backoffConfig) index = uint64(0) limiter = c.createRateLimiter() ) diff --git a/pkg/ring/kv/etcd/etcd.go b/pkg/ring/kv/etcd/etcd.go index 34999ab3712..0e8f612d026 100644 --- a/pkg/ring/kv/etcd/etcd.go +++ b/pkg/ring/kv/etcd/etcd.go @@ -8,12 +8,12 @@ import ( "time" "github.com/go-kit/kit/log/level" + "github.com/grafana/dskit/backoff" "github.com/pkg/errors" clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/pkg/transport" "github.com/cortexproject/cortex/pkg/ring/kv/codec" - "github.com/cortexproject/cortex/pkg/util" "github.com/cortexproject/cortex/pkg/util/flagext" util_log "github.com/cortexproject/cortex/pkg/util/log" cortex_tls "github.com/cortexproject/cortex/pkg/util/tls" @@ -178,7 +178,7 @@ func (c *Client) CAS(ctx context.Context, key string, f func(in interface{}) (ou // WatchKey implements kv.Client. func (c *Client) WatchKey(ctx context.Context, key string, f func(interface{}) bool) { - backoff := util.NewBackoff(ctx, util.BackoffConfig{ + backoff := backoff.New(ctx, backoff.Config{ MinBackoff: 1 * time.Second, MaxBackoff: 1 * time.Minute, }) @@ -214,7 +214,7 @@ outer: // WatchPrefix implements kv.Client. func (c *Client) WatchPrefix(ctx context.Context, key string, f func(string, interface{}) bool) { - backoff := util.NewBackoff(ctx, util.BackoffConfig{ + backoff := backoff.New(ctx, backoff.Config{ MinBackoff: 1 * time.Second, MaxBackoff: 1 * time.Minute, }) diff --git a/pkg/ring/kv/memberlist/memberlist_client.go b/pkg/ring/kv/memberlist/memberlist_client.go index 01b3b88fad0..29547c9ae6f 100644 --- a/pkg/ring/kv/memberlist/memberlist_client.go +++ b/pkg/ring/kv/memberlist/memberlist_client.go @@ -15,13 +15,13 @@ import ( "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" + "github.com/grafana/dskit/backoff" "github.com/hashicorp/memberlist" "github.com/prometheus/client_golang/prometheus" "github.com/thanos-io/thanos/pkg/discovery/dns" "github.com/thanos-io/thanos/pkg/extprom" "github.com/cortexproject/cortex/pkg/ring/kv/codec" - "github.com/cortexproject/cortex/pkg/util" "github.com/cortexproject/cortex/pkg/util/flagext" util_log "github.com/cortexproject/cortex/pkg/util/log" "github.com/cortexproject/cortex/pkg/util/services" @@ -512,13 +512,13 @@ func (m *KV) joinMembersOnStartup(ctx context.Context, members []string) error { level.Debug(m.logger).Log("msg", "attempt to join memberlist cluster failed", "retries", 0, "err", err) lastErr := err - cfg := util.BackoffConfig{ + cfg := backoff.Config{ MinBackoff: m.cfg.MinJoinBackoff, MaxBackoff: m.cfg.MaxJoinBackoff, MaxRetries: m.cfg.MaxJoinRetries, } - backoff := util.NewBackoff(ctx, cfg) + backoff := backoff.New(ctx, cfg) for backoff.Ongoing() { backoff.Wait() diff --git a/pkg/ring/util.go b/pkg/ring/util.go index 06e053dd269..7754ec49d59 100644 --- a/pkg/ring/util.go +++ b/pkg/ring/util.go @@ -6,6 +6,8 @@ import ( "sort" "time" + "github.com/grafana/dskit/backoff" + "github.com/cortexproject/cortex/pkg/util" ) @@ -70,7 +72,7 @@ func GetInstancePort(configPort, listenPort int) int { // WaitInstanceState waits until the input instanceID is registered within the // ring matching the provided state. A timeout should be provided within the context. func WaitInstanceState(ctx context.Context, r ReadRing, instanceID string, state InstanceState) error { - backoff := util.NewBackoff(ctx, util.BackoffConfig{ + backoff := backoff.New(ctx, backoff.Config{ MinBackoff: 100 * time.Millisecond, MaxBackoff: time.Second, MaxRetries: 0, diff --git a/pkg/storegateway/bucket_stores.go b/pkg/storegateway/bucket_stores.go index 3c3da94b06a..4c677c7c2fd 100644 --- a/pkg/storegateway/bucket_stores.go +++ b/pkg/storegateway/bucket_stores.go @@ -14,6 +14,7 @@ import ( "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" + "github.com/grafana/dskit/backoff" "github.com/oklog/ulid" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" @@ -34,7 +35,6 @@ import ( "github.com/cortexproject/cortex/pkg/storage/bucket" "github.com/cortexproject/cortex/pkg/storage/tsdb" - "github.com/cortexproject/cortex/pkg/util" util_log "github.com/cortexproject/cortex/pkg/util/log" "github.com/cortexproject/cortex/pkg/util/spanlogger" "github.com/cortexproject/cortex/pkg/util/validation" @@ -160,7 +160,7 @@ func (u *BucketStores) SyncBlocks(ctx context.Context) error { } func (u *BucketStores) syncUsersBlocksWithRetries(ctx context.Context, f func(context.Context, *store.BucketStore) error) error { - retries := util.NewBackoff(ctx, util.BackoffConfig{ + retries := backoff.New(ctx, backoff.Config{ MinBackoff: 1 * time.Second, MaxBackoff: 10 * time.Second, MaxRetries: 3, diff --git a/pkg/util/backoff_test.go b/pkg/util/backoff_test.go deleted file mode 100644 index b255db0e787..00000000000 --- a/pkg/util/backoff_test.go +++ /dev/null @@ -1,103 +0,0 @@ -package util - -import ( - "context" - "testing" - "time" -) - -func TestBackoff_NextDelay(t *testing.T) { - t.Parallel() - - tests := map[string]struct { - minBackoff time.Duration - maxBackoff time.Duration - expectedRanges [][]time.Duration - }{ - "exponential backoff with jitter honoring min and max": { - minBackoff: 100 * time.Millisecond, - maxBackoff: 10 * time.Second, - expectedRanges: [][]time.Duration{ - {100 * time.Millisecond, 200 * time.Millisecond}, - {200 * time.Millisecond, 400 * time.Millisecond}, - {400 * time.Millisecond, 800 * time.Millisecond}, - {800 * time.Millisecond, 1600 * time.Millisecond}, - {1600 * time.Millisecond, 3200 * time.Millisecond}, - {3200 * time.Millisecond, 6400 * time.Millisecond}, - {6400 * time.Millisecond, 10000 * time.Millisecond}, - {6400 * time.Millisecond, 10000 * time.Millisecond}, - }, - }, - "exponential backoff with max equal to the end of a range": { - minBackoff: 100 * time.Millisecond, - maxBackoff: 800 * time.Millisecond, - expectedRanges: [][]time.Duration{ - {100 * time.Millisecond, 200 * time.Millisecond}, - {200 * time.Millisecond, 400 * time.Millisecond}, - {400 * time.Millisecond, 800 * time.Millisecond}, - {400 * time.Millisecond, 800 * time.Millisecond}, - }, - }, - "exponential backoff with max equal to the end of a range + 1": { - minBackoff: 100 * time.Millisecond, - maxBackoff: 801 * time.Millisecond, - expectedRanges: [][]time.Duration{ - {100 * time.Millisecond, 200 * time.Millisecond}, - {200 * time.Millisecond, 400 * time.Millisecond}, - {400 * time.Millisecond, 800 * time.Millisecond}, - {800 * time.Millisecond, 801 * time.Millisecond}, - {800 * time.Millisecond, 801 * time.Millisecond}, - }, - }, - "exponential backoff with max equal to the end of a range - 1": { - minBackoff: 100 * time.Millisecond, - maxBackoff: 799 * time.Millisecond, - expectedRanges: [][]time.Duration{ - {100 * time.Millisecond, 200 * time.Millisecond}, - {200 * time.Millisecond, 400 * time.Millisecond}, - {400 * time.Millisecond, 799 * time.Millisecond}, - {400 * time.Millisecond, 799 * time.Millisecond}, - }, - }, - "min backoff is equal to max": { - minBackoff: 100 * time.Millisecond, - maxBackoff: 100 * time.Millisecond, - expectedRanges: [][]time.Duration{ - {100 * time.Millisecond, 100 * time.Millisecond}, - {100 * time.Millisecond, 100 * time.Millisecond}, - {100 * time.Millisecond, 100 * time.Millisecond}, - }, - }, - "min backoff is greater then max": { - minBackoff: 200 * time.Millisecond, - maxBackoff: 100 * time.Millisecond, - expectedRanges: [][]time.Duration{ - {200 * time.Millisecond, 200 * time.Millisecond}, - {200 * time.Millisecond, 200 * time.Millisecond}, - {200 * time.Millisecond, 200 * time.Millisecond}, - }, - }, - } - - for testName, testData := range tests { - testData := testData - - t.Run(testName, func(t *testing.T) { - t.Parallel() - - b := NewBackoff(context.Background(), BackoffConfig{ - MinBackoff: testData.minBackoff, - MaxBackoff: testData.maxBackoff, - MaxRetries: len(testData.expectedRanges), - }) - - for _, expectedRange := range testData.expectedRanges { - delay := b.NextDelay() - - if delay < expectedRange[0] || delay > expectedRange[1] { - t.Errorf("%d expected to be within %d and %d", delay, expectedRange[0], expectedRange[1]) - } - } - }) - } -} diff --git a/pkg/util/grpcclient/backoff_retry.go b/pkg/util/grpcclient/backoff_retry.go index 2c8cc5dcadb..70ab38c6b73 100644 --- a/pkg/util/grpcclient/backoff_retry.go +++ b/pkg/util/grpcclient/backoff_retry.go @@ -3,17 +3,16 @@ package grpcclient import ( "context" + "github.com/grafana/dskit/backoff" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - - "github.com/cortexproject/cortex/pkg/util" ) // NewBackoffRetry gRPC middleware. -func NewBackoffRetry(cfg util.BackoffConfig) grpc.UnaryClientInterceptor { +func NewBackoffRetry(cfg backoff.Config) grpc.UnaryClientInterceptor { return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { - backoff := util.NewBackoff(ctx, cfg) + backoff := backoff.New(ctx, cfg) for backoff.Ongoing() { err := invoker(ctx, method, req, reply, cc, opts...) if err == nil { diff --git a/pkg/util/grpcclient/grpcclient.go b/pkg/util/grpcclient/grpcclient.go index e876804c4b4..dc5b11b4d34 100644 --- a/pkg/util/grpcclient/grpcclient.go +++ b/pkg/util/grpcclient/grpcclient.go @@ -5,13 +5,13 @@ import ( "time" "github.com/go-kit/kit/log" + "github.com/grafana/dskit/backoff" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" "github.com/pkg/errors" "google.golang.org/grpc" "google.golang.org/grpc/encoding/gzip" "google.golang.org/grpc/keepalive" - "github.com/cortexproject/cortex/pkg/util" "github.com/cortexproject/cortex/pkg/util/grpc/encoding/snappy" "github.com/cortexproject/cortex/pkg/util/tls" ) @@ -24,8 +24,8 @@ type Config struct { RateLimit float64 `yaml:"rate_limit"` RateLimitBurst int `yaml:"rate_limit_burst"` - BackoffOnRatelimits bool `yaml:"backoff_on_ratelimits"` - BackoffConfig util.BackoffConfig `yaml:"backoff_config"` + BackoffOnRatelimits bool `yaml:"backoff_on_ratelimits"` + BackoffConfig backoff.Config `yaml:"backoff_config"` TLSEnabled bool `yaml:"tls_enabled"` TLS tls.ClientConfig `yaml:",inline"` @@ -46,7 +46,7 @@ func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) { f.BoolVar(&cfg.BackoffOnRatelimits, prefix+".backoff-on-ratelimits", false, "Enable backoff and retry when we hit ratelimits.") f.BoolVar(&cfg.TLSEnabled, prefix+".tls-enabled", cfg.TLSEnabled, "Enable TLS in the GRPC client. This flag needs to be enabled when any other TLS flag is set. If set to false, insecure connection to gRPC server will be used.") - cfg.BackoffConfig.RegisterFlags(prefix, f) + cfg.BackoffConfig.RegisterFlagsWithPrefix(prefix, f) cfg.TLS.RegisterFlagsWithPrefix(prefix, f) } diff --git a/tools/blocksconvert/builder/builder.go b/tools/blocksconvert/builder/builder.go index fbb6555940d..e344ac8bbea 100644 --- a/tools/blocksconvert/builder/builder.go +++ b/tools/blocksconvert/builder/builder.go @@ -12,6 +12,7 @@ import ( "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" + "github.com/grafana/dskit/backoff" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" @@ -26,7 +27,6 @@ import ( "github.com/cortexproject/cortex/pkg/chunk/storage" "github.com/cortexproject/cortex/pkg/storage/bucket" cortex_tsdb "github.com/cortexproject/cortex/pkg/storage/tsdb" - "github.com/cortexproject/cortex/pkg/util" "github.com/cortexproject/cortex/pkg/util/services" "github.com/cortexproject/cortex/tools/blocksconvert" "github.com/cortexproject/cortex/tools/blocksconvert/planprocessor" @@ -255,7 +255,7 @@ func (p *builderProcessor) ProcessPlanEntries(ctx context.Context, planEntryCh c } func uploadBlock(ctx context.Context, planLog log.Logger, userBucket objstore.Bucket, blockDir string) error { - boff := util.NewBackoff(ctx, util.BackoffConfig{ + boff := backoff.New(ctx, backoff.Config{ MinBackoff: 1 * time.Second, MaxBackoff: 5 * time.Second, MaxRetries: 5, @@ -297,7 +297,7 @@ func getBlockSize(dir string) (int64, error) { } func fetchAndBuild(ctx context.Context, f *Fetcher, input chan blocksconvert.PlanEntry, tb *tsdbBuilder, log log.Logger, chunksNotFound prometheus.Counter) error { - b := util.NewBackoff(ctx, util.BackoffConfig{ + b := backoff.New(ctx, backoff.Config{ MinBackoff: 1 * time.Second, MaxBackoff: 5 * time.Second, MaxRetries: 5, diff --git a/tools/blocksconvert/cleaner/cleaner.go b/tools/blocksconvert/cleaner/cleaner.go index eefcb174121..aeb0273aa02 100644 --- a/tools/blocksconvert/cleaner/cleaner.go +++ b/tools/blocksconvert/cleaner/cleaner.go @@ -7,6 +7,7 @@ import ( "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" + "github.com/grafana/dskit/backoff" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" @@ -16,7 +17,6 @@ import ( "github.com/cortexproject/cortex/pkg/chunk" "github.com/cortexproject/cortex/pkg/chunk/storage" - "github.com/cortexproject/cortex/pkg/util" "github.com/cortexproject/cortex/pkg/util/services" "github.com/cortexproject/cortex/tools/blocksconvert" "github.com/cortexproject/cortex/tools/blocksconvert/planprocessor" @@ -172,7 +172,7 @@ func (cp *cleanerProcessor) deleteChunksForSeries(ctx context.Context, tableName var c *chunk.Chunk var err error - b := util.NewBackoff(ctx, util.BackoffConfig{ + b := backoff.New(ctx, backoff.Config{ MinBackoff: 1 * time.Second, MaxBackoff: 5 * time.Second, MaxRetries: 5, diff --git a/tools/blocksconvert/scanner/scanner.go b/tools/blocksconvert/scanner/scanner.go index 307fab839bd..41a0d2f03db 100644 --- a/tools/blocksconvert/scanner/scanner.go +++ b/tools/blocksconvert/scanner/scanner.go @@ -17,6 +17,7 @@ import ( "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" + "github.com/grafana/dskit/backoff" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" @@ -26,7 +27,6 @@ import ( "github.com/cortexproject/cortex/pkg/chunk" "github.com/cortexproject/cortex/pkg/chunk/aws" "github.com/cortexproject/cortex/pkg/chunk/storage" - "github.com/cortexproject/cortex/pkg/util" "github.com/cortexproject/cortex/pkg/util/flagext" "github.com/cortexproject/cortex/pkg/util/services" "github.com/cortexproject/cortex/tools/blocksconvert" @@ -436,7 +436,7 @@ func uploadPlansConcurrently(ctx context.Context, log log.Logger, dir string, bu src := filepath.Join(dir, filepath.FromSlash(p)) dst := path.Join(bucketPrefix, p) - boff := util.NewBackoff(ctx, util.BackoffConfig{ + boff := backoff.New(ctx, backoff.Config{ MinBackoff: 1 * time.Second, MaxBackoff: 5 * time.Second, MaxRetries: 5, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go index 8f35b3464ba..df63bade104 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go @@ -13,7 +13,6 @@ package ec2metadata import ( "bytes" - "errors" "io" "net/http" "net/url" @@ -234,7 +233,8 @@ func unmarshalError(r *request.Request) { // Response body format is not consistent between metadata endpoints. // Grab the error message as a string and include that as the source error - r.Error = awserr.NewRequestFailure(awserr.New("EC2MetadataError", "failed to make EC2Metadata request", errors.New(b.String())), + r.Error = awserr.NewRequestFailure( + awserr.New("EC2MetadataError", "failed to make EC2Metadata request\n"+b.String(), nil), r.HTTPResponse.StatusCode, r.RequestID) } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index a07649e9063..887c21dcb1c 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -4891,6 +4891,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -5137,6 +5138,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "fips-us-east-1": endpoint{ Hostname: "qldb-fips.us-east-1.amazonaws.com", CredentialScope: credentialScope{ @@ -6299,6 +6301,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "fips-us-east-1": endpoint{ Hostname: "session.qldb-fips.us-east-1.amazonaws.com", CredentialScope: credentialScope{ @@ -9623,6 +9626,25 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "mq": service{ + + Endpoints: endpoints{ + "fips-us-gov-east-1": endpoint{ + Hostname: "mq-fips.us-gov-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-east-1", + }, + }, + "fips-us-gov-west-1": endpoint{ + Hostname: "mq-fips.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, "neptune": service{ Endpoints: endpoints{ diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go index 07ea799fbd3..716e6181f54 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go @@ -34,23 +34,23 @@ func (m mapRule) IsValid(value string) bool { return ok } -// whitelist is a generic rule for whitelisting -type whitelist struct { +// allowList is a generic rule for allow listing +type allowList struct { rule } -// IsValid for whitelist checks if the value is within the whitelist -func (w whitelist) IsValid(value string) bool { +// IsValid for allow list checks if the value is within the allow list +func (w allowList) IsValid(value string) bool { return w.rule.IsValid(value) } -// blacklist is a generic rule for blacklisting -type blacklist struct { +// excludeList is a generic rule for blacklisting +type excludeList struct { rule } -// IsValid for whitelist checks if the value is within the whitelist -func (b blacklist) IsValid(value string) bool { +// IsValid for allow list checks if the value is within the allow list +func (b excludeList) IsValid(value string) bool { return !b.rule.IsValid(value) } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go index 1737c2686de..c1949859ad5 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go @@ -90,7 +90,7 @@ const ( ) var ignoredHeaders = rules{ - blacklist{ + excludeList{ mapRule{ authorizationHeader: struct{}{}, "User-Agent": struct{}{}, @@ -99,9 +99,9 @@ var ignoredHeaders = rules{ }, } -// requiredSignedHeaders is a whitelist for build canonical headers. +// requiredSignedHeaders is a allow list for build canonical headers. var requiredSignedHeaders = rules{ - whitelist{ + allowList{ mapRule{ "Cache-Control": struct{}{}, "Content-Disposition": struct{}{}, @@ -145,12 +145,13 @@ var requiredSignedHeaders = rules{ }, }, patterns{"X-Amz-Meta-"}, + patterns{"X-Amz-Object-Lock-"}, } -// allowedHoisting is a whitelist for build query headers. The boolean value +// allowedHoisting is a allow list for build query headers. The boolean value // represents whether or not it is a pattern. var allowedQueryHoisting = inclusiveRules{ - blacklist{requiredSignedHeaders}, + excludeList{requiredSignedHeaders}, patterns{"X-Amz-"}, } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index 938fdfd135a..db652204980 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.38.60" +const SDKVersion = "1.38.68" diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go index 1301b149d35..fb35fee5fe7 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go @@ -98,7 +98,7 @@ func buildLocationElements(r *request.Request, v reflect.Value, buildGETQuery bo // Support the ability to customize values to be marshaled as a // blob even though they were modeled as a string. Required for S3 - // API operations like SSECustomerKey is modeled as stirng but + // API operations like SSECustomerKey is modeled as string but // required to be base64 encoded in request. if field.Tag.Get("marshal-as") == "blob" { m = m.Convert(byteSliceType) diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go index 98f4caed91c..d486a4c2a0d 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go @@ -1,6 +1,8 @@ package protocol import ( + "bytes" + "fmt" "math" "strconv" "time" @@ -19,7 +21,9 @@ const ( // Output time is intended to not contain decimals const ( // RFC 7231#section-7.1.1.1 timetamp format. e.g Tue, 29 Apr 2014 18:30:38 GMT - RFC822TimeFormat = "Mon, 2 Jan 2006 15:04:05 GMT" + RFC822TimeFormat = "Mon, 2 Jan 2006 15:04:05 GMT" + rfc822TimeFormatSingleDigitDay = "Mon, _2 Jan 2006 15:04:05 GMT" + rfc822TimeFormatSingleDigitDayTwoDigitYear = "Mon, _2 Jan 06 15:04:05 GMT" // This format is used for output time without seconds precision RFC822OutputTimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT" @@ -67,10 +71,20 @@ func FormatTime(name string, t time.Time) string { // the time if it was able to be parsed, and fails otherwise. func ParseTime(formatName, value string) (time.Time, error) { switch formatName { - case RFC822TimeFormatName: - return time.Parse(RFC822TimeFormat, value) - case ISO8601TimeFormatName: - return time.Parse(ISO8601TimeFormat, value) + case RFC822TimeFormatName: // Smithy HTTPDate format + return tryParse(value, + RFC822TimeFormat, + rfc822TimeFormatSingleDigitDay, + rfc822TimeFormatSingleDigitDayTwoDigitYear, + time.RFC850, + time.ANSIC, + ) + case ISO8601TimeFormatName: // Smithy DateTime format + return tryParse(value, + ISO8601TimeFormat, + time.RFC3339Nano, + time.RFC3339, + ) case UnixTimeFormatName: v, err := strconv.ParseFloat(value, 64) _, dec := math.Modf(v) @@ -83,3 +97,36 @@ func ParseTime(formatName, value string) (time.Time, error) { panic("unknown timestamp format name, " + formatName) } } + +func tryParse(v string, formats ...string) (time.Time, error) { + var errs parseErrors + for _, f := range formats { + t, err := time.Parse(f, v) + if err != nil { + errs = append(errs, parseError{ + Format: f, + Err: err, + }) + continue + } + return t, nil + } + + return time.Time{}, fmt.Errorf("unable to parse time string, %v", errs) +} + +type parseErrors []parseError + +func (es parseErrors) Error() string { + var s bytes.Buffer + for _, e := range es { + fmt.Fprintf(&s, "\n * %q: %v", e.Format, e.Err) + } + + return "parse errors:" + s.String() +} + +type parseError struct { + Format string + Err error +} diff --git a/vendor/github.com/coreos/go-systemd/v22/journal/journal.go b/vendor/github.com/coreos/go-systemd/v22/journal/journal.go index a0f4837a02c..ac24c7767d3 100644 --- a/vendor/github.com/coreos/go-systemd/v22/journal/journal.go +++ b/vendor/github.com/coreos/go-systemd/v22/journal/journal.go @@ -23,20 +23,7 @@ package journal import ( - "bytes" - "encoding/binary" - "errors" "fmt" - "io" - "io/ioutil" - "net" - "os" - "strconv" - "strings" - "sync" - "sync/atomic" - "syscall" - "unsafe" ) // Priority of a journal message @@ -53,173 +40,7 @@ const ( PriDebug ) -var ( - // This can be overridden at build-time: - // https://github.com/golang/go/wiki/GcToolchainTricks#including-build-information-in-the-executable - journalSocket = "/run/systemd/journal/socket" - - // unixConnPtr atomically holds the local unconnected Unix-domain socket. - // Concrete safe pointer type: *net.UnixConn - unixConnPtr unsafe.Pointer - // onceConn ensures that unixConnPtr is initialized exactly once. - onceConn sync.Once -) - -func init() { - onceConn.Do(initConn) -} - -// Enabled checks whether the local systemd journal is available for logging. -func Enabled() bool { - onceConn.Do(initConn) - - if (*net.UnixConn)(atomic.LoadPointer(&unixConnPtr)) == nil { - return false - } - - if _, err := net.Dial("unixgram", journalSocket); err != nil { - return false - } - - return true -} - -// Send a message to the local systemd journal. vars is a map of journald -// fields to values. Fields must be composed of uppercase letters, numbers, -// and underscores, but must not start with an underscore. Within these -// restrictions, any arbitrary field name may be used. Some names have special -// significance: see the journalctl documentation -// (http://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html) -// for more details. vars may be nil. -func Send(message string, priority Priority, vars map[string]string) error { - conn := (*net.UnixConn)(atomic.LoadPointer(&unixConnPtr)) - if conn == nil { - return errors.New("could not initialize socket to journald") - } - - socketAddr := &net.UnixAddr{ - Name: journalSocket, - Net: "unixgram", - } - - data := new(bytes.Buffer) - appendVariable(data, "PRIORITY", strconv.Itoa(int(priority))) - appendVariable(data, "MESSAGE", message) - for k, v := range vars { - appendVariable(data, k, v) - } - - _, _, err := conn.WriteMsgUnix(data.Bytes(), nil, socketAddr) - if err == nil { - return nil - } - if !isSocketSpaceError(err) { - return err - } - - // Large log entry, send it via tempfile and ancillary-fd. - file, err := tempFd() - if err != nil { - return err - } - defer file.Close() - _, err = io.Copy(file, data) - if err != nil { - return err - } - rights := syscall.UnixRights(int(file.Fd())) - _, _, err = conn.WriteMsgUnix([]byte{}, rights, socketAddr) - if err != nil { - return err - } - - return nil -} - // Print prints a message to the local systemd journal using Send(). func Print(priority Priority, format string, a ...interface{}) error { return Send(fmt.Sprintf(format, a...), priority, nil) } - -func appendVariable(w io.Writer, name, value string) { - if err := validVarName(name); err != nil { - fmt.Fprintf(os.Stderr, "variable name %s contains invalid character, ignoring\n", name) - } - if strings.ContainsRune(value, '\n') { - /* When the value contains a newline, we write: - * - the variable name, followed by a newline - * - the size (in 64bit little endian format) - * - the data, followed by a newline - */ - fmt.Fprintln(w, name) - binary.Write(w, binary.LittleEndian, uint64(len(value))) - fmt.Fprintln(w, value) - } else { - /* just write the variable and value all on one line */ - fmt.Fprintf(w, "%s=%s\n", name, value) - } -} - -// validVarName validates a variable name to make sure journald will accept it. -// The variable name must be in uppercase and consist only of characters, -// numbers and underscores, and may not begin with an underscore: -// https://www.freedesktop.org/software/systemd/man/sd_journal_print.html -func validVarName(name string) error { - if name == "" { - return errors.New("Empty variable name") - } else if name[0] == '_' { - return errors.New("Variable name begins with an underscore") - } - - for _, c := range name { - if !(('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || c == '_') { - return errors.New("Variable name contains invalid characters") - } - } - return nil -} - -// isSocketSpaceError checks whether the error is signaling -// an "overlarge message" condition. -func isSocketSpaceError(err error) bool { - opErr, ok := err.(*net.OpError) - if !ok || opErr == nil { - return false - } - - sysErr, ok := opErr.Err.(*os.SyscallError) - if !ok || sysErr == nil { - return false - } - - return sysErr.Err == syscall.EMSGSIZE || sysErr.Err == syscall.ENOBUFS -} - -// tempFd creates a temporary, unlinked file under `/dev/shm`. -func tempFd() (*os.File, error) { - file, err := ioutil.TempFile("/dev/shm/", "journal.XXXXX") - if err != nil { - return nil, err - } - err = syscall.Unlink(file.Name()) - if err != nil { - return nil, err - } - return file, nil -} - -// initConn initializes the global `unixConnPtr` socket. -// It is meant to be called exactly once, at program startup. -func initConn() { - autobind, err := net.ResolveUnixAddr("unixgram", "") - if err != nil { - return - } - - sock, err := net.ListenUnixgram("unixgram", autobind) - if err != nil { - return - } - - atomic.StorePointer(&unixConnPtr, unsafe.Pointer(sock)) -} diff --git a/vendor/github.com/coreos/go-systemd/v22/journal/journal_unix.go b/vendor/github.com/coreos/go-systemd/v22/journal/journal_unix.go new file mode 100644 index 00000000000..8d58ca0fbca --- /dev/null +++ b/vendor/github.com/coreos/go-systemd/v22/journal/journal_unix.go @@ -0,0 +1,210 @@ +// Copyright 2015 CoreOS, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build !windows + +// Package journal provides write bindings to the local systemd journal. +// It is implemented in pure Go and connects to the journal directly over its +// unix socket. +// +// To read from the journal, see the "sdjournal" package, which wraps the +// sd-journal a C API. +// +// http://www.freedesktop.org/software/systemd/man/systemd-journald.service.html +package journal + +import ( + "bytes" + "encoding/binary" + "errors" + "fmt" + "io" + "io/ioutil" + "net" + "os" + "strconv" + "strings" + "sync" + "sync/atomic" + "syscall" + "unsafe" +) + +var ( + // This can be overridden at build-time: + // https://github.com/golang/go/wiki/GcToolchainTricks#including-build-information-in-the-executable + journalSocket = "/run/systemd/journal/socket" + + // unixConnPtr atomically holds the local unconnected Unix-domain socket. + // Concrete safe pointer type: *net.UnixConn + unixConnPtr unsafe.Pointer + // onceConn ensures that unixConnPtr is initialized exactly once. + onceConn sync.Once +) + +func init() { + onceConn.Do(initConn) +} + +// Enabled checks whether the local systemd journal is available for logging. +func Enabled() bool { + onceConn.Do(initConn) + + if (*net.UnixConn)(atomic.LoadPointer(&unixConnPtr)) == nil { + return false + } + + conn, err := net.Dial("unixgram", journalSocket) + if err != nil { + return false + } + defer conn.Close() + + return true +} + +// Send a message to the local systemd journal. vars is a map of journald +// fields to values. Fields must be composed of uppercase letters, numbers, +// and underscores, but must not start with an underscore. Within these +// restrictions, any arbitrary field name may be used. Some names have special +// significance: see the journalctl documentation +// (http://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html) +// for more details. vars may be nil. +func Send(message string, priority Priority, vars map[string]string) error { + conn := (*net.UnixConn)(atomic.LoadPointer(&unixConnPtr)) + if conn == nil { + return errors.New("could not initialize socket to journald") + } + + socketAddr := &net.UnixAddr{ + Name: journalSocket, + Net: "unixgram", + } + + data := new(bytes.Buffer) + appendVariable(data, "PRIORITY", strconv.Itoa(int(priority))) + appendVariable(data, "MESSAGE", message) + for k, v := range vars { + appendVariable(data, k, v) + } + + _, _, err := conn.WriteMsgUnix(data.Bytes(), nil, socketAddr) + if err == nil { + return nil + } + if !isSocketSpaceError(err) { + return err + } + + // Large log entry, send it via tempfile and ancillary-fd. + file, err := tempFd() + if err != nil { + return err + } + defer file.Close() + _, err = io.Copy(file, data) + if err != nil { + return err + } + rights := syscall.UnixRights(int(file.Fd())) + _, _, err = conn.WriteMsgUnix([]byte{}, rights, socketAddr) + if err != nil { + return err + } + + return nil +} + +func appendVariable(w io.Writer, name, value string) { + if err := validVarName(name); err != nil { + fmt.Fprintf(os.Stderr, "variable name %s contains invalid character, ignoring\n", name) + } + if strings.ContainsRune(value, '\n') { + /* When the value contains a newline, we write: + * - the variable name, followed by a newline + * - the size (in 64bit little endian format) + * - the data, followed by a newline + */ + fmt.Fprintln(w, name) + binary.Write(w, binary.LittleEndian, uint64(len(value))) + fmt.Fprintln(w, value) + } else { + /* just write the variable and value all on one line */ + fmt.Fprintf(w, "%s=%s\n", name, value) + } +} + +// validVarName validates a variable name to make sure journald will accept it. +// The variable name must be in uppercase and consist only of characters, +// numbers and underscores, and may not begin with an underscore: +// https://www.freedesktop.org/software/systemd/man/sd_journal_print.html +func validVarName(name string) error { + if name == "" { + return errors.New("Empty variable name") + } else if name[0] == '_' { + return errors.New("Variable name begins with an underscore") + } + + for _, c := range name { + if !(('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || c == '_') { + return errors.New("Variable name contains invalid characters") + } + } + return nil +} + +// isSocketSpaceError checks whether the error is signaling +// an "overlarge message" condition. +func isSocketSpaceError(err error) bool { + opErr, ok := err.(*net.OpError) + if !ok || opErr == nil { + return false + } + + sysErr, ok := opErr.Err.(*os.SyscallError) + if !ok || sysErr == nil { + return false + } + + return sysErr.Err == syscall.EMSGSIZE || sysErr.Err == syscall.ENOBUFS +} + +// tempFd creates a temporary, unlinked file under `/dev/shm`. +func tempFd() (*os.File, error) { + file, err := ioutil.TempFile("/dev/shm/", "journal.XXXXX") + if err != nil { + return nil, err + } + err = syscall.Unlink(file.Name()) + if err != nil { + return nil, err + } + return file, nil +} + +// initConn initializes the global `unixConnPtr` socket. +// It is meant to be called exactly once, at program startup. +func initConn() { + autobind, err := net.ResolveUnixAddr("unixgram", "") + if err != nil { + return + } + + sock, err := net.ListenUnixgram("unixgram", autobind) + if err != nil { + return + } + + atomic.StorePointer(&unixConnPtr, unsafe.Pointer(sock)) +} diff --git a/vendor/github.com/coreos/go-systemd/v22/journal/journal_windows.go b/vendor/github.com/coreos/go-systemd/v22/journal/journal_windows.go new file mode 100644 index 00000000000..677aca68ed2 --- /dev/null +++ b/vendor/github.com/coreos/go-systemd/v22/journal/journal_windows.go @@ -0,0 +1,35 @@ +// Copyright 2015 CoreOS, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package journal provides write bindings to the local systemd journal. +// It is implemented in pure Go and connects to the journal directly over its +// unix socket. +// +// To read from the journal, see the "sdjournal" package, which wraps the +// sd-journal a C API. +// +// http://www.freedesktop.org/software/systemd/man/systemd-journald.service.html +package journal + +import ( + "errors" +) + +func Enabled() bool { + return false +} + +func Send(message string, priority Priority, vars map[string]string) error { + return errors.New("could not initialize socket to journald") +} diff --git a/vendor/github.com/go-kit/kit/log/doc.go b/vendor/github.com/go-kit/kit/log/doc.go index 918c0af46f5..f744382fe49 100644 --- a/vendor/github.com/go-kit/kit/log/doc.go +++ b/vendor/github.com/go-kit/kit/log/doc.go @@ -39,8 +39,8 @@ // // A contextual logger stores keyvals that it includes in all log events. // Building appropriate contextual loggers reduces repetition and aids -// consistency in the resulting log output. With and WithPrefix add context to -// a logger. We can use With to improve the RunTask example. +// consistency in the resulting log output. With, WithPrefix, and WithSuffix +// add context to a logger. We can use With to improve the RunTask example. // // func RunTask(task Task, logger log.Logger) string { // logger = log.With(logger, "taskID", task.ID) diff --git a/vendor/github.com/go-kit/kit/log/level/level.go b/vendor/github.com/go-kit/kit/log/level/level.go index fceafc454a5..c0c050f72ff 100644 --- a/vendor/github.com/go-kit/kit/log/level/level.go +++ b/vendor/github.com/go-kit/kit/log/level/level.go @@ -172,7 +172,7 @@ func WarnValue() Value { return warnValue } // InfoValue returns the unique value added to log events by Info. func InfoValue() Value { return infoValue } -// DebugValue returns the unique value added to log events by Warn. +// DebugValue returns the unique value added to log events by Debug. func DebugValue() Value { return debugValue } var ( diff --git a/vendor/github.com/go-kit/kit/log/log.go b/vendor/github.com/go-kit/kit/log/log.go index 66a9e2fde79..29b3b82ffbb 100644 --- a/vendor/github.com/go-kit/kit/log/log.go +++ b/vendor/github.com/go-kit/kit/log/log.go @@ -16,8 +16,8 @@ type Logger interface { var ErrMissingValue = errors.New("(MISSING)") // With returns a new contextual logger with keyvals prepended to those passed -// to calls to Log. If logger is also a contextual logger created by With or -// WithPrefix, keyvals is appended to the existing context. +// to calls to Log. If logger is also a contextual logger created by With, +// WithPrefix, or WithSuffix, keyvals is appended to the existing context. // // The returned Logger replaces all value elements (odd indexes) containing a // Valuer with their generated value for each call to its Log method. @@ -36,14 +36,16 @@ func With(logger Logger, keyvals ...interface{}) Logger { // backing array is created if the slice must grow in Log or With. // Using the extra capacity without copying risks a data race that // would violate the Logger interface contract. - keyvals: kvs[:len(kvs):len(kvs)], - hasValuer: l.hasValuer || containsValuer(keyvals), + keyvals: kvs[:len(kvs):len(kvs)], + hasValuer: l.hasValuer || containsValuer(keyvals), + sKeyvals: l.sKeyvals, + sHasValuer: l.sHasValuer, } } // WithPrefix returns a new contextual logger with keyvals prepended to those // passed to calls to Log. If logger is also a contextual logger created by -// With or WithPrefix, keyvals is prepended to the existing context. +// With, WithPrefix, or WithSuffix, keyvals is prepended to the existing context. // // The returned Logger replaces all value elements (odd indexes) containing a // Valuer with their generated value for each call to its Log method. @@ -67,16 +69,52 @@ func WithPrefix(logger Logger, keyvals ...interface{}) Logger { } kvs = append(kvs, l.keyvals...) return &context{ - logger: l.logger, - keyvals: kvs, - hasValuer: l.hasValuer || containsValuer(keyvals), + logger: l.logger, + keyvals: kvs, + hasValuer: l.hasValuer || containsValuer(keyvals), + sKeyvals: l.sKeyvals, + sHasValuer: l.sHasValuer, } } -// context is the Logger implementation returned by With and WithPrefix. It -// wraps a Logger and holds keyvals that it includes in all log events. Its -// Log method calls bindValues to generate values for each Valuer in the -// context keyvals. +// WithSuffix returns a new contextual logger with keyvals appended to those +// passed to calls to Log. If logger is also a contextual logger created by +// With, WithPrefix, or WithSuffix, keyvals is appended to the existing context. +// +// The returned Logger replaces all value elements (odd indexes) containing a +// Valuer with their generated value for each call to its Log method. +func WithSuffix(logger Logger, keyvals ...interface{}) Logger { + if len(keyvals) == 0 { + return logger + } + l := newContext(logger) + // Limiting the capacity of the stored keyvals ensures that a new + // backing array is created if the slice must grow in Log or With. + // Using the extra capacity without copying risks a data race that + // would violate the Logger interface contract. + n := len(l.sKeyvals) + len(keyvals) + if len(keyvals)%2 != 0 { + n++ + } + kvs := make([]interface{}, 0, n) + kvs = append(kvs, keyvals...) + if len(kvs)%2 != 0 { + kvs = append(kvs, ErrMissingValue) + } + kvs = append(l.sKeyvals, kvs...) + return &context{ + logger: l.logger, + keyvals: l.keyvals, + hasValuer: l.hasValuer, + sKeyvals: kvs, + sHasValuer: l.sHasValuer || containsValuer(keyvals), + } +} + +// context is the Logger implementation returned by With, WithPrefix, and +// WithSuffix. It wraps a Logger and holds keyvals that it includes in all +// log events. Its Log method calls bindValues to generate values for each +// Valuer in the context keyvals. // // A context must always have the same number of stack frames between calls to // its Log method and the eventual binding of Valuers to their value. This @@ -89,13 +127,15 @@ func WithPrefix(logger Logger, keyvals ...interface{}) Logger { // // 1. newContext avoids introducing an additional layer when asked to // wrap another context. -// 2. With and WithPrefix avoid introducing an additional layer by -// returning a newly constructed context with a merged keyvals rather -// than simply wrapping the existing context. +// 2. With, WithPrefix, and WithSuffix avoid introducing an additional +// layer by returning a newly constructed context with a merged keyvals +// rather than simply wrapping the existing context. type context struct { - logger Logger - keyvals []interface{} - hasValuer bool + logger Logger + keyvals []interface{} + sKeyvals []interface{} // suffixes + hasValuer bool + sHasValuer bool } func newContext(logger Logger) *context { @@ -119,7 +159,11 @@ func (l *context) Log(keyvals ...interface{}) error { if len(keyvals) == 0 { kvs = append([]interface{}{}, l.keyvals...) } - bindValues(kvs[:len(l.keyvals)]) + bindValues(kvs[:(len(l.keyvals))]) + } + kvs = append(kvs, l.sKeyvals...) + if l.sHasValuer { + bindValues(kvs[len(kvs) - len(l.sKeyvals):]) } return l.logger.Log(kvs...) } diff --git a/vendor/github.com/go-kit/kit/log/stdlib.go b/vendor/github.com/go-kit/kit/log/stdlib.go index ff96b5dee52..0338edbe2ba 100644 --- a/vendor/github.com/go-kit/kit/log/stdlib.go +++ b/vendor/github.com/go-kit/kit/log/stdlib.go @@ -1,6 +1,7 @@ package log import ( + "bytes" "io" "log" "regexp" @@ -26,9 +27,11 @@ func (w StdlibWriter) Write(p []byte) (int, error) { // messages, and place them under relevant keys. type StdlibAdapter struct { Logger - timestampKey string - fileKey string - messageKey string + timestampKey string + fileKey string + messageKey string + prefix string + joinPrefixToMsg bool } // StdlibAdapterOption sets a parameter for the StdlibAdapter. @@ -49,6 +52,16 @@ func MessageKey(key string) StdlibAdapterOption { return func(a *StdlibAdapter) { a.messageKey = key } } +// Prefix configures the adapter to parse a prefix from stdlib log events. If +// you provide a non-empty prefix to the stdlib logger, then your should provide +// that same prefix to the adapter via this option. +// +// By default, the prefix isn't included in the msg key. Set joinPrefixToMsg to +// true if you want to include the parsed prefix in the msg. +func Prefix(prefix string, joinPrefixToMsg bool) StdlibAdapterOption { + return func(a *StdlibAdapter) { a.prefix = prefix; a.joinPrefixToMsg = joinPrefixToMsg } +} + // NewStdlibAdapter returns a new StdlibAdapter wrapper around the passed // logger. It's designed to be passed to log.SetOutput. func NewStdlibAdapter(logger Logger, options ...StdlibAdapterOption) io.Writer { @@ -65,6 +78,8 @@ func NewStdlibAdapter(logger Logger, options ...StdlibAdapterOption) io.Writer { } func (a StdlibAdapter) Write(p []byte) (int, error) { + p = a.handlePrefix(p) + result := subexps(p) keyvals := []interface{}{} var timestamp string @@ -84,6 +99,7 @@ func (a StdlibAdapter) Write(p []byte) (int, error) { keyvals = append(keyvals, a.fileKey, file) } if msg, ok := result["msg"]; ok { + msg = a.handleMessagePrefix(msg) keyvals = append(keyvals, a.messageKey, msg) } if err := a.Logger.Log(keyvals...); err != nil { @@ -92,11 +108,30 @@ func (a StdlibAdapter) Write(p []byte) (int, error) { return len(p), nil } +func (a StdlibAdapter) handlePrefix(p []byte) []byte { + if a.prefix != "" { + p = bytes.TrimPrefix(p, []byte(a.prefix)) + } + return p +} + +func (a StdlibAdapter) handleMessagePrefix(msg string) string { + if a.prefix == "" { + return msg + } + + msg = strings.TrimPrefix(msg, a.prefix) + if a.joinPrefixToMsg { + msg = a.prefix + msg + } + return msg +} + const ( logRegexpDate = `(?P[0-9]{4}/[0-9]{2}/[0-9]{2})?[ ]?` logRegexpTime = `(?P