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

Upgrade Cortex #3466

Merged
merged 2 commits into from
Mar 12, 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
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/cespare/xxhash/v2 v2.1.1
github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448 // indirect
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
github.com/cortexproject/cortex v1.7.1-0.20210308081334-2dae12a14c48
github.com/cortexproject/cortex v1.7.1-0.20210310133228-161f103ed5ba
github.com/davecgh/go-spew v1.1.1
github.com/docker/docker v20.10.3+incompatible
github.com/docker/go-metrics v0.0.0-20181218153428-b84716841b82 // indirect
Expand Down Expand Up @@ -74,6 +74,9 @@ require (
k8s.io/klog v1.0.0
)

// Upgrade to run with gRPC 1.3.0 and above.
replace github.com/sercand/kuberesolver => github.com/sercand/kuberesolver v2.4.0+incompatible

replace github.com/hpcloud/tail => github.com/grafana/tail v0.0.0-20201004203643-7aa4e4a91f03

replace github.com/Azure/azure-sdk-for-go => github.com/Azure/azure-sdk-for-go v36.2.0+incompatible
Expand All @@ -91,9 +94,6 @@ replace github.com/satori/go.uuid => github.com/satori/go.uuid v1.2.0
// Use fork of gocql that has gokit logs and Prometheus metrics.
replace github.com/gocql/gocql => github.com/grafana/gocql v0.0.0-20200605141915-ba5dc39ece85

// Same as Cortex, we can't upgrade to grpc 1.30.0 until go.etcd.io/etcd will support it.
replace google.golang.org/grpc => google.golang.org/grpc v1.29.1

// Same as Cortex
// Using a 3rd-party branch for custom dialer - see https://github.com/bradfitz/gomemcache/pull/86
replace github.com/bradfitz/gomemcache => github.com/themihai/gomemcache v0.0.0-20180902122335-24332e2d58ab
Expand Down
142 changes: 48 additions & 94 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pkg/ingester/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strconv"
"time"

