Skip to content

Commit 028c4b3

Browse files
authored
Chore: Upgrade weaveworks/common (#4462)
* Chore: Upgrade weaveworks/common Signed-off-by: Arve Knudsen <[email protected]> * Add changelog entries Signed-off-by: Arve Knudsen <[email protected]> * Use instrument.NewHistogramCollector Signed-off-by: Arve Knudsen <[email protected]> * Use tracing.ExtractSampledTraceID Signed-off-by: Arve Knudsen <[email protected]>
1 parent 23aed55 commit 028c4b3

File tree

15 files changed

+95
-84
lines changed

15 files changed

+95
-84
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
* [ENHANCEMENT] Memberlist: expose configuration of memberlist packet compression via `-memberlist.compression=enabled`. #4346
3838
* [ENHANCEMENT] Update Go version to 1.16.6. #4362
3939
* [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
40+
* [ENHANCEMENT] Exemplars are now emitted for all gRPC calls and many operations tracked by histograms. #4462
41+
* [ENHANCEMENT] New options `-server.http-listen-network` and `-server.grpc-listen-network` allow binding as 'tcp4' or 'tcp6'. #4462
4042
* [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
4143
* [BUGFIX] HA Tracker: when cleaning up obsolete elected replicas from KV store, tracker didn't update number of cluster per user correctly. #4336
4244
* [BUGFIX] Ruler: fixed counting of PromQL evaluation errors as user-errors when updating `cortex_ruler_queries_failed_total`. #4335

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ require (
5252
github.com/stretchr/testify v1.7.0
5353
github.com/thanos-io/thanos v0.22.0
5454
github.com/uber/jaeger-client-go v2.29.1+incompatible
55-
github.com/weaveworks/common v0.0.0-20210722103813-e649eff5ab4a
55+
github.com/weaveworks/common v0.0.0-20210901124008-1fa3f9fa874c
5656
go.etcd.io/bbolt v1.3.6
5757
go.uber.org/atomic v1.9.0
5858
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b

go.sum

+2-1
Original file line numberDiff line numberDiff line change
@@ -1765,8 +1765,9 @@ github.com/weaveworks/common v0.0.0-20200914083218-61ffdd448099/go.mod h1:hz10LO
17651765
github.com/weaveworks/common v0.0.0-20201119133501-0619918236ec/go.mod h1:ykzWac1LtVfOxdCK+jD754at1Ws9dKCwFeUzkFBffPs=
17661766
github.com/weaveworks/common v0.0.0-20210112142934-23c8d7fa6120/go.mod h1:ykzWac1LtVfOxdCK+jD754at1Ws9dKCwFeUzkFBffPs=
17671767
github.com/weaveworks/common v0.0.0-20210419092856-009d1eebd624/go.mod h1:ykzWac1LtVfOxdCK+jD754at1Ws9dKCwFeUzkFBffPs=
1768-
github.com/weaveworks/common v0.0.0-20210722103813-e649eff5ab4a h1:ALomSnvy/NPeVoc4a1o7keaHHgLS76r9ZYIlwWWF+KA=
17691768
github.com/weaveworks/common v0.0.0-20210722103813-e649eff5ab4a/go.mod h1:YU9FvnS7kUnRt6HY10G+2qHkwzP3n3Vb1XsXDsJTSp8=
1769+
github.com/weaveworks/common v0.0.0-20210901124008-1fa3f9fa874c h1:+yzwVr4/12cUgsdjbEHq6MsKB7jWBZpZccAP6xvqTzQ=
1770+
github.com/weaveworks/common v0.0.0-20210901124008-1fa3f9fa874c/go.mod h1:YU9FvnS7kUnRt6HY10G+2qHkwzP3n3Vb1XsXDsJTSp8=
17701771
github.com/weaveworks/promrus v1.2.0 h1:jOLf6pe6/vss4qGHjXmGz4oDJQA+AOCqEL3FvvZGz7M=
17711772
github.com/weaveworks/promrus v1.2.0/go.mod h1:SaE82+OJ91yqjrE1rsvBWVzNZKcHYFtMUyS1+Ogs/KA=
17721773
github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=

pkg/chunk/cache/memcached.go

+4-14
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@ import (
2020
"github.com/cortexproject/cortex/pkg/util/spanlogger"
2121
)
2222

23-
type observableVecCollector struct {
24-
v prometheus.ObserverVec
25-
}
26-
27-
func (observableVecCollector) Register() {}
28-
func (observableVecCollector) Before(method string, start time.Time) {}
29-
func (o observableVecCollector) After(method, statusCode string, start time.Time) {
30-
o.v.WithLabelValues(method, statusCode).Observe(time.Since(start).Seconds())
31-
}
32-
3323
// MemcachedConfig is config to make a Memcached
3424
type MemcachedConfig struct {
3525
Expiration time.Duration `yaml:"expiration"`
@@ -51,7 +41,7 @@ type Memcached struct {
5141
memcache MemcachedClient
5242
name string
5343

54-
requestDuration observableVecCollector
44+
requestDuration *instr.HistogramCollector
5545

5646
wg sync.WaitGroup
5747
inputCh chan *work
@@ -67,16 +57,16 @@ func NewMemcached(cfg MemcachedConfig, client MemcachedClient, name string, reg
6757
memcache: client,
6858
name: name,
6959
logger: logger,
70-
requestDuration: observableVecCollector{
71-
v: promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
60+
requestDuration: instr.NewHistogramCollector(
61+
promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
7262
Namespace: "cortex",
7363
Name: "memcache_request_duration_seconds",
7464
Help: "Total time spent in seconds doing memcache requests.",
7565
// Memcached requests are very quick: smallest bucket is 16us, biggest is 1s
7666
Buckets: prometheus.ExponentialBuckets(0.000016, 4, 8),
7767
ConstLabels: prometheus.Labels{"name": name},
7868
}, []string{"method", "status_code"}),
79-
},
69+
),
8070
}
8171

8272
if cfg.BatchSize == 0 || cfg.Parallelism == 0 {

pkg/chunk/cache/redis_cache.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type RedisCache struct {
1919
name string
2020
redis *RedisClient
2121
logger log.Logger
22-
requestDuration observableVecCollector
22+
requestDuration *instr.HistogramCollector
2323
}
2424

2525
// NewRedisCache creates a new RedisCache
@@ -29,15 +29,15 @@ func NewRedisCache(name string, redisClient *RedisClient, reg prometheus.Registe
2929
name: name,
3030
redis: redisClient,
3131
logger: logger,
32-
requestDuration: observableVecCollector{
33-
v: promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
32+
requestDuration: instr.NewHistogramCollector(
33+
promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{
3434
Namespace: "cortex",
3535
Name: "rediscache_request_duration_seconds",
3636
Help: "Total time spent in seconds doing Redis requests.",
3737
Buckets: prometheus.ExponentialBuckets(0.000016, 4, 8),
3838
ConstLabels: prometheus.Labels{"name": name},
3939
}, []string{"method", "status_code"}),
40-
},
40+
),
4141
}
4242
if err := cache.redis.Ping(context.Background()); err != nil {
4343
level.Error(logger).Log("msg", "error connecting to redis", "name", name, "err", err)

pkg/querier/queryrange/instrumentation.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type NoopCollector struct{}
5858
func (c *NoopCollector) Register() {}
5959

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

6363
// After implements instrument.Collector.
64-
func (c *NoopCollector) After(method, statusCode string, start time.Time) {}
64+
func (c *NoopCollector) After(ctx context.Context, method, statusCode string, start time.Time) {}

pkg/util/log/wrappers.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"github.com/go-kit/kit/log"
77
kitlog "github.com/go-kit/kit/log"
8-
"github.com/weaveworks/common/middleware"
8+
"github.com/weaveworks/common/tracing"
99

1010
"github.com/cortexproject/cortex/pkg/tenant"
1111
)
@@ -38,7 +38,7 @@ func WithContext(ctx context.Context, l kitlog.Logger) kitlog.Logger {
3838
l = WithUserID(userID, l)
3939
}
4040

41-
traceID, ok := middleware.ExtractTraceID(ctx)
41+
traceID, ok := tracing.ExtractSampledTraceID(ctx)
4242
if !ok {
4343
return l
4444
}

vendor/github.com/weaveworks/common/instrument/instrument.go

+24-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/weaveworks/common/middleware/grpc_instrumentation.go

+5-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/weaveworks/common/middleware/http_tracing.go

-31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/weaveworks/common/middleware/instrument.go

+3-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/weaveworks/common/middleware/logging.go

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/weaveworks/common/server/server.go

+11-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)