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

vendoring: update cortex to latest master #938

Merged
merged 6 commits into from
Aug 28, 2019
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
276 changes: 252 additions & 24 deletions Gopkg.lock

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

[[constraint]]
name = "github.com/weaveworks/common"
source = "https://github.com/tomwilkie/weaveworks-common"
source = "https://github.com/sandlis/weaveworks-common"
cyriltovena marked this conversation as resolved.
Show resolved Hide resolved
branch = "server-listen-addr"

[[constraint]]
Expand All @@ -56,7 +56,7 @@
name = "github.com/prometheus/common"

[[override]]
branch = "master"
version = "v1.0.0"
name = "github.com/prometheus/client_golang"

[[override]]
Expand All @@ -78,3 +78,11 @@
[[constraint]]
name = "github.com/stretchr/testify"
version = "1.3.0"

[[override]]
name = "go.etcd.io/etcd"
version = "v3.4.0-rc.1"

[[override]]
name = "github.com/prometheus/procfs"
version = "v0.0.2"
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,14 @@ publish: dist
########

lint:
GOGC=20 golangci-lint run
GOGC=10 golangci-lint run

########
# Test #
########

test: all
go test -p=8 ./...
go test -p=6 ./...

#########
# Clean #
Expand Down
4 changes: 2 additions & 2 deletions pkg/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (d *Distributor) Push(ctx context.Context, req *logproto.PushRequest) (*log

entries := make([]logproto.Entry, 0, len(stream.Entries))
for _, entry := range stream.Entries {
if err := d.overrides.ValidateSample(userID, metricName, cortex_client.Sample{
if err := validation.ValidateSample(d.overrides, userID, metricName, cortex_client.Sample{
TimestampMs: entry.Timestamp.UnixNano() / int64(time.Millisecond),
}); err != nil {
validationErr = err
Expand Down Expand Up @@ -224,7 +224,7 @@ func (d *Distributor) validateLabels(userID, labels string) error {
return err
}

return d.overrides.ValidateLabels(userID, ls)
return validation.ValidateLabels(d.overrides, userID, ls)
}

// TODO taken from Cortex, see if we can refactor out an usable interface.
Expand Down
15 changes: 10 additions & 5 deletions pkg/ingester/flush_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import (
"testing"
"time"

"github.com/cortexproject/cortex/pkg/ring/kv"
"github.com/cortexproject/cortex/pkg/ring/kv/codec"

"github.com/cortexproject/cortex/pkg/chunk"
"github.com/cortexproject/cortex/pkg/ring"
"github.com/cortexproject/cortex/pkg/util/flagext"
Expand All @@ -31,7 +34,7 @@ func init() {
}

func TestChunkFlushingIdle(t *testing.T) {
cfg := defaultIngesterTestConfig()
cfg := defaultIngesterTestConfig(t)
cfg.FlushCheckPeriod = 20 * time.Millisecond
cfg.MaxChunkIdle = 100 * time.Millisecond
cfg.RetainPeriod = 500 * time.Millisecond
Expand All @@ -45,7 +48,7 @@ func TestChunkFlushingIdle(t *testing.T) {
}

func TestChunkFlushingShutdown(t *testing.T) {
store, ing := newTestStore(t, defaultIngesterTestConfig())
store, ing := newTestStore(t, defaultIngesterTestConfig(t))
userIDs, testData := pushTestSamples(t, ing)
ing.Shutdown()
store.checkData(t, userIDs, testData)
Expand All @@ -69,14 +72,16 @@ func newTestStore(t require.TestingT, cfg Config) (*testStore, *Ingester) {
}

// nolint
func defaultIngesterTestConfig() Config {
consul := ring.NewInMemoryKVClient(ring.ProtoCodec{Factory: ring.ProtoDescFactory})
func defaultIngesterTestConfig(t *testing.T) Config {
kvClient, err := kv.NewClient(kv.Config{Store: "inmemory"}, codec.Proto{Factory: ring.ProtoDescFactory})
require.NoError(t, err)

cfg := Config{}
flagext.DefaultValues(&cfg)
cfg.FlushCheckPeriod = 99999 * time.Hour
cfg.MaxChunkIdle = 99999 * time.Hour
cfg.ConcurrentFlushes = 1
cfg.LifecyclerConfig.RingConfig.KVStore.Mock = consul
cfg.LifecyclerConfig.RingConfig.KVStore.Mock = kvClient
cfg.LifecyclerConfig.NumTokens = 1
cfg.LifecyclerConfig.ListenPort = func(i int) *int { return &i }(0)
cfg.LifecyclerConfig.Addr = "localhost"
Expand Down
2 changes: 1 addition & 1 deletion pkg/ingester/ingester_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

func TestIngester(t *testing.T) {
ingesterConfig := defaultIngesterTestConfig()
ingesterConfig := defaultIngesterTestConfig(t)
store := &mockStore{
chunks: map[string][]chunk.Chunk{},
}
Expand Down
18 changes: 11 additions & 7 deletions pkg/ingester/transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
"google.golang.org/grpc/health/grpc_health_v1"

"github.com/cortexproject/cortex/pkg/ring"
"github.com/cortexproject/cortex/pkg/ring/kv"
"github.com/cortexproject/cortex/pkg/ring/kv/codec"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/weaveworks/common/user"
Expand All @@ -24,7 +26,7 @@ import (
func TestTransferOut(t *testing.T) {
f := newTestIngesterFactory(t)

ing := f.getIngester(time.Duration(0))
ing := f.getIngester(time.Duration(0), t)

// Push some data into our original ingester
ctx := user.InjectOrgID(context.Background(), "test")
Expand Down Expand Up @@ -54,7 +56,7 @@ func TestTransferOut(t *testing.T) {
}

// Create a new ingester and trasfer data to it
ing2 := f.getIngester(time.Second * 60)
ing2 := f.getIngester(time.Second*60, t)
ing.Shutdown()

assert.Len(t, ing2.instances, 1)
Expand Down Expand Up @@ -93,25 +95,27 @@ func TestTransferOut(t *testing.T) {

type testIngesterFactory struct {
t *testing.T
store ring.KVClient
store kv.Client
n int
ingesters map[string]*Ingester
}

func newTestIngesterFactory(t *testing.T) *testIngesterFactory {
kvClient, err := kv.NewClient(kv.Config{Store: "inmemory"}, codec.Proto{Factory: ring.ProtoDescFactory})
require.NoError(t, err)

return &testIngesterFactory{
t: t,
store: ring.NewInMemoryKVClient(ring.ProtoCodec{Factory: ring.ProtoDescFactory}),
store: kvClient,
ingesters: make(map[string]*Ingester),
}
}

func (f *testIngesterFactory) getIngester(joinAfter time.Duration) *Ingester {
func (f *testIngesterFactory) getIngester(joinAfter time.Duration, t *testing.T) *Ingester {
f.n++

cfg := defaultIngesterTestConfig()
cfg := defaultIngesterTestConfig(t)
cfg.MaxTransferRetries = 1
cfg.LifecyclerConfig.ClaimOnRollout = true
cfg.LifecyclerConfig.ID = fmt.Sprintf("localhost-%d", f.n)
cfg.LifecyclerConfig.RingConfig.KVStore.Mock = f.store
cfg.LifecyclerConfig.JoinAfter = joinAfter
Expand Down
202 changes: 202 additions & 0 deletions vendor/github.com/coreos/go-semver/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions vendor/github.com/coreos/go-semver/NOTICE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading