Skip to content

Commit e81ee1d

Browse files
authored
Upgrade prometheus to latest main (#5593)
1 parent dbe4fef commit e81ee1d

File tree

184 files changed

+6406
-8585
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+6406
-8585
lines changed

go.mod

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ require (
2727
github.com/gorilla/mux v1.8.0
2828
github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd
2929
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
30-
github.com/hashicorp/consul/api v1.22.0
30+
github.com/hashicorp/consul/api v1.25.1
3131
github.com/hashicorp/go-cleanhttp v0.5.2
3232
github.com/hashicorp/go-sockaddr v1.0.2
3333
github.com/hashicorp/memberlist v0.5.0
@@ -46,14 +46,14 @@ require (
4646
github.com/prometheus/client_model v0.4.0
4747
github.com/prometheus/common v0.44.0
4848
// Prometheus maps version 2.x.y to tags v0.x.y.
49-
github.com/prometheus/prometheus v0.46.1-0.20230818184859-4d8e380269da
49+
github.com/prometheus/prometheus v0.47.2-0.20231009162353-f6d9c84fde6b
5050
github.com/segmentio/fasthash v1.0.3
5151
github.com/sony/gobreaker v0.5.0
5252
github.com/spf13/afero v1.9.5
5353
github.com/stretchr/testify v1.8.4
5454
github.com/thanos-io/objstore v0.0.0-20230921130928-63a603e651ed
55-
github.com/thanos-io/promql-engine v0.0.0-20230821193351-e1ae4275b96e
56-
github.com/thanos-io/thanos v0.32.5-0.20231006043659-79bbf34b4275
55+
github.com/thanos-io/promql-engine v0.0.0-20231003153358-8605b6afba51
56+
github.com/thanos-io/thanos v0.32.5-0.20231010190130-dfe0bbff507b
5757
github.com/uber/jaeger-client-go v2.30.0+incompatible
5858
github.com/weaveworks/common v0.0.0-20221201103051-7c2720a9024d
5959
go.etcd.io/etcd/api/v3 v3.5.9
@@ -198,6 +198,7 @@ require (
198198
github.com/vimeo/galaxycache v0.0.0-20210323154928-b7e5d71c067a // indirect
199199
github.com/weaveworks/promrus v1.2.0 // indirect
200200
github.com/yuin/gopher-lua v1.1.0 // indirect
201+
github.com/zhangyunhao116/umap v0.0.0-20221211160557-cb7705fafa39 // indirect
201202
go.mongodb.org/mongo-driver v1.12.0 // indirect
202203
go.opencensus.io v0.24.0 // indirect
203204
go.opentelemetry.io/collector/pdata v1.0.0-rcv0014 // indirect
@@ -216,7 +217,7 @@ require (
216217
go4.org/intern v0.0.0-20230525184215-6c62f75575cb // indirect
217218
go4.org/unsafe/assume-no-moving-gc v0.0.0-20230525183740-e7c30c78aeb2 // indirect
218219
golang.org/x/crypto v0.12.0 // indirect
219-
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect
220+
golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b // indirect
220221
golang.org/x/mod v0.12.0 // indirect
221222
golang.org/x/oauth2 v0.11.0 // indirect
222223
golang.org/x/sys v0.12.0 // indirect

go.sum

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,7 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z
762762
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
763763
github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4=
764764
github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA=
765+
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
765766
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
766767
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
767768
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
@@ -829,7 +830,6 @@ github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMd
829830
github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8=
830831
github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas=
831832
github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU=
832-
github.com/googleapis/gnostic v0.6.9 h1:hNeVzFMdppk7EuvFnJjiowGFBmSau2llc2rseO0+eNw=
833833
github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=
834834
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
835835
github.com/gophercloud/gophercloud v1.5.0 h1:cDN6XFCLKiiqvYpjQLq9AiM7RDRbIC9450WpPH+yvXo=
@@ -854,10 +854,10 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rH
854854
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg=
855855
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw=
856856
github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0=
857-
github.com/hashicorp/consul/api v1.22.0 h1:ydEvDooB/A0c/xpsBd8GSt7P2/zYPBui4KrNip0xGjE=
858-
github.com/hashicorp/consul/api v1.22.0/go.mod h1:zHpYgZ7TeYqS6zaszjwSt128OwESRpnhU9aGa6ue3Eg=
857+
github.com/hashicorp/consul/api v1.25.1 h1:CqrdhYzc8XZuPnhIYZWH45toM0LB9ZeYr/gvpLVI3PE=
858+
github.com/hashicorp/consul/api v1.25.1/go.mod h1:iiLVwR/htV7mas/sy0O+XSuEnrdBUUydemjxcUrAt4g=
859859
github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms=
860-
github.com/hashicorp/consul/sdk v0.14.0 h1:Hly+BMNMssVzoWddbBnBFi3W+Fzytvm0haSkihhj3GU=
860+
github.com/hashicorp/consul/sdk v0.14.1 h1:ZiwE2bKb+zro68sWzZ1SgHF3kRMBZ94TwOCFRF4ylPs=
861861
github.com/hashicorp/cronexpr v1.1.2 h1:wG/ZYIKT+RT3QkOdgYc+xsKWVRgnxJ1OJtjjy84fJ9A=
862862
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
863863
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
@@ -1134,8 +1134,8 @@ github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1
11341134
github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4=
11351135
github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI=
11361136
github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY=
1137-
github.com/prometheus/prometheus v0.46.1-0.20230818184859-4d8e380269da h1:D5uk+FEdNjQs9ly/wkb/pXkoWc60GcV9RVsMUpg/BIE=
1138-
github.com/prometheus/prometheus v0.46.1-0.20230818184859-4d8e380269da/go.mod h1:uvQsz/zwlfb8TRuWjK7L7ofV5ycAYq8dorvNf2iOBN4=
1137+
github.com/prometheus/prometheus v0.47.2-0.20231009162353-f6d9c84fde6b h1:oiCf/rFBXXaDLyiK1MnMKYlSA7Xm2+SQePvXnl8bNUI=
1138+
github.com/prometheus/prometheus v0.47.2-0.20231009162353-f6d9c84fde6b/go.mod h1:UC0TwJiF90m2T3iYPQBKnGu8gv3s55dF/EgpTq8gyvo=
11391139
github.com/redis/rueidis v1.0.14-go1.18 h1:dGir5z8w8X1ex7JWO/Zx2FMBrZgQ8Yjm+lw9fPLSNGw=
11401140
github.com/redis/rueidis v1.0.14-go1.18/go.mod h1:HGekzV3HbmzFmRK6j0xic8Z9119+ECoGMjeN1TV1NYU=
11411141
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
@@ -1210,10 +1210,10 @@ github.com/thanos-community/galaxycache v0.0.0-20211122094458-3a32041a1f1e h1:f1
12101210
github.com/thanos-community/galaxycache v0.0.0-20211122094458-3a32041a1f1e/go.mod h1:jXcofnrSln/cLI6/dhlBxPQZEEQHVPCcFaH75M+nSzM=
12111211
github.com/thanos-io/objstore v0.0.0-20230921130928-63a603e651ed h1:iWQdY3S6DpWjelVvKKSKgS7LeLkhK4VaEnQfphB9ZXA=
12121212
github.com/thanos-io/objstore v0.0.0-20230921130928-63a603e651ed/go.mod h1:oJ82xgcBDzGJrEgUsjlTj6n01+ZWUMMUR8BlZzX5xDE=
1213-
github.com/thanos-io/promql-engine v0.0.0-20230821193351-e1ae4275b96e h1:kwsFCU8eSkZehbrAN3nXPw5RdMHi/Bok/y8l2C4M+gk=
1214-
github.com/thanos-io/promql-engine v0.0.0-20230821193351-e1ae4275b96e/go.mod h1:+T/ZYNCGybT6eTsGGvVtGb63nT1cvUmH6MjqRrcQoKw=
1215-
github.com/thanos-io/thanos v0.32.5-0.20231006043659-79bbf34b4275 h1:y2YPqM1XiBw7EhLg45F6A1g8bgt4yYxkaRAeQaNLWYk=
1216-
github.com/thanos-io/thanos v0.32.5-0.20231006043659-79bbf34b4275/go.mod h1:HwiHn7u6GeES403BTACOYib/JKAJknf8dByU/uJiEr0=
1213+
github.com/thanos-io/promql-engine v0.0.0-20231003153358-8605b6afba51 h1:Av62ac0O9wRbLI6xvtm51BBZnxHyEgLXV/YmiJpdogc=
1214+
github.com/thanos-io/promql-engine v0.0.0-20231003153358-8605b6afba51/go.mod h1:vfXJv1JXNdLfHnjsHsLLJl5tyI7KblF76Wo5lZ9YC4Q=
1215+
github.com/thanos-io/thanos v0.32.5-0.20231010190130-dfe0bbff507b h1:7eH6FRIQ/d0wlklAHe8dFpMAxG81C6uE7LTEj5jafss=
1216+
github.com/thanos-io/thanos v0.32.5-0.20231010190130-dfe0bbff507b/go.mod h1:tqT2FQHiOF16empgE3vvZrA++fN9Cx0lwmxlMmBaVzA=
12171217
github.com/themihai/gomemcache v0.0.0-20180902122335-24332e2d58ab h1:7ZR3hmisBWw77ZpO1/o86g+JV3VKlk3d48jopJxzTjU=
12181218
github.com/themihai/gomemcache v0.0.0-20180902122335-24332e2d58ab/go.mod h1:eheTFp954zcWZXCU8d0AT76ftsQOTo4DTqkN/h3k1MY=
12191219
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
@@ -1245,6 +1245,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1
12451245
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
12461246
github.com/yuin/gopher-lua v1.1.0 h1:BojcDhfyDWgU2f2TOzYK/g5p2gxMrku8oupLDqlnSqE=
12471247
github.com/yuin/gopher-lua v1.1.0/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
1248+
github.com/zhangyunhao116/umap v0.0.0-20221211160557-cb7705fafa39 h1:D3ltj0b2c2FgUacKrB1pWGgwrUyCESY9W8XYYQ5sqY8=
1249+
github.com/zhangyunhao116/umap v0.0.0-20221211160557-cb7705fafa39/go.mod h1:r86X1CnsDRrOeLtJlqRWdELPWpkcf933GTlojQlifQw=
12481250
go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A=
12491251
go.etcd.io/etcd/api/v3 v3.5.9 h1:4wSsluwyTbGGmyjJktOf3wFQoTBIURXHnq9n/G/JQHs=
12501252
go.etcd.io/etcd/api/v3 v3.5.9/go.mod h1:uyAal843mC8uUVSLWz6eHa/d971iDGnCRpmKd2Z+X8k=
@@ -1360,8 +1362,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
13601362
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
13611363
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
13621364
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
1363-
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 h1:MGwJjxBy0HJshjDNfLsYO8xppfqWlA5ZT9OhtUUhTNw=
1364-
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
1365+
golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b h1:r+vk0EmXNmekl0S0BascoeeoHk/L7wmaW2QF90K+kYI=
1366+
golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
13651367
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
13661368
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
13671369
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
@@ -1998,12 +2000,12 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
19982000
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
19992001
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
20002002
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
2001-
k8s.io/api v0.27.3 h1:yR6oQXXnUEBWEWcvPWS0jQL575KoAboQPfJAuKNrw5Y=
2002-
k8s.io/apimachinery v0.27.3 h1:Ubye8oBufD04l9QnNtW05idcOe9Z3GQN8+7PqmuVcUM=
2003-
k8s.io/client-go v0.27.3 h1:7dnEGHZEJld3lYwxvLl7WoehK6lAq7GvgjxpA3nv1E8=
2003+
k8s.io/api v0.28.1 h1:i+0O8k2NPBCPYaMB+uCkseEbawEt/eFaiRqUx8aB108=
2004+
k8s.io/apimachinery v0.28.1 h1:EJD40og3GizBSV3mkIoXQBsws32okPOy+MkRyzh6nPY=
2005+
k8s.io/client-go v0.28.1 h1:pRhMzB8HyLfVwpngWKE8hDcXRqifh1ga2Z/PU9SXVK8=
20042006
k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
20052007
k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg=
2006-
k8s.io/kube-openapi v0.0.0-20230525220651-2546d827e515 h1:OmK1d0WrkD3IPfkskvroRykOulHVHf0s0ZIFRjyt+UI=
2008+
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5OhxCKlKJy0sHc+PcDwFB24dQ=
20072009
k8s.io/utils v0.0.0-20230711102312-30195339c3c7 h1:ZgnF1KZsYxWIifwSNZFZgNtWE89WI5yiP5WwlfDoIyc=
20082010
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
20092011
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=

pkg/compactor/compactor_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ func createTSDBBlock(t *testing.T, bkt objstore.Bucket, userID string, minT, max
14671467
require.NoError(t, err)
14681468
}
14691469

1470-
require.NoError(t, db.Compact())
1470+
require.NoError(t, db.Compact(context.Background()))
14711471
require.NoError(t, db.Snapshot(snapshotDir, true))
14721472

14731473
// Look for the created block (we expect one).

pkg/cortex/modules_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func (p *myPusher) Push(ctx context.Context, req *cortexpb.WriteRequest) (*corte
166166

167167
type myQueryable struct{}
168168

169-
func (q *myQueryable) Querier(ctx context.Context, mint, maxt int64) (prom_storage.Querier, error) {
169+
func (q *myQueryable) Querier(mint, maxt int64) (prom_storage.Querier, error) {
170170
return prom_storage.NoopQuerier(), nil
171171
}
172172

pkg/ingester/ingester.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,12 @@ func (u *userTSDB) Appender(ctx context.Context) storage.Appender {
280280
return u.db.Appender(ctx)
281281
}
282282

283-
func (u *userTSDB) Querier(ctx context.Context, mint, maxt int64) (storage.Querier, error) {
284-
return u.db.Querier(ctx, mint, maxt)
283+
func (u *userTSDB) Querier(mint, maxt int64) (storage.Querier, error) {
284+
return u.db.Querier(mint, maxt)
285285
}
286286

287-
func (u *userTSDB) ChunkQuerier(ctx context.Context, mint, maxt int64) (storage.ChunkQuerier, error) {
288-
return u.db.ChunkQuerier(ctx, mint, maxt)
287+
func (u *userTSDB) ChunkQuerier(mint, maxt int64) (storage.ChunkQuerier, error) {
288+
return u.db.ChunkQuerier(mint, maxt)
289289
}
290290

291291
func (u *userTSDB) ExemplarQuerier(ctx context.Context) (storage.ExemplarQuerier, error) {
@@ -304,8 +304,8 @@ func (u *userTSDB) Close() error {
304304
return u.db.Close()
305305
}
306306

307-
func (u *userTSDB) Compact() error {
308-
return u.db.Compact()
307+
func (u *userTSDB) Compact(ctx context.Context) error {
308+
return u.db.Compact(ctx)
309309
}
310310

311311
func (u *userTSDB) StartTime() (int64, error) {
@@ -1273,14 +1273,14 @@ func (i *Ingester) Query(ctx context.Context, req *client.QueryRequest) (*client
12731273
return &client.QueryResponse{}, nil
12741274
}
12751275

1276-
q, err := db.Querier(ctx, int64(from), int64(through))
1276+
q, err := db.Querier(int64(from), int64(through))
12771277
if err != nil {
12781278
return nil, err
12791279
}
12801280
defer q.Close()
12811281

12821282
// It's not required to return sorted series because series are sorted by the Cortex querier.
1283-
ss := q.Select(false, nil, matchers...)
1283+
ss := q.Select(ctx, false, nil, matchers...)
12841284
if ss.Err() != nil {
12851285
return nil, ss.Err()
12861286
}
@@ -1429,7 +1429,7 @@ func (i *Ingester) labelsValuesCommon(ctx context.Context, req *client.LabelValu
14291429
return nil, cleanup, err
14301430
}
14311431

1432-
q, err := db.Querier(ctx, mint, maxt)
1432+
q, err := db.Querier(mint, maxt)
14331433
if err != nil {
14341434
return nil, cleanup, err
14351435
}
@@ -1438,7 +1438,7 @@ func (i *Ingester) labelsValuesCommon(ctx context.Context, req *client.LabelValu
14381438
q.Close()
14391439
}
14401440

1441-
vals, _, err := q.LabelValues(labelName, matchers...)
1441+
vals, _, err := q.LabelValues(ctx, labelName, matchers...)
14421442
if err != nil {
14431443
return nil, cleanup, err
14441444
}
@@ -1505,7 +1505,7 @@ func (i *Ingester) labelNamesCommon(ctx context.Context, req *client.LabelNamesR
15051505
return nil, cleanup, err
15061506
}
15071507

1508-
q, err := db.Querier(ctx, mint, maxt)
1508+
q, err := db.Querier(mint, maxt)
15091509
if err != nil {
15101510
return nil, cleanup, err
15111511
}
@@ -1514,7 +1514,7 @@ func (i *Ingester) labelNamesCommon(ctx context.Context, req *client.LabelNamesR
15141514
q.Close()
15151515
}
15161516

1517-
names, _, err := q.LabelNames()
1517+
names, _, err := q.LabelNames(ctx)
15181518
if err != nil {
15191519
return nil, cleanup, err
15201520
}
@@ -1585,7 +1585,7 @@ func (i *Ingester) metricsForLabelMatchersCommon(ctx context.Context, req *clien
15851585
return nil, cleanup, err
15861586
}
15871587

1588-
q, err := db.Querier(ctx, mint, maxt)
1588+
q, err := db.Querier(mint, maxt)
15891589
if err != nil {
15901590
return nil, cleanup, err
15911591
}
@@ -1612,12 +1612,12 @@ func (i *Ingester) metricsForLabelMatchersCommon(ctx context.Context, req *clien
16121612
return nil, cleanup, ctx.Err()
16131613
}
16141614

1615-
seriesSet := q.Select(true, hints, matchers...)
1615+
seriesSet := q.Select(ctx, true, hints, matchers...)
16161616
sets = append(sets, seriesSet)
16171617
}
16181618
mergedSet = storage.NewMergeSeriesSet(sets, storage.ChainedSeriesMerge)
16191619
} else {
1620-
mergedSet = q.Select(false, hints, matchersSet[0]...)
1620+
mergedSet = q.Select(ctx, false, hints, matchersSet[0]...)
16211621
}
16221622

16231623
// Generate the response merging all series sets.
@@ -1783,14 +1783,14 @@ func (i *Ingester) QueryStream(req *client.QueryRequest, stream client.Ingester_
17831783

17841784
// queryStreamChunks streams metrics from a TSDB. This implements the client.IngesterServer interface
17851785
func (i *Ingester) queryStreamChunks(ctx context.Context, db *userTSDB, from, through int64, matchers []*labels.Matcher, sm *storepb.ShardMatcher, stream client.Ingester_QueryStreamServer) (numSeries, numSamples int, _ error) {
1786-
q, err := db.ChunkQuerier(ctx, from, through)
1786+
q, err := db.ChunkQuerier(from, through)
17871787
if err != nil {
17881788
return 0, 0, err
17891789
}
17901790
defer q.Close()
17911791

17921792
// It's not required to return sorted series because series are sorted by the Cortex querier.
1793-
ss := q.Select(false, nil, matchers...)
1793+
ss := q.Select(ctx, false, nil, matchers...)
17941794
if ss.Err() != nil {
17951795
return 0, 0, ss.Err()
17961796
}
@@ -2002,7 +2002,7 @@ func (i *Ingester) createTSDB(userID string) (*userTSDB, error) {
20022002
// this will actually create the blocks. If there is no data (empty TSDB), this is a no-op, although
20032003
// local blocks compaction may still take place if configured.
20042004
level.Info(userLogger).Log("msg", "Running compaction after WAL replay")
2005-
err = db.Compact()
2005+
err = db.Compact(context.TODO())
20062006
if err != nil {
20072007
return nil, errors.Wrapf(err, "failed to compact TSDB: %s", udir)
20082008
}
@@ -2400,7 +2400,7 @@ func (i *Ingester) compactBlocks(ctx context.Context, force bool, allowed *util.
24002400

24012401
default:
24022402
reason = "regular"
2403-
err = userDB.Compact()
2403+
err = userDB.Compact(ctx)
24042404
}
24052405

24062406
if err != nil {

pkg/ingester/ingester_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3776,7 +3776,7 @@ func TestIngesterNotDeleteUnshippedBlocks(t *testing.T) {
37763776

37773777
db := i.getTSDB(userID)
37783778
require.NotNil(t, db)
3779-
require.Nil(t, db.Compact())
3779+
require.Nil(t, db.Compact(ctx))
37803780

37813781
oldBlocks := db.Blocks()
37823782
require.Equal(t, 3, len(oldBlocks))
@@ -3800,7 +3800,7 @@ func TestIngesterNotDeleteUnshippedBlocks(t *testing.T) {
38003800
_, err := i.Push(ctx, req)
38013801
require.NoError(t, err)
38023802
}
3803-
require.Nil(t, db.Compact())
3803+
require.Nil(t, db.Compact(ctx))
38043804

38053805
// Only the second block should be gone along with a new block.
38063806
newBlocks := db.Blocks()
@@ -3828,7 +3828,7 @@ func TestIngesterNotDeleteUnshippedBlocks(t *testing.T) {
38283828
_, err := i.Push(ctx, req)
38293829
require.NoError(t, err)
38303830
}
3831-
require.Nil(t, db.Compact())
3831+
require.Nil(t, db.Compact(ctx))
38323832

38333833
// All blocks from the old blocks should be gone now.
38343834
newBlocks2 := db.Blocks()

pkg/querier/block.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ import (
44
"math"
55
"sort"
66

7-
"github.com/cortexproject/cortex/pkg/querier/iterators"
8-
"github.com/cortexproject/cortex/pkg/querier/series"
9-
107
"github.com/pkg/errors"
118
"github.com/prometheus/prometheus/model/labels"
129
"github.com/prometheus/prometheus/storage"
1310
"github.com/prometheus/prometheus/tsdb/chunkenc"
11+
"github.com/prometheus/prometheus/util/annotations"
1412
"github.com/thanos-io/thanos/pkg/store/labelpb"
1513
"github.com/thanos-io/thanos/pkg/store/storepb"
14+
15+
"github.com/cortexproject/cortex/pkg/querier/iterators"
16+
"github.com/cortexproject/cortex/pkg/querier/series"
1617
)
1718

1819
func convertMatchersToLabelMatcher(matchers []*labels.Matcher) []storepb.LabelMatcher {
@@ -42,7 +43,7 @@ func convertMatchersToLabelMatcher(matchers []*labels.Matcher) []storepb.LabelMa
4243
// Implementation of storage.SeriesSet, based on individual responses from store client.
4344
type blockQuerierSeriesSet struct {
4445
series []*storepb.Series
45-
warnings storage.Warnings
46+
warnings annotations.Annotations
4647

4748
// next response to process
4849
next int
@@ -82,7 +83,7 @@ func (bqss *blockQuerierSeriesSet) Err() error {
8283
return nil
8384
}
8485

85-
func (bqss *blockQuerierSeriesSet) Warnings() storage.Warnings {
86+
func (bqss *blockQuerierSeriesSet) Warnings() annotations.Annotations {
8687
return bqss.warnings
8788
}
8889

0 commit comments

Comments
 (0)