Skip to content

Commit 941e17c

Browse files
committed
Make the max grpc receive message size configurable
Signed-off-by: Goutham Veeramachaneni <[email protected]>
1 parent c31f2de commit 941e17c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/chunk/gcp/storage_client.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010
"cloud.google.com/go/bigtable"
1111
ot "github.com/opentracing/opentracing-go"
1212
otlog "github.com/opentracing/opentracing-go/log"
13+
"google.golang.org/api/option"
14+
"google.golang.org/grpc"
1315

1416
"github.com/cortexproject/cortex/pkg/chunk"
1517
chunk_util "github.com/cortexproject/cortex/pkg/chunk/util"
@@ -30,13 +32,16 @@ type Config struct {
3032
project string
3133
instance string
3234

35+
grpcMaxRecvMsgSize int
36+
3337
ColumnKey bool
3438
}
3539

3640
// RegisterFlags adds the flags required to config this to the given FlagSet
3741
func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
3842
f.StringVar(&cfg.project, "bigtable.project", "", "Bigtable project ID.")
3943
f.StringVar(&cfg.instance, "bigtable.instance", "", "Bigtable instance ID.")
44+
f.IntVar(&cfg.grpcMaxRecvMsgSize, "bigtable.max-recv-msg-size", 100<<20, "Bigtable grpc max receive message size.")
4045
}
4146

4247
// storageClientColumnKey implements chunk.storageClient for GCP.
@@ -54,7 +59,10 @@ type storageClientV1 struct {
5459

5560
// NewStorageClientV1 returns a new v1 StorageClient.
5661
func NewStorageClientV1(ctx context.Context, cfg Config, schemaCfg chunk.SchemaConfig) (chunk.StorageClient, error) {
57-
client, err := bigtable.NewClient(ctx, cfg.project, cfg.instance, instrumentation()...)
62+
opts := instrumentation()
63+
opts = append(opts, option.WithGRPCDialOption(grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(cfg.grpcMaxRecvMsgSize))))
64+
65+
client, err := bigtable.NewClient(ctx, cfg.project, cfg.instance, opts...)
5866
if err != nil {
5967
return nil, err
6068
}

0 commit comments

Comments
 (0)