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 upstream function to new package
Signed-off-by: Jacob Lisi <jacob.t.lisi@gmail.com>
  • Loading branch information
jtlisi committed Jan 28, 2021
commit 9c87416615ecf7af5c54033d959b009d99c2a693
3 changes: 2 additions & 1 deletion pkg/distributor/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

"github.com/cortexproject/cortex/pkg/util"
util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/dustin/go-humanize"
"github.com/go-kit/kit/log/level"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -61,7 +62,7 @@ func (d *Distributor) PushHandler(w http.ResponseWriter, r *http.Request) {

func ParseRequest(r *http.Request) (*logproto.PushRequest, error) {
userID, _ := user.ExtractOrgID(r.Context())
logger := util.WithContext(r.Context(), util.Logger)
logger := util_log.WithContext(r.Context(), util.Logger)
body := lokiutil.NewSizeReader(r.Body)
contentType := r.Header.Get(contentType)
var req logproto.PushRequest
Expand Down
3 changes: 2 additions & 1 deletion pkg/helpers/logerror.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"

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

Expand All @@ -17,6 +18,6 @@ func LogError(message string, f func() error) {
// LogError logs any error returned by f; useful when deferring Close etc.
func LogErrorWithContext(ctx context.Context, message string, f func() error) {
if err := f(); err != nil {
level.Error(util.WithContext(ctx, util.Logger)).Log("message", message, "error", err)
level.Error(util_log.WithContext(ctx, util.Logger)).Log("message", message, "error", err)
}
}
3 changes: 2 additions & 1 deletion pkg/ingester/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"time"

"github.com/cortexproject/cortex/pkg/util"
util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/go-kit/kit/log/level"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
Expand Down Expand Up @@ -180,7 +181,7 @@ func (s *stream) Push(
if err != nil {
// This should be an unlikely situation, returning an error up the stack doesn't help much here
// so instead log this to help debug the issue if it ever arises.
level.Error(util.WithContext(ctx, util.Logger)).Log("msg", "failed to Close chunk", "err", err)
level.Error(util_log.WithContext(ctx, util.Logger)).Log("msg", "failed to Close chunk", "err", err)
}
chunk.closed = true

Expand Down
3 changes: 2 additions & 1 deletion pkg/ingester/tailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

cortex_util "github.com/cortexproject/cortex/pkg/util"
util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/go-kit/kit/log/level"
"github.com/prometheus/prometheus/pkg/labels"
"golang.org/x/net/context"
Expand Down Expand Up @@ -101,7 +102,7 @@ func (t *tailer) loop() {
if err != nil {
// Don't log any error due to tail client closing the connection
if !util.IsConnCanceled(err) {
level.Error(cortex_util.WithContext(t.conn.Context(), cortex_util.Logger)).Log("msg", "Error writing to tail client", "err", err)
level.Error(util_log.WithContext(t.conn.Context(), cortex_util.Logger)).Log("msg", "Error writing to tail client", "err", err)
}
t.close()
return
Expand Down
7 changes: 4 additions & 3 deletions pkg/ingester/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/cortexproject/cortex/pkg/ring"
"github.com/cortexproject/cortex/pkg/util"
util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/go-kit/kit/log/level"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -36,7 +37,7 @@ var (
// TransferChunks receives all chunks from another ingester. The Ingester
// must be in PENDING state or else the call will fail.
func (i *Ingester) TransferChunks(stream logproto.Ingester_TransferChunksServer) error {
logger := util.WithContext(stream.Context(), util.Logger)
logger := util_log.WithContext(stream.Context(), util.Logger)
// Prevent a shutdown from happening until we've completely finished a handoff
// from a leaving ingester.
i.shutdownMtx.Lock()
Expand Down Expand Up @@ -197,15 +198,15 @@ func (i *Ingester) TransferOut(ctx context.Context) error {
return nil
}

level.Error(util.WithContext(ctx, util.Logger)).Log("msg", "transfer failed", "err", err)
level.Error(util_log.WithContext(ctx, util.Logger)).Log("msg", "transfer failed", "err", err)
backoff.Wait()
}

return backoff.Err()
}

func (i *Ingester) transferOut(ctx context.Context) error {
logger := util.WithContext(ctx, util.Logger)
logger := util_log.WithContext(ctx, util.Logger)
targetIngester, err := i.findTransferTarget(ctx)
if err != nil {
return fmt.Errorf("cannot find ingester to transfer chunks to: %v", err)
Expand Down
3 changes: 2 additions & 1 deletion pkg/logql/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

"github.com/cortexproject/cortex/pkg/util"
util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/dustin/go-humanize"
"github.com/go-kit/kit/log/level"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -65,7 +66,7 @@ var (
)

func RecordMetrics(ctx context.Context, p Params, status string, stats stats.Result) {
logger := util.WithContext(ctx, util.Logger)
logger := util_log.WithContext(ctx, util.Logger)
queryType, err := QueryType(p.Query())
if err != nil {
level.Warn(logger).Log("msg", "error parsing query type", "err", err)
Expand Down
5 changes: 3 additions & 2 deletions pkg/logql/stats/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"sync"

"github.com/cortexproject/cortex/pkg/util"
util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/go-kit/kit/log/level"
jsoniter "github.com/json-iterator/go"
"google.golang.org/grpc"
Expand Down Expand Up @@ -47,7 +48,7 @@ func CollectTrailer(ctx context.Context) grpc.CallOption {
func SendAsTrailer(ctx context.Context, stream grpc.ServerStream) {
trailer, err := encodeTrailer(ctx)
if err != nil {
level.Warn(util.WithContext(ctx, util.Logger)).Log("msg", "failed to encode trailer", "err", err)
level.Warn(util_log.WithContext(ctx, util.Logger)).Log("msg", "failed to encode trailer", "err", err)
return
}
stream.SetTrailer(trailer)
Expand Down Expand Up @@ -110,7 +111,7 @@ func decodeTrailers(ctx context.Context) Result {
}

func decodeTrailer(ctx context.Context, meta *metadata.MD) Result {
logger := util.WithContext(ctx, util.Logger)
logger := util_log.WithContext(ctx, util.Logger)
var ingData IngesterData
values := meta.Get(ingesterDataKey)
if len(values) == 1 {
Expand Down
3 changes: 2 additions & 1 deletion pkg/querier/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

"github.com/cortexproject/cortex/pkg/util"
util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/go-kit/kit/log/level"
"github.com/gorilla/websocket"
"github.com/prometheus/prometheus/pkg/labels"
Expand Down Expand Up @@ -198,7 +199,7 @@ func (q *Querier) TailHandler(w http.ResponseWriter, r *http.Request) {
upgrader := websocket.Upgrader{
CheckOrigin: func(r *http.Request) bool { return true },
}
logger := util.WithContext(r.Context(), util.Logger)
logger := util_log.WithContext(r.Context(), util.Logger)

req, err := loghttp.ParseTailQuery(r)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/querier/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

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

Expand Down Expand Up @@ -198,7 +199,7 @@ func (t *Tailer) readTailClient(addr string, querierTailClient logproto.Querier_
var err error
defer t.dropTailClient(addr)

logger := util.WithContext(querierTailClient.Context(), util.Logger)
logger := util_log.WithContext(querierTailClient.Context(), util.Logger)
for {
if t.stopped {
if err := querierTailClient.CloseSend(); err != nil {
Expand Down