@@ -10,6 +10,8 @@ import (
10
10
"cloud.google.com/go/bigtable"
11
11
ot "github.com/opentracing/opentracing-go"
12
12
otlog "github.com/opentracing/opentracing-go/log"
13
+ "google.golang.org/api/option"
14
+ "google.golang.org/grpc"
13
15
14
16
"github.com/cortexproject/cortex/pkg/chunk"
15
17
chunk_util "github.com/cortexproject/cortex/pkg/chunk/util"
@@ -30,13 +32,16 @@ type Config struct {
30
32
project string
31
33
instance string
32
34
35
+ grpcMaxRecvMsgSize int
36
+
33
37
ColumnKey bool
34
38
}
35
39
36
40
// RegisterFlags adds the flags required to config this to the given FlagSet
37
41
func (cfg * Config ) RegisterFlags (f * flag.FlagSet ) {
38
42
f .StringVar (& cfg .project , "bigtable.project" , "" , "Bigtable project ID." )
39
43
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." )
40
45
}
41
46
42
47
// storageClientColumnKey implements chunk.storageClient for GCP.
@@ -54,7 +59,10 @@ type storageClientV1 struct {
54
59
55
60
// NewStorageClientV1 returns a new v1 StorageClient.
56
61
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 ... )
58
66
if err != nil {
59
67
return nil , err
60
68
}
0 commit comments