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

update vendored cortex and add new replace overrides #3256

Merged
merged 4 commits into from
Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update all moved functions
Signed-off-by: Jacob Lisi <jacob.t.lisi@gmail.com>
  • Loading branch information
jtlisi committed Jan 28, 2021
commit 806a4def04d22c7b8e2753e202486553e2d5b7bc
5 changes: 3 additions & 2 deletions cmd/loki/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
logutil "github.com/grafana/loki/pkg/util"

"github.com/cortexproject/cortex/pkg/util"
util_log "github.com/cortexproject/cortex/pkg/util/log"

"github.com/grafana/loki/pkg/util/validation"
)
Expand Down Expand Up @@ -125,10 +126,10 @@ func main() {

// Start Loki
t, err := loki.New(config.Config)
util.CheckFatal("initialising loki", err)
util_log.CheckFatal("initialising loki", err)

level.Info(util.Logger).Log("msg", "Starting Loki", "version", version.Info())

err = t.Run()
util.CheckFatal("running loki", err)
util_log.CheckFatal("running loki", err)
}
3 changes: 2 additions & 1 deletion pkg/ingester/flush.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (

"github.com/cortexproject/cortex/pkg/chunk"
"github.com/cortexproject/cortex/pkg/util"
util_log "github.com/cortexproject/cortex/pkg/util/log"

"github.com/grafana/loki/pkg/chunkenc"
loki_util "github.com/grafana/loki/pkg/util"
Expand Down Expand Up @@ -215,7 +216,7 @@ func (i *Ingester) flushLoop(j int) {

err := i.flushUserSeries(op.userID, op.fp, op.immediate)
if err != nil {
level.Error(util.WithUserID(op.userID, util.Logger)).Log("msg", "failed to flush user", "err", err)
level.Error(util_log.WithUserID(op.userID, util.Logger)).Log("msg", "failed to flush user", "err", err)
}

// If we're exiting & we failed to flush, put the failed operation
Expand Down
3 changes: 2 additions & 1 deletion pkg/loki/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/cortexproject/cortex/pkg/ring/kv/memberlist"
cortex_ruler "github.com/cortexproject/cortex/pkg/ruler"
"github.com/cortexproject/cortex/pkg/util"
util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/cortexproject/cortex/pkg/util/runtimeconfig"
"github.com/cortexproject/cortex/pkg/util/services"

Expand Down Expand Up @@ -261,7 +262,7 @@ func (t *Loki) initTableManager() (services.Service, error) {
}

bucketClient, err := storage.NewBucketClient(t.cfg.StorageConfig.Config)
util.CheckFatal("initializing bucket client", err)
util_log.CheckFatal("initializing bucket client", err)

t.tableManager, err = chunk.NewTableManager(t.cfg.TableManager, t.cfg.SchemaConfig.SchemaConfig, maxChunkAgeForTableManager, tableClient, bucketClient, nil, prometheus.DefaultRegisterer)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/storage/stores/shipper/compactor/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/cortexproject/cortex/pkg/chunk"
chunk_util "github.com/cortexproject/cortex/pkg/chunk/util"
"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/math"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"github.com/cortexproject/cortex/pkg/util/math"
util_math "github.com/cortexproject/cortex/pkg/util/math"

"github.com/go-kit/kit/log/level"
"go.etcd.io/bbolt"

Expand Down Expand Up @@ -90,7 +91,7 @@ func (t *table) compact() error {

errChan := make(chan error)
readObjectChan := make(chan string)
n := util.Min(len(objects), readDBsParallelism)
n := math.Min(len(objects), readDBsParallelism)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind making these consistently util_math?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
n := math.Min(len(objects), readDBsParallelism)
n := util_math.Min(len(objects), readDBsParallelism)


// read files parallelly
for i := 0; i < n; i++ {
Expand Down
3 changes: 2 additions & 1 deletion pkg/storage/stores/shipper/downloads/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/cortexproject/cortex/pkg/chunk"
chunk_util "github.com/cortexproject/cortex/pkg/chunk/util"
"github.com/cortexproject/cortex/pkg/util"
util_math "github.com/cortexproject/cortex/pkg/util/math"
"github.com/cortexproject/cortex/pkg/util/spanlogger"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
Expand Down Expand Up @@ -492,7 +493,7 @@ func (t *Table) doParallelDownload(ctx context.Context, objects []chunk.StorageO
defer cancel()

queue := make(chan chunk.StorageObject)
n := util.Min(len(objects), downloadParallelism)
n := util_math.Min(len(objects), downloadParallelism)
incomingErrors := make(chan error)

// Run n parallel goroutines fetching objects to download from the queue
Expand Down
4 changes: 2 additions & 2 deletions pkg/storage/stores/shipper/util/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/cortexproject/cortex/pkg/chunk"
chunk_util "github.com/cortexproject/cortex/pkg/chunk/util"
"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/math"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"github.com/cortexproject/cortex/pkg/util/math"
util_math "github.com/cortexproject/cortex/pkg/util/math"

)

const maxQueriesPerGoroutine = 100
Expand All @@ -34,7 +34,7 @@ func DoParallelQueries(ctx context.Context, tableQuerier TableQuerier, queries [
errs := make(chan error)

for i := 0; i < len(queries); i += maxQueriesPerGoroutine {
q := queries[i:util.Min(i+maxQueriesPerGoroutine, len(queries))]
q := queries[i:math.Min(i+maxQueriesPerGoroutine, len(queries))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
q := queries[i:math.Min(i+maxQueriesPerGoroutine, len(queries))]
q := queries[i:util_math.Min(i+maxQueriesPerGoroutine, len(queries))]

go func(queries []chunk.IndexQuery) {
errs <- tableQuerier.MultiQueries(ctx, queries, callback)
}(q)
Expand Down