"github.com/cortexproject/cortex/pkg/ingester/client"
"github.com/cortexproject/cortex/pkg/cortexpb"
util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/dustin/go-humanize"
"github.com/go-kit/kit/log"
Expand Down Expand Up @@ -267,7 +267,7 @@ func (s *streamIterator) Next() bool {

s.current.UserID = currentInstance.id
s.current.Fingerprint = uint64(stream.fp)
s.current.Labels = client.FromLabelsToLabelAdapters(stream.labels)
s.current.Labels = cortexpb.FromLabelsToLabelAdapters(stream.labels)

s.current.To = stream.lastLine.ts
s.current.LastLine = stream.lastLine.content
Expand Down
6 changes: 3 additions & 3 deletions pkg/ingester/checkpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"time"

"github.com/cortexproject/cortex/pkg/chunk"
cortex_client "github.com/cortexproject/cortex/pkg/ingester/client"
"github.com/cortexproject/cortex/pkg/cortexpb"
"github.com/cortexproject/cortex/pkg/util/services"
"github.com/prometheus/prometheus/pkg/labels"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -476,7 +476,7 @@ func Test_SeriesIterator(t *testing.T) {
it, err := memchunk.Iterator(context.Background(), time.Unix(0, 0), time.Unix(0, 100), logproto.FORWARD, log.NewNoopPipeline().ForStream(nil))
require.NoError(t, err)
stream := logproto.Stream{
Labels: cortex_client.FromLabelAdaptersToLabels(iter.Stream().Labels).String(),
Labels: cortexpb.FromLabelAdaptersToLabels(iter.Stream().Labels).String(),
}
for it.Next() {
stream.Entries = append(stream.Entries, it.Entry())
Expand Down Expand Up @@ -552,7 +552,7 @@ func Benchmark_CheckpointWrite(b *testing.B) {
require.NoError(b, writer.Write(&Series{
UserID: "foo",
Fingerprint: lbs.Hash(),
Labels: cortex_client.FromLabelsToLabelAdapters(lbs),
Labels: cortexpb.FromLabelsToLabelAdapters(lbs),
Chunks: chunks,
}))
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/ingester/encoding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/cortexproject/cortex/pkg/ingester/client"
"github.com/cortexproject/cortex/pkg/cortexpb"
"github.com/prometheus/prometheus/pkg/labels"
"github.com/prometheus/prometheus/tsdb/record"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -242,7 +242,7 @@ func Test_EncodingCheckpoint(t *testing.T) {
s := &Series{
UserID: "fake",
Fingerprint: 123,
Labels: client.FromLabelsToLabelAdapters(ls),
Labels: cortexpb.FromLabelsToLabelAdapters(ls),
To: time.Unix(10, 0),
LastLine: "lastLine",
Chunks: []Chunk{
Expand Down
6 changes: 3 additions & 3 deletions pkg/ingester/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"sync"
"syscall"

"github.com/cortexproject/cortex/pkg/cortexpb"
"github.com/go-kit/kit/log/level"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
Expand All @@ -17,7 +18,6 @@ import (
"github.com/weaveworks/common/httpgrpc"
"go.uber.org/atomic"

"github.com/cortexproject/cortex/pkg/ingester/client"
"github.com/cortexproject/cortex/pkg/ingester/index"
cutil "github.com/cortexproject/cortex/pkg/util"
util_log "github.com/cortexproject/cortex/pkg/util/log"
Expand Down Expand Up @@ -126,7 +126,7 @@ func (i *instance) consumeChunk(ctx context.Context, ls labels.Labels, chunk *lo
stream, ok := i.streamsByFP[fp]
if !ok {

sortedLabels := i.index.Add(client.FromLabelsToLabelAdapters(ls), fp)
sortedLabels := i.index.Add(cortexpb.FromLabelsToLabelAdapters(ls), fp)
stream = newStream(i.cfg, fp, sortedLabels, i.metrics)
i.streamsByFP[fp] = stream
i.streams[stream.labelsString] = stream
Expand Down Expand Up @@ -237,7 +237,7 @@ func (i *instance) getOrCreateStream(pushReqStream logproto.Stream, lock bool, r
}
fp := i.getHashForLabels(labels)

sortedLabels := i.index.Add(client.FromLabelsToLabelAdapters(labels), fp)
sortedLabels := i.index.Add(cortexpb.FromLabelsToLabelAdapters(labels), fp)
stream = newStream(i.cfg, fp, sortedLabels, i.metrics)
i.streams[pushReqStream.Labels] = stream
i.streamsByFP[fp] = stream
Expand Down
4 changes: 2 additions & 2 deletions pkg/ingester/recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime"
"sync"

"github.com/cortexproject/cortex/pkg/ingester/client"
"github.com/cortexproject/cortex/pkg/cortexpb"
util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/go-kit/kit/log/level"
"github.com/pkg/errors"
Expand Down Expand Up @@ -115,7 +115,7 @@ func (r *ingesterRecoverer) Series(series *Series) error {

// TODO(owen-d): create another fn to avoid unnecessary label type conversions.
stream, err := inst.getOrCreateStream(logproto.Stream{
Labels: client.FromLabelAdaptersToLabels(series.Labels).String(),
Labels: cortexpb.FromLabelAdaptersToLabels(series.Labels).String(),
}, true, nil)

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/querier/querier_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func mockReadRingWithOneActiveIngester() *readRingMock {
})
}

func mockInstanceDesc(addr string, state ring.IngesterState) ring.InstanceDesc {
func mockInstanceDesc(addr string, state ring.InstanceState) ring.InstanceDesc {
return ring.InstanceDesc{
Addr: addr,
Timestamp: time.Now().UnixNano(),
Expand Down
8 changes: 4 additions & 4 deletions pkg/querier/queryrange/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
strings "strings"
"time"

"github.com/cortexproject/cortex/pkg/ingester/client"
"github.com/cortexproject/cortex/pkg/cortexpb"
"github.com/cortexproject/cortex/pkg/querier/queryrange"
json "github.com/json-iterator/go"
"github.com/opentracing/opentracing-go"
Expand Down Expand Up @@ -620,15 +620,15 @@ func toProto(m loghttp.Matrix) []queryrange.SampleStream {
}
res := make([]queryrange.SampleStream, 0, len(m))
for _, stream := range m {
samples := make([]client.Sample, 0, len(stream.Values))
samples := make([]cortexpb.Sample, 0, len(stream.Values))
for _, s := range stream.Values {
samples = append(samples, client.Sample{
samples = append(samples, cortexpb.Sample{
Value: float64(s.Value),
TimestampMs: int64(s.Timestamp),
})
}
res = append(res, queryrange.SampleStream{
Labels: client.FromMetricsToLabelAdapters(stream.Metric),
Labels: cortexpb.FromMetricsToLabelAdapters(stream.Metric),
Samples: samples,
})
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/querier/queryrange/codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"testing"
"time"

"github.com/cortexproject/cortex/pkg/ingester/client"
"github.com/cortexproject/cortex/pkg/cortexpb"
"github.com/cortexproject/cortex/pkg/querier/queryrange"
"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -905,12 +905,12 @@ var (
}`
sampleStreams = []queryrange.SampleStream{
{
Labels: []client.LabelAdapter{{Name: "filename", Value: "/var/hostlog/apport.log"}, {Name: "job", Value: "varlogs"}},
Samples: []client.Sample{{Value: 0.013333333333333334, TimestampMs: 1568404331324}},
Labels: []cortexpb.LabelAdapter{{Name: "filename", Value: "/var/hostlog/apport.log"}, {Name: "job", Value: "varlogs"}},
Samples: []cortexpb.Sample{{Value: 0.013333333333333334, TimestampMs: 1568404331324}},
},
{
Labels: []client.LabelAdapter{{Name: "filename", Value: "/var/hostlog/syslog"}, {Name: "job", Value: "varlogs"}},
Samples: []client.Sample{{Value: 3.45, TimestampMs: 1568404331324}, {Value: 4.45, TimestampMs: 1568404331339}},
Labels: []cortexpb.LabelAdapter{{Name: "filename", Value: "/var/hostlog/syslog"}, {Name: "job", Value: "varlogs"}},
Samples: []cortexpb.Sample{{Value: 3.45, TimestampMs: 1568404331324}, {Value: 4.45, TimestampMs: 1568404331339}},
},
}
streamsString = `{
Expand Down
10 changes: 5 additions & 5 deletions pkg/querier/queryrange/downstreamer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"
"time"

"github.com/cortexproject/cortex/pkg/ingester/client"
"github.com/cortexproject/cortex/pkg/cortexpb"
"github.com/cortexproject/cortex/pkg/querier/queryrange"
"github.com/prometheus/prometheus/pkg/labels"
"github.com/prometheus/prometheus/promql"
Expand All @@ -21,8 +21,8 @@ import (
func testSampleStreams() []queryrange.SampleStream {
return []queryrange.SampleStream{
{
Labels: []client.LabelAdapter{{Name: "foo", Value: "bar"}},
Samples: []client.Sample{
Labels: []cortexpb.LabelAdapter{{Name: "foo", Value: "bar"}},
Samples: []cortexpb.Sample{
{
Value: 0,
TimestampMs: 0,
Expand All @@ -38,8 +38,8 @@ func testSampleStreams() []queryrange.SampleStream {
},
},
{
Labels: []client.LabelAdapter{{Name: "bazz", Value: "buzz"}},
Samples: []client.Sample{
Labels: []cortexpb.LabelAdapter{{Name: "bazz", Value: "buzz"}},
Samples: []cortexpb.Sample{
{
Value: 4,
TimestampMs: 4,
Expand Down
4 changes: 2 additions & 2 deletions pkg/querier/queryrange/limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"sync"
"time"

"github.com/cortexproject/cortex/pkg/ingester/client"
"github.com/cortexproject/cortex/pkg/cortexpb"
"github.com/cortexproject/cortex/pkg/querier/queryrange"
"github.com/opentracing/opentracing-go"
"github.com/weaveworks/common/httpgrpc"
Expand Down Expand Up @@ -126,7 +126,7 @@ func (sl *seriesLimiter) Do(ctx context.Context, req queryrange.Request) (queryr
sl.rw.Lock()
var hash uint64
for _, s := range promResponse.Response.Data.Result {
lbs := client.FromLabelAdaptersToLabels(s.Labels)
lbs := cortexpb.FromLabelAdaptersToLabels(s.Labels)
hash, sl.buf = lbs.HashWithoutLabels(sl.buf, []string(nil)...)
sl.hashes[hash] = struct{}{}
}
Expand Down

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

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

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

Loading