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

Chore: Upgrade weaveworks/common #4462

Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
* [ENHANCEMENT] Memberlist: expose configuration of memberlist packet compression via `-memberlist.compression=enabled`. #4346
* [ENHANCEMENT] Update Go version to 1.16.6. #4362
* [ENHANCEMENT] Updated Prometheus to include changes from prometheus/prometheus#9083. Now whenever `/labels` API calls include matchers, blocks store is queried for `LabelNames` with matchers instead of `Series` calls which was inefficient. #4380
* [ENHANCEMENT] Exemplars are now emitted for all gRPC calls and many operations tracked by histograms. #4462
* [ENHANCEMENT] New options `-server.http-listen-network` and `-server.grpc-listen-network` allow binding as 'tcp4' or 'tcp6'. #4462
* [BUGFIX] Compactor: compactor will no longer try to compact blocks that are already marked for deletion. Previously compactor would consider blocks marked for deletion within `-compactor.deletion-delay / 2` period as eligible for compaction. #4328
* [BUGFIX] HA Tracker: when cleaning up obsolete elected replicas from KV store, tracker didn't update number of cluster per user correctly. #4336
* [BUGFIX] Ruler: fixed counting of PromQL evaluation errors as user-errors when updating `cortex_ruler_queries_failed_total`. #4335
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ require (
github.com/stretchr/testify v1.7.0
github.com/thanos-io/thanos v0.22.0
github.com/uber/jaeger-client-go v2.29.1+incompatible
github.com/weaveworks/common v0.0.0-20210722103813-e649eff5ab4a
github.com/weaveworks/common v0.0.0-20210901124008-1fa3f9fa874c
go.etcd.io/bbolt v1.3.6
go.uber.org/atomic v1.9.0
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1765,8 +1765,9 @@ github.com/weaveworks/common v0.0.0-20200914083218-61ffdd448099/go.mod h1:hz10LO
github.com/weaveworks/common v0.0.0-20201119133501-0619918236ec/go.mod h1:ykzWac1LtVfOxdCK+jD754at1Ws9dKCwFeUzkFBffPs=
github.com/weaveworks/common v0.0.0-20210112142934-23c8d7fa6120/go.mod h1:ykzWac1LtVfOxdCK+jD754at1Ws9dKCwFeUzkFBffPs=
github.com/weaveworks/common v0.0.0-20210419092856-009d1eebd624/go.mod h1:ykzWac1LtVfOxdCK+jD754at1Ws9dKCwFeUzkFBffPs=
github.com/weaveworks/common v0.0.0-20210722103813-e649eff5ab4a h1:ALomSnvy/NPeVoc4a1o7keaHHgLS76r9ZYIlwWWF+KA=
github.com/weaveworks/common v0.0.0-20210722103813-e649eff5ab4a/go.mod h1:YU9FvnS7kUnRt6HY10G+2qHkwzP3n3Vb1XsXDsJTSp8=
github.com/weaveworks/common v0.0.0-20210901124008-1fa3f9fa874c h1:+yzwVr4/12cUgsdjbEHq6MsKB7jWBZpZccAP6xvqTzQ=
github.com/weaveworks/common v0.0.0-20210901124008-1fa3f9fa874c/go.mod h1:YU9FvnS7kUnRt6HY10G+2qHkwzP3n3Vb1XsXDsJTSp8=
github.com/weaveworks/promrus v1.2.0 h1:jOLf6pe6/vss4qGHjXmGz4oDJQA+AOCqEL3FvvZGz7M=
github.com/weaveworks/promrus v1.2.0/go.mod h1:SaE82+OJ91yqjrE1rsvBWVzNZKcHYFtMUyS1+Ogs/KA=
github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
Expand Down
18 changes: 4 additions & 14 deletions pkg/chunk/cache/memcached.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@ import (
"github.com/cortexproject/cortex/pkg/util/spanlogger"
)

type observableVecCollector struct {
v prometheus.ObserverVec
}

func (observableVecCollector) Register() {}
func (observableVecCollector) Before(method string, start time.Time) {}
func (o observableVecCollector) After(method, statusCode string, start time.Time) {
o.v.WithLabelValues(method, statusCode).Observe(time.Since(start).Seconds())
}

// MemcachedConfig is config to make a Memcached
type MemcachedConfig struct {
Expiration time.Duration `yaml:"expiration"`
Expand All @@ -51,7 +41,7 @@ type Memcached struct {
memcache MemcachedClient
name string

requestDuration observableVecCollector
requestDuration *instr.HistogramCollector

wg sync.WaitGroup
inputCh chan *work
Expand All @@ -67,16 +57,16 @@ func NewMemcached(cfg MemcachedConfig, client MemcachedClient, name string, reg
memcache: client,
name: name,
logger: logger,
requestDuration: observableVecCollector{
v: promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
requestDuration: instr.NewHistogramCollector(
promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
Namespace: "cortex",
Name: "memcache_request_duration_seconds",
Help: "Total time spent in seconds doing memcache requests.",
// Memcached requests are very quick: smallest bucket is 16us, biggest is 1s
Buckets: prometheus.ExponentialBuckets(0.000016, 4, 8),
ConstLabels: prometheus.Labels{"name": name},
}, []string{"method", "status_code"}),
},
),
}

if cfg.BatchSize == 0 || cfg.Parallelism == 0 {
Expand Down
8 changes: 4 additions & 4 deletions pkg/chunk/cache/redis_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type RedisCache struct {
name string
redis *RedisClient
logger log.Logger
requestDuration observableVecCollector
requestDuration *instr.HistogramCollector
}

// NewRedisCache creates a new RedisCache
Expand All @@ -29,15 +29,15 @@ func NewRedisCache(name string, redisClient *RedisClient, reg prometheus.Registe
name: name,
redis: redisClient,
logger: logger,
requestDuration: observableVecCollector{
v: promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
requestDuration: instr.NewHistogramCollector(
promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
Namespace: "cortex",
Name: "rediscache_request_duration_seconds",
Help: "Total time spent in seconds doing Redis requests.",
Buckets: prometheus.ExponentialBuckets(0.000016, 4, 8),
ConstLabels: prometheus.Labels{"name": name},
}, []string{"method", "status_code"}),
},
),
}
if err := cache.redis.Ping(context.Background()); err != nil {
level.Error(logger).Log("msg", "error connecting to redis", "name", name, "err", err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/querier/queryrange/instrumentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type NoopCollector struct{}
func (c *NoopCollector) Register() {}

// Before implements instrument.Collector.
func (c *NoopCollector) Before(method string, start time.Time) {}
func (c *NoopCollector) Before(ctx context.Context, method string, start time.Time) {}

// After implements instrument.Collector.
func (c *NoopCollector) After(method, statusCode string, start time.Time) {}
func (c *NoopCollector) After(ctx context.Context, method, statusCode string, start time.Time) {}
4 changes: 2 additions & 2 deletions pkg/util/log/wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/go-kit/kit/log"
kitlog "github.com/go-kit/kit/log"
"github.com/weaveworks/common/middleware"
"github.com/weaveworks/common/tracing"

"github.com/cortexproject/cortex/pkg/tenant"
)
Expand Down Expand Up @@ -38,7 +38,7 @@ func WithContext(ctx context.Context, l kitlog.Logger) kitlog.Logger {
l = WithUserID(userID, l)
}

traceID, ok := middleware.ExtractTraceID(ctx)
traceID, ok := tracing.ExtractSampledTraceID(ctx)
if !ok {
return l
}
Expand Down
33 changes: 24 additions & 9 deletions vendor/github.com/weaveworks/common/instrument/instrument.go

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.

31 changes: 0 additions & 31 deletions vendor/github.com/weaveworks/common/middleware/http_tracing.go

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

14 changes: 3 additions & 11 deletions vendor/github.com/weaveworks/common/middleware/instrument.go

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

3 changes: 2 additions & 1 deletion vendor/github.com/weaveworks/common/middleware/logging.go

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

14 changes: 11 additions & 3 deletions vendor/github.com/weaveworks/common/server/server.go

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

Loading