Skip to content

Commit 037f4c9

Browse files
committed
Fixes after rebase, and review comments.
Signed-off-by: Tom Wilkie <[email protected]>
1 parent e6d6301 commit 037f4c9

File tree

6 files changed

+116
-48
lines changed

6 files changed

+116
-48
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ $(foreach exe, $(EXES), $(eval $(call dep_exe, $(exe))))
5050
pkg/ingester/client/cortex.pb.go: pkg/ingester/client/cortex.proto
5151
pkg/ring/ring.pb.go: pkg/ring/ring.proto
5252
pkg/querier/frontend/frontend.pb.go: pkg/querier/frontend/frontend.proto
53+
pkg/querier/queryrange/queryrange.pb.go: pkg/querier/queryrange/queryrange.proto
5354
pkg/chunk/storage/caching_index_client.pb.go: pkg/chunk/storage/caching_index_client.proto
5455
pkg/distributor/ha_tracker.pb.go: pkg/distributor/ha_tracker.proto
5556
all: $(UPTODATE_FILES)

pkg/chunk/cache/cache.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ import (
77
)
88

99
// Cache byte arrays by key.
10+
//
11+
// NB we intentionally do not return errors in this interface - caching is best
12+
// effort by definition. We found that when these methods did return errors,
13+
// the caller would just log them - so its easier for implementation to do that.
14+
// Whatsmore, we found partially successful Fetchs were often treated as failed
15+
// when they returned an error.
1016
type Cache interface {
1117
Store(ctx context.Context, key []string, buf [][]byte)
1218
Fetch(ctx context.Context, keys []string) (found []string, bufs [][]byte, missing []string)

pkg/chunk/cache/memcached.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ type Memcached struct {
6666
}
6767

6868
// NewMemcached makes a new Memcache.
69-
// TODO(bwplotka): Return error instead of just log line.
7069
// TODO(bwplotka): Fix metrics, get them out of globals, separate or allow prefixing.
7170
// TODO(bwplotka): Remove globals & util packages from cache package entirely (e.g util.Logger).
7271
func NewMemcached(cfg MemcachedConfig, client MemcachedClient, name string) *Memcached {

pkg/querier/frontend/frontend_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"io/ioutil"
77
"net"
88
"net/http"
9+
"sync/atomic"
910
"testing"
1011
"time"
1112

pkg/querier/queryrange/queryrange.pb.go

Lines changed: 102 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/querier/queryrange/results_cache.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"context"
55
"flag"
66
"fmt"
7-
"log"
87
"sort"
98
"time"
109

10+
"github.com/go-kit/kit/log"
1111
"github.com/go-kit/kit/log/level"
1212
"github.com/gogo/protobuf/proto"
1313
opentracing "github.com/opentracing/opentracing-go"
@@ -257,6 +257,10 @@ func jaegerTraceID(ctx context.Context) string {
257257
return ""
258258
}
259259

260-
spanContext := span.Context().(jaeger.SpanContext)
260+
spanContext, ok := span.Context().(jaeger.SpanContext)
261+
if !ok {
262+
return ""
263+
}
264+
261265
return spanContext.TraceID().String()
262266
}

0 commit comments

Comments
 (0)