Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Chore: Upgrade to latest Cortex #4188

Merged
merged 2 commits into from
Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clients/cmd/docker-driver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"strings"
"time"

cortex_util "github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/flagext"
"github.com/docker/docker/daemon/logger"
"github.com/docker/docker/daemon/logger/templates"
"github.com/grafana/dskit/backoff"
"github.com/pkg/errors"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/pkg/labels"
Expand Down Expand Up @@ -71,7 +71,7 @@ var (
defaultClientConfig = client.Config{
BatchWait: client.BatchWait,
BatchSize: client.BatchSize,
BackoffConfig: cortex_util.BackoffConfig{
BackoffConfig: backoff.Config{
MinBackoff: client.MinBackoff,
MaxBackoff: client.MaxBackoff,
MaxRetries: client.MaxRetries,
Expand Down
9 changes: 4 additions & 5 deletions clients/cmd/fluent-bit/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import (
"testing"
"time"

"github.com/prometheus/common/model"

"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/flagext"
"github.com/grafana/dskit/backoff"
"github.com/prometheus/common/model"
"github.com/weaveworks/common/logging"

"github.com/grafana/loki/clients/pkg/promtail/client"
Expand Down Expand Up @@ -77,7 +76,7 @@ func Test_parseConfig(t *testing.T) {
BatchWait: mustParseDuration("30s"),
Timeout: mustParseDuration("1s"),
ExternalLabels: lokiflag.LabelSet{LabelSet: model.LabelSet{"app": "foo"}},
BackoffConfig: util.BackoffConfig{MinBackoff: mustParseDuration("1ms"), MaxBackoff: mustParseDuration("5m"), MaxRetries: 10},
BackoffConfig: backoff.Config{MinBackoff: mustParseDuration("1ms"), MaxBackoff: mustParseDuration("5m"), MaxRetries: 10},
},
logLevel: mustParseLogLevel("warn"),
labelKeys: []string{"foo", "bar"},
Expand Down Expand Up @@ -111,7 +110,7 @@ func Test_parseConfig(t *testing.T) {
BatchWait: mustParseDuration("30s"),
Timeout: mustParseDuration("1s"),
ExternalLabels: lokiflag.LabelSet{LabelSet: model.LabelSet{"app": "foo"}},
BackoffConfig: util.BackoffConfig{MinBackoff: mustParseDuration("1ms"), MaxBackoff: mustParseDuration("5m"), MaxRetries: 10},
BackoffConfig: backoff.Config{MinBackoff: mustParseDuration("1ms"), MaxBackoff: mustParseDuration("5m"), MaxRetries: 10},
},
logLevel: mustParseLogLevel("warn"),
labelKeys: nil,
Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/promtail/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import (

"github.com/prometheus/prometheus/promql/parser"

"github.com/grafana/dskit/backoff"
"github.com/grafana/loki/clients/pkg/logentry/metric"
"github.com/grafana/loki/clients/pkg/promtail/api"

lokiutil "github.com/grafana/loki/pkg/util"

"github.com/cortexproject/cortex/pkg/util"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"

Expand Down Expand Up @@ -301,7 +301,7 @@ func (c *client) sendBatch(tenantID string, batch *batch) {
bufBytes := float64(len(buf))
c.metrics.encodedBytes.WithLabelValues(c.cfg.URL.Host).Add(bufBytes)

backoff := util.NewBackoff(c.ctx, c.cfg.BackoffConfig)
backoff := backoff.New(c.ctx, c.cfg.BackoffConfig)
var status int
for {
start := time.Now()
Expand Down
5 changes: 3 additions & 2 deletions clients/pkg/promtail/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/flagext"
"github.com/grafana/dskit/backoff"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/testutil"
"github.com/prometheus/common/config"
Expand Down Expand Up @@ -260,7 +261,7 @@ func TestClient_Handle(t *testing.T) {
BatchWait: testData.clientBatchWait,
BatchSize: testData.clientBatchSize,
Client: config.HTTPClientConfig{},
BackoffConfig: util.BackoffConfig{MinBackoff: 1 * time.Millisecond, MaxBackoff: 2 * time.Millisecond, MaxRetries: testData.clientMaxRetries},
BackoffConfig: backoff.Config{MinBackoff: 1 * time.Millisecond, MaxBackoff: 2 * time.Millisecond, MaxRetries: testData.clientMaxRetries},
ExternalLabels: lokiflag.LabelSet{},
Timeout: 1 * time.Second,
TenantID: testData.clientTenantID,
Expand Down Expand Up @@ -392,7 +393,7 @@ func TestClient_StopNow(t *testing.T) {
BatchWait: c.clientBatchWait,
BatchSize: c.clientBatchSize,
Client: config.HTTPClientConfig{},
BackoffConfig: util.BackoffConfig{MinBackoff: 5 * time.Second, MaxBackoff: 10 * time.Second, MaxRetries: c.clientMaxRetries},
BackoffConfig: backoff.Config{MinBackoff: 5 * time.Second, MaxBackoff: 10 * time.Second, MaxRetries: c.clientMaxRetries},
ExternalLabels: lokiflag.LabelSet{},
Timeout: 1 * time.Second,
TenantID: c.clientTenantID,
Expand Down
6 changes: 3 additions & 3 deletions clients/pkg/promtail/client/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"flag"
"time"

"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/flagext"
"github.com/grafana/dskit/backoff"
"github.com/prometheus/common/config"

lokiflag "github.com/grafana/loki/pkg/util/flagext"
Expand All @@ -29,7 +29,7 @@ type Config struct {

Client config.HTTPClientConfig `yaml:",inline"`

BackoffConfig util.BackoffConfig `yaml:"backoff_config"`
BackoffConfig backoff.Config `yaml:"backoff_config"`
// The labels to add to any time series or alerts when communicating with loki
ExternalLabels lokiflag.LabelSet `yaml:"external_labels,omitempty"`
Timeout time.Duration `yaml:"timeout"`
Expand Down Expand Up @@ -70,7 +70,7 @@ func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error {
} else {
// force sane defaults.
cfg = raw{
BackoffConfig: util.BackoffConfig{
BackoffConfig: backoff.Config{
MaxBackoff: MaxBackoff,
MaxRetries: MaxRetries,
MinBackoff: MinBackoff,
Expand Down
6 changes: 3 additions & 3 deletions clients/pkg/promtail/client/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"testing"
"time"

"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/flagext"
"github.com/grafana/dskit/backoff"
"github.com/stretchr/testify/require"

"gopkg.in/yaml.v2"
Expand Down Expand Up @@ -43,7 +43,7 @@ func Test_Config(t *testing.T) {
URL: flagext.URLValue{
URL: u,
},
BackoffConfig: util.BackoffConfig{
BackoffConfig: backoff.Config{
MaxBackoff: MaxBackoff,
MaxRetries: MaxRetries,
MinBackoff: MinBackoff,
Expand All @@ -59,7 +59,7 @@ func Test_Config(t *testing.T) {
URL: flagext.URLValue{
URL: u,
},
BackoffConfig: util.BackoffConfig{
BackoffConfig: backoff.Config{
MaxBackoff: 1 * time.Minute,
MaxRetries: 20,
MinBackoff: 5 * time.Second,
Expand Down
6 changes: 3 additions & 3 deletions clients/pkg/promtail/client/multi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"testing"
"time"

"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/flagext"
util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/go-kit/kit/log"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/require"

"github.com/grafana/dskit/backoff"
"github.com/grafana/loki/clients/pkg/promtail/api"

"github.com/grafana/loki/pkg/logproto"
Expand Down Expand Up @@ -123,9 +123,9 @@ func TestMultiClient_Handle(t *testing.T) {
func TestMultiClient_Handle_Race(t *testing.T) {
u := flagext.URLValue{}
require.NoError(t, u.Set("http://localhost"))
c1, err := New(nil, Config{URL: u, BackoffConfig: util.BackoffConfig{MaxRetries: 1}, Timeout: time.Microsecond}, log.NewNopLogger())
c1, err := New(nil, Config{URL: u, BackoffConfig: backoff.Config{MaxRetries: 1}, Timeout: time.Microsecond}, log.NewNopLogger())
require.NoError(t, err)
c2, err := New(nil, Config{URL: u, BackoffConfig: util.BackoffConfig{MaxRetries: 1}, Timeout: time.Microsecond}, log.NewNopLogger())
c2, err := New(nil, Config{URL: u, BackoffConfig: backoff.Config{MaxRetries: 1}, Timeout: time.Microsecond}, log.NewNopLogger())
require.NoError(t, err)
clients := []Client{c1, c2}
m := &MultiClient{
Expand Down
4 changes: 2 additions & 2 deletions clients/pkg/promtail/targets/syslog/syslogtarget.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"sync"
"time"

"github.com/cortexproject/cortex/pkg/util"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/grafana/dskit/backoff"
"github.com/influxdata/go-syslog/v3"
"github.com/influxdata/go-syslog/v3/rfc5424"
"github.com/mwitkow/go-conntrack"
Expand Down Expand Up @@ -105,7 +105,7 @@ func (t *SyslogTarget) acceptConnections() {

l := log.With(t.logger, "address", t.listener.Addr().String())

backoff := util.NewBackoff(t.ctx, util.BackoffConfig{
backoff := backoff.New(t.ctx, backoff.Config{
MinBackoff: 5 * time.Millisecond,
MaxBackoff: 1 * time.Second,
})
Expand Down
13 changes: 7 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ require (
github.com/Workiva/go-datastructures v1.0.53
github.com/alicebob/miniredis/v2 v2.14.3
github.com/aws/aws-lambda-go v1.17.0
github.com/aws/aws-sdk-go v1.38.60
github.com/aws/aws-sdk-go v1.38.68
github.com/bmatcuk/doublestar v1.2.2
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b
github.com/buger/jsonparser v1.1.1
github.com/c2h5oh/datasize v0.0.0-20200112174442-28bbd4740fee
github.com/cespare/xxhash v1.1.0
github.com/cespare/xxhash/v2 v2.1.1
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
github.com/cortexproject/cortex v1.9.1-0.20210726155107-a4bf10354786
github.com/cortexproject/cortex v1.10.1-0.20210818115638-df9af3a99954
github.com/davecgh/go-spew v1.1.1
github.com/docker/docker v20.10.7+incompatible
github.com/docker/go-plugins-helpers v0.0.0-20181025120712-1e6269c305b8
Expand All @@ -32,7 +32,7 @@ require (
github.com/felixge/fgprof v0.9.1
github.com/fluent/fluent-bit-go v0.0.0-20190925192703-ea13c021720c
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-logfmt/logfmt v0.5.0
github.com/go-redis/redis/v8 v8.9.0
github.com/gocql/gocql v0.0.0-20200526081602-cd04bd7f22a7
Expand All @@ -44,6 +44,7 @@ require (
github.com/google/go-cmp v0.5.6
github.com/gorilla/mux v1.7.3
github.com/gorilla/websocket v1.4.2
github.com/grafana/dskit v0.0.0-20210817085554-1b69d2de136f
github.com/grpc-ecosystem/go-grpc-middleware v1.2.2
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.1-0.20191002090509-6af20e3a5340 // indirect
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645
Expand All @@ -56,7 +57,7 @@ require (
github.com/jmespath/go-jmespath v0.4.0
github.com/joncrlsn/dque v2.2.1-0.20200515025108-956d14155fa2+incompatible
github.com/json-iterator/go v1.1.11
github.com/klauspost/compress v1.11.13
github.com/klauspost/compress v1.13.1
github.com/klauspost/pgzip v1.2.5
github.com/minio/minio-go/v7 v7.0.10
github.com/mitchellh/mapstructure v1.4.1
Expand All @@ -79,13 +80,13 @@ require (
github.com/sony/gobreaker v0.4.1
github.com/spf13/afero v1.2.2
github.com/stretchr/testify v1.7.0
github.com/thanos-io/thanos v0.19.1-0.20210427154226-d5bd651319d2
github.com/thanos-io/thanos v0.19.1-0.20210729154440-aa148f8fdb28
github.com/tonistiigi/fifo v0.0.0-20190226154929-a9fb20d87448
github.com/uber/jaeger-client-go v2.29.1+incompatible
github.com/ugorji/go v1.1.7 // indirect
github.com/weaveworks/common v0.0.0-20210506120931-f2676019da11
go.etcd.io/bbolt v1.3.5
go.uber.org/atomic v1.8.0
go.uber.org/atomic v1.9.0
go.uber.org/goleak v1.1.10
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b
Expand Down
Loading