Skip to content

Commit c731037

Browse files
authored
Add request id to store gateway logger (#5958)
1 parent 6be4779 commit c731037

File tree

17 files changed

+264
-64
lines changed

17 files changed

+264
-64
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* [ENHANCEMENT] Distributor/Ring: Allow disabling detailed ring metrics by ring member. #5931
1010
* [ENHANCEMENT] KV: Etcd Added etcd.ping-without-stream-allowed parameter to disable/enable PermitWithoutStream #5933
1111
* [ENHANCEMENT] Ingester: Add a new `max_series_per_label_set` limit. This limit functions similarly to `max_series_per_metric`, but allowing users to define the maximum number of series per LabelSet. #5950
12+
* [ENHANCEMENT] Store Gateway: Log gRPC requests together with headers configured in `http_request_headers_to_log`. #5958
1213
* [CHANGE] Upgrade Dockerfile Node version from 14x to 18x. #5906
1314
* [CHANGE] Query Frontend/Ruler: Omit empty data field in API response. #5953 #5954
1415
* [BUGFIX] Configsdb: Fix endline issue in db password. #5920

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ require (
5353
github.com/stretchr/testify v1.9.0
5454
github.com/thanos-io/objstore v0.0.0-20240309075357-e8336a5fd5f3
5555
github.com/thanos-io/promql-engine v0.0.0-20240405095051-b7d0da367508
56-
github.com/thanos-io/thanos v0.34.2-0.20240501161908-1e745af6720c
56+
github.com/thanos-io/thanos v0.35.1-0.20240517203736-9e6cbd9fdd9d
5757
github.com/uber/jaeger-client-go v2.30.0+incompatible
5858
github.com/weaveworks/common v0.0.0-20230728070032-dd9e68f319d5
5959
go.etcd.io/etcd/api/v3 v3.5.13

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,8 +1421,8 @@ github.com/thanos-io/objstore v0.0.0-20240309075357-e8336a5fd5f3 h1:Q0BjHI7FMe5K
14211421
github.com/thanos-io/objstore v0.0.0-20240309075357-e8336a5fd5f3/go.mod h1:ptMYNPgbyAR7a2Ab2t7zHA2/0be2ePyawVR7lp7fZtg=
14221422
github.com/thanos-io/promql-engine v0.0.0-20240405095051-b7d0da367508 h1:4X0ThYb7/wTTKS73wT13ixw0lj5OJ87g45RWIZhPZDA=
14231423
github.com/thanos-io/promql-engine v0.0.0-20240405095051-b7d0da367508/go.mod h1:FEPnabuTql1bDA4OUM41mwcZOJ20R436k8vq+xtGEG0=
1424-
github.com/thanos-io/thanos v0.34.2-0.20240501161908-1e745af6720c h1:clWAhj5L7+Dnw/apO874hUaVxDRHfkm9If4Qv/6CbIo=
1425-
github.com/thanos-io/thanos v0.34.2-0.20240501161908-1e745af6720c/go.mod h1:WHGZyM/qwp857mJr8Q0d7K6eQoLtLv+6p7RNpT/yeIE=
1424+
github.com/thanos-io/thanos v0.35.1-0.20240517203736-9e6cbd9fdd9d h1:Uomb1Yvuz1HDCJL6s0rTiHpaJpHvr8NRarO5TprM7Cs=
1425+
github.com/thanos-io/thanos v0.35.1-0.20240517203736-9e6cbd9fdd9d/go.mod h1:mwjTxpNgULRgeOr5qWmM2IKiyu4SNh/1JypUyPtlrQA=
14261426
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
14271427
github.com/uber/jaeger-client-go v2.28.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
14281428
github.com/uber/jaeger-client-go v2.30.0+incompatible h1:D6wyKGCecFaSRUpo8lCVbaOOb6ThwMmTEbhRwtKR97o=

pkg/storegateway/bucket_stores.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,9 @@ func (u *BucketStores) getOrCreateStore(userID string) (*store.BucketStore, erro
583583
bucketStoreReg := prometheus.NewRegistry()
584584
bucketStoreOpts := []store.BucketStoreOption{
585585
store.WithLogger(userLogger),
586+
store.WithRequestLoggerFunc(func(ctx context.Context, logger log.Logger) log.Logger {
587+
return util_log.HeadersFromContext(ctx, logger)
588+
}),
586589
store.WithRegistry(bucketStoreReg),
587590
store.WithIndexCache(u.indexCache),
588591
store.WithQueryGate(u.queryGate),

pkg/util/log/wrappers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func WithTraceID(traceID string, l log.Logger) log.Logger {
3333
// log := util.WithContext(ctx)
3434
// log.Errorf("Could not chunk chunks: %v", err)
3535
func WithContext(ctx context.Context, l log.Logger) log.Logger {
36-
l = headersFromContext(ctx, l)
36+
l = HeadersFromContext(ctx, l)
3737

3838
// Weaveworks uses "orgs" and "orgID" to represent Cortex users,
3939
// even though the code-base generally uses `userID` to refer to the same thing.
@@ -57,7 +57,7 @@ func WithSourceIPs(sourceIPs string, l log.Logger) log.Logger {
5757
}
5858

5959
// HeadersFromContext enables the logging of specified HTTP Headers that have been added to a context
60-
func headersFromContext(ctx context.Context, l log.Logger) log.Logger {
60+
func HeadersFromContext(ctx context.Context, l log.Logger) log.Logger {
6161
headerContentsMap := HeaderMapFromContext(ctx)
6262
for header, contents := range headerContentsMap {
6363
l = log.With(l, header, contents)

vendor/github.com/thanos-io/thanos/pkg/block/metadata/markers.go

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

vendor/github.com/thanos-io/thanos/pkg/block/metadata/meta.go

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

vendor/github.com/thanos-io/thanos/pkg/compact/compact.go

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

vendor/github.com/thanos-io/thanos/pkg/compact/planner.go

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

vendor/github.com/thanos-io/thanos/pkg/extpromql/parser.go

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

vendor/github.com/thanos-io/thanos/pkg/query/remote_engine.go

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

vendor/github.com/thanos-io/thanos/pkg/querysharding/analyzer.go

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)