Skip to content

Commit

Permalink
Review fix: rename new bucket store constructor; deprecated the old o…
Browse files Browse the repository at this point in the history
…ne; amend the new config description

Signed-off-by: Max Neverov <[email protected]>
  • Loading branch information
mneverov committed Oct 25, 2020
1 parent 316caa9 commit c24c072
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions cmd/thanos/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func registerStore(app *extkingpin.App) {
Default("0").Uint()

maxSampleSize := cmd.Flag("store.grpc.series-sample-size-limit",
"Maximum size of samples returned via a single Series call. The Series call fails if this limit is exceeded. 0 means no limit.").
"Maximum size of samples returned (in bytes) via a single Series call. The Series call fails if this limit is exceeded. 0 means no limit.").
Default("0").Uint()

maxConcurrent := cmd.Flag("store.grpc.series-max-concurrency", "Maximum number of concurrent Series calls.").Default("20").Int()
Expand Down Expand Up @@ -297,7 +297,7 @@ func runStore(
store.WithChunksSizeLimit(store.NewChunksLimiterFactory(maxSampleSize)),
}

bs, err := store.New(
bs, err := store.NewBucketStoreWithOptions(
logger,
reg,
bkt,
Expand Down
6 changes: 3 additions & 3 deletions docs/components/store.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ Flags:
number of samples might be lower, even though
the maximum could be hit.
--store.grpc.series-sample-size-limit=0
Maximum size of samples returned via a single
Series call. The Series call fails if this
limit is exceeded. 0 means no limit.
Maximum size of samples returned (in bytes) via
a single Series call. The Series call fails if
this limit is exceeded. 0 means no limit.
--store.grpc.series-max-concurrency=20
Maximum number of concurrent Series calls.
--objstore.config-file=<file-path>
Expand Down
7 changes: 4 additions & 3 deletions pkg/store/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ var defaultBucketStoreOptions = bucketStoreOptions{
chunksSizeLimitFactory: NewChunksLimiterFactory(noChunksSizeLimit),
}

// Deprecated. Use NewBucketStoreWithOptions instead.
// NewBucketStore creates a new bucket backed store that implements the store API against
// an object store bucket. It is optimized to work against high latency backends.
func NewBucketStore(
Expand All @@ -350,7 +351,7 @@ func NewBucketStore(
WithChunksLimit(chunksLimiterFactory),
WithChunksSizeLimit(NewChunksLimiterFactory(noChunksSizeLimit)),
}
return New(logger,
return NewBucketStoreWithOptions(logger,
reg,
bkt,
fetcher,
Expand All @@ -369,9 +370,9 @@ func NewBucketStore(
)
}

// New creates a new bucket backed store that implements the store API against
// NewBucketStoreWithOptions creates a new bucket backed store that implements the store API against
// an object store bucket. It is optimized to work against high latency backends.
func New(
func NewBucketStoreWithOptions(
logger log.Logger,
reg prometheus.Registerer,
bkt objstore.InstrumentedBucketReader,
Expand Down
2 changes: 1 addition & 1 deletion pkg/store/bucket_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func prepareStoreWithTestBlocks(t testing.TB, dir string, bkt objstore.Bucket, m
}, nil)
testutil.Ok(t, err)

store, err := New(
store, err := NewBucketStoreWithOptions(
s.logger,
nil,
objstore.WithNoopInstr(bkt),
Expand Down
12 changes: 6 additions & 6 deletions pkg/store/bucket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ func TestBucketStore_Info(t *testing.T) {

defer testutil.Ok(t, os.RemoveAll(dir))

bucketStore, err := New(
bucketStore, err := NewBucketStoreWithOptions(
nil,
nil,
nil,
Expand Down Expand Up @@ -599,7 +599,7 @@ func TestSeries_ErrorInvalidLimiter(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
dir := t.TempDir()
store, err := New(
store, err := NewBucketStoreWithOptions(
nil,
nil,
nil,
Expand Down Expand Up @@ -856,7 +856,7 @@ func testSharding(t *testing.T, reuseDisk string, bkt objstore.Bucket, all ...ul
}, nil)
testutil.Ok(t, err)

bucketStore, err := New(
bucketStore, err := NewBucketStoreWithOptions(
logger,
nil,
objstore.WithNoopInstr(rec),
Expand Down Expand Up @@ -1611,7 +1611,7 @@ func TestSeries_RequestAndResponseHints(t *testing.T) {
indexCache, err := storecache.NewInMemoryIndexCacheWithConfig(logger, nil, storecache.InMemoryIndexCacheConfig{})
testutil.Ok(tb, err)

store, err := New(
store, err := NewBucketStoreWithOptions(
logger,
nil,
instrBkt,
Expand Down Expand Up @@ -1720,7 +1720,7 @@ func TestSeries_ErrorUnmarshallingRequestHints(t *testing.T) {
indexCache, err := storecache.NewInMemoryIndexCacheWithConfig(logger, nil, storecache.InMemoryIndexCacheConfig{})
testutil.Ok(tb, err)

store, err := New(
store, err := NewBucketStoreWithOptions(
logger,
nil,
instrBkt,
Expand Down Expand Up @@ -1823,7 +1823,7 @@ func TestBlockWithLargeChunks(t *testing.T) {
indexCache, err := storecache.NewInMemoryIndexCacheWithConfig(logger, nil, storecache.InMemoryIndexCacheConfig{})
testutil.Ok(t, err)

store, err := New(
store, err := NewBucketStoreWithOptions(
logger,
nil,
instrBkt,
Expand Down

0 comments on commit c24c072

Please sign in to comment.