Skip to content

Commit 4dd7c34

Browse files
authored
Update Thanos objstore to 23ebe2eacadd (#5435)
* update thanos objstore Signed-off-by: Alan Protasio <[email protected]> * lint Signed-off-by: Alan Protasio <[email protected]> --------- Signed-off-by: Alan Protasio <[email protected]>
1 parent 9e783e7 commit 4dd7c34

File tree

12 files changed

+116
-21
lines changed

12 files changed

+116
-21
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ require (
5151
github.com/sony/gobreaker v0.5.0
5252
github.com/spf13/afero v1.9.5
5353
github.com/stretchr/testify v1.8.4
54-
github.com/thanos-io/objstore v0.0.0-20230201072718-11ffbc490204
54+
github.com/thanos-io/objstore v0.0.0-20230522103316-23ebe2eacadd
5555
github.com/thanos-io/promql-engine v0.0.0-20230526105742-791d78b260ea
5656
github.com/thanos-io/thanos v0.31.1-0.20230627154113-7cfaf3fe2d43
5757
github.com/uber/jaeger-client-go v2.30.0+incompatible

go.sum

+3-2
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ github.com/hashicorp/nomad/api v0.0.0-20230418003350-3067191c5197 h1:I5xhKLePXpX
882882
github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY=
883883
github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4=
884884
github.com/hetznercloud/hcloud-go v1.45.1 h1:nl0OOklFfQT5J6AaNIOhl5Ruh3fhmGmhvZEqHbibVuk=
885+
github.com/huaweicloud/huaweicloud-sdk-go-obs v3.23.3+incompatible h1:tKTaPHNVwikS3I1rdyf1INNvgJXWSf/+TzqsiGbrgnQ=
885886
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
886887
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
887888
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
@@ -1159,8 +1160,8 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl
11591160
github.com/tencentyun/cos-go-sdk-v5 v0.7.40 h1:W6vDGKCHe4wBACI1d2UgE6+50sJFhRWU4O8IB2ozzxM=
11601161
github.com/thanos-community/galaxycache v0.0.0-20211122094458-3a32041a1f1e h1:f1Zsv7OAU9iQhZwigp50Yl38W10g/vd5NC8Rdk1Jzng=
11611162
github.com/thanos-community/galaxycache v0.0.0-20211122094458-3a32041a1f1e/go.mod h1:jXcofnrSln/cLI6/dhlBxPQZEEQHVPCcFaH75M+nSzM=
1162-
github.com/thanos-io/objstore v0.0.0-20230201072718-11ffbc490204 h1:W4w5Iph7j32Sf1QFWLJDCqvO0WgZS0jHGID+qnq3wV0=
1163-
github.com/thanos-io/objstore v0.0.0-20230201072718-11ffbc490204/go.mod h1:STSgpY8M6EKF2G/raUFdbIMf2U9GgYlEjAEHJxjvpAo=
1163+
github.com/thanos-io/objstore v0.0.0-20230522103316-23ebe2eacadd h1:asQ0HomkaUXZuR3J7daBEusMS++3hkYsYM6u8gpmPWM=
1164+
github.com/thanos-io/objstore v0.0.0-20230522103316-23ebe2eacadd/go.mod h1:5V7lzXuaxwt6XFQoA/zJrhdnQrxq1+r0bwQ1iYOq3gM=
11641165
github.com/thanos-io/promql-engine v0.0.0-20230526105742-791d78b260ea h1:kzK8sBn2+mo3NAxP+XjAjAqr1hwfxxFUy5CybaBkjAI=
11651166
github.com/thanos-io/promql-engine v0.0.0-20230526105742-791d78b260ea/go.mod h1:eIgPaXWgOhNAv6CPPrgu09r0AtT7byBTZy+7WkX0D18=
11661167
github.com/thanos-io/thanos v0.31.1-0.20230627154113-7cfaf3fe2d43 h1:UHyTPGdDHAoNHuSce5cJ2vEi6g1v8D5ZFBWZ61uTHSM=

pkg/storage/bucket/client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,5 @@ func bucketWithMetrics(bucketClient objstore.Bucket, name string, reg prometheus
141141
return objstore.BucketWithMetrics(
142142
"", // bucket label value
143143
bucketClient,
144-
prometheus.WrapRegistererWith(prometheus.Labels{"component": name}, reg))
144+
prometheus.WrapRegistererWith(prometheus.Labels{"component": name}, prometheus.WrapRegistererWithPrefix("thanos_", reg)))
145145
}

pkg/storage/bucket/client_test.go

+41
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
package bucket
22

33
import (
4+
"bytes"
45
"context"
6+
"fmt"
57
"io"
68
"sync"
79
"testing"
810

11+
"github.com/prometheus/client_golang/prometheus"
12+
"github.com/prometheus/client_golang/prometheus/testutil"
913
"github.com/stretchr/testify/assert"
14+
"github.com/stretchr/testify/mock"
1015
"github.com/stretchr/testify/require"
1116
yaml "gopkg.in/yaml.v2"
1217

@@ -95,6 +100,42 @@ func TestNewClient(t *testing.T) {
95100
}
96101
}
97102

103+
func Test_Thanos_Metrics(t *testing.T) {
104+
reg := prometheus.NewPedanticRegistry()
105+
ctx := context.Background()
106+
107+
m := &ClientMock{}
108+
m.On("Get", mock.Anything, mock.Anything).Return(nil, fmt.Errorf("error"))
109+
bkt := bucketWithMetrics(m, "", reg)
110+
_, err := bkt.Get(ctx, "something")
111+
require.Error(t, err)
112+
113+
// Should report the metrics with `thanos_` prefix
114+
assert.NoError(t, testutil.GatherAndCompare(reg, bytes.NewBufferString(`
115+
# HELP thanos_objstore_bucket_operation_failures_total Total number of operations against a bucket that failed, but were not expected to fail in certain way from caller perspective. Those errors have to be investigated.
116+
# TYPE thanos_objstore_bucket_operation_failures_total counter
117+
thanos_objstore_bucket_operation_failures_total{bucket="",component="",operation="attributes"} 0
118+
thanos_objstore_bucket_operation_failures_total{bucket="",component="",operation="delete"} 0
119+
thanos_objstore_bucket_operation_failures_total{bucket="",component="",operation="exists"} 0
120+
thanos_objstore_bucket_operation_failures_total{bucket="",component="",operation="get"} 1
121+
thanos_objstore_bucket_operation_failures_total{bucket="",component="",operation="get_range"} 0
122+
thanos_objstore_bucket_operation_failures_total{bucket="",component="",operation="iter"} 0
123+
thanos_objstore_bucket_operation_failures_total{bucket="",component="",operation="upload"} 0
124+
# HELP thanos_objstore_bucket_operations_total Total number of all attempted operations against a bucket.
125+
# TYPE thanos_objstore_bucket_operations_total counter
126+
thanos_objstore_bucket_operations_total{bucket="",component="",operation="attributes"} 0
127+
thanos_objstore_bucket_operations_total{bucket="",component="",operation="delete"} 0
128+
thanos_objstore_bucket_operations_total{bucket="",component="",operation="exists"} 0
129+
thanos_objstore_bucket_operations_total{bucket="",component="",operation="get"} 1
130+
thanos_objstore_bucket_operations_total{bucket="",component="",operation="get_range"} 0
131+
thanos_objstore_bucket_operations_total{bucket="",component="",operation="iter"} 0
132+
thanos_objstore_bucket_operations_total{bucket="",component="",operation="upload"} 0
133+
`),
134+
"thanos_objstore_bucket_operations_total",
135+
"thanos_objstore_bucket_operation_failures_total",
136+
))
137+
}
138+
98139
func TestClientMock_MockGet(t *testing.T) {
99140
expected := "body"
100141

pkg/storage/tsdb/bucketindex/markers_bucket_client_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func TestBucketWithGlobalMarkers_ShouldWorkCorrectlyWithBucketMetrics(t *testing
169169
// global markers (intentionally in the middle of the chain) and
170170
// user prefix.
171171
bkt, _ := cortex_testutil.PrepareFilesystemBucket(t)
172-
bkt = objstore.BucketWithMetrics("", bkt, reg)
172+
bkt = objstore.BucketWithMetrics("", bkt, prometheus.WrapRegistererWithPrefix("thanos_", reg))
173173
bkt = BucketWithGlobalMarkers(bkt)
174174
userBkt := bucket.NewUserBucketClient("user-1", bkt, nil)
175175

pkg/storage/tsdb/bucketindex/markers_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func TestMigrateBlockDeletionMarksToGlobalLocation(t *testing.T) {
5656

5757
t.Run("doesn't increase thanos_objstore_bucket_operation_failures_total for NotFound deletion markers", func(t *testing.T) {
5858
reg := prometheus.NewPedanticRegistry()
59-
bkt = objstore.BucketWithMetrics("", bkt, reg)
59+
bkt = objstore.BucketWithMetrics("", bkt, prometheus.WrapRegistererWithPrefix("thanos_", reg))
6060
require.NoError(t, bkt.Upload(ctx, path.Join("user-1", block2.String(), metadata.MetaFilename), strings.NewReader("{}")))
6161
require.NoError(t, MigrateBlockDeletionMarksToGlobalLocation(ctx, bkt, "user-1", nil))
6262

pkg/storage/tsdb/bucketindex/updater_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func TestUpdater_UpdateIndex_ShouldNotIncreaseOperationFailureMetric(t *testing.
106106

107107
// Mock some blocks in the storage.
108108
bkt = BucketWithGlobalMarkers(bkt)
109-
bkt = objstore.BucketWithMetrics("test-bucket", bkt, registry)
109+
bkt = objstore.BucketWithMetrics("test-bucket", bkt, prometheus.WrapRegistererWithPrefix("thanos_", registry))
110110
block1 := testutil.MockStorageBlock(t, bkt, userID, 10, 20)
111111
block2 := testutil.MockStorageBlock(t, bkt, userID, 20, 30)
112112
block3 := testutil.MockStorageBlock(t, bkt, userID, 30, 40)

vendor/github.com/thanos-io/objstore/CHANGELOG.md

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

vendor/github.com/thanos-io/objstore/Makefile

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

vendor/github.com/thanos-io/objstore/README.md

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

vendor/github.com/thanos-io/objstore/objstore.go

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

vendor/modules.txt

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

0 commit comments

Comments
 (0)