Skip to content

Commit

Permalink
Merge pull request grafana#1138 from gouthamve/up-max-size
Browse files Browse the repository at this point in the history
Make the max grpc receive message size configurable, in Bigtable client
  • Loading branch information
tomwilkie authored Jan 9, 2019
2 parents 9ac2884 + 75dcc9c commit 07573ab
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion gcp/bigtable_index_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ import (
"cloud.google.com/go/bigtable"
ot "github.com/opentracing/opentracing-go"
otlog "github.com/opentracing/opentracing-go/log"
"google.golang.org/api/option"

"github.com/cortexproject/cortex/pkg/chunk"
chunk_util "github.com/cortexproject/cortex/pkg/chunk/util"
"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/grpcclient"
"github.com/pkg/errors"
)

Expand All @@ -30,12 +32,21 @@ const (
type Config struct {
Project string `yaml:"project"`
Instance string `yaml:"instance"`

GRPCClientConfig grpcclient.Config `yaml:"grpc_client_config"`

ColumnKey bool
}

// RegisterFlags adds the flags required to config this to the given FlagSet
func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
f.StringVar(&cfg.Project, "bigtable.project", "", "Bigtable project ID.")
f.StringVar(&cfg.Instance, "bigtable.instance", "", "Bigtable instance ID.")

cfg.GRPCClientConfig.RegisterFlags("bigtable", f)

// Deprecated.
f.Int("bigtable.max-recv-msg-size", 100<<20, "DEPRECATED. Bigtable grpc max receive message size.")
}

// storageClientColumnKey implements chunk.storageClient for GCP.
Expand All @@ -53,7 +64,10 @@ type storageClientV1 struct {

// NewStorageClientV1 returns a new v1 StorageClient.
func NewStorageClientV1(ctx context.Context, cfg Config, schemaCfg chunk.SchemaConfig) (chunk.IndexClient, error) {
client, err := bigtable.NewClient(ctx, cfg.Project, cfg.Instance, instrumentation()...)
opts := instrumentation()
opts = append(opts, option.WithGRPCDialOption(cfg.GRPCClientConfig.DialOption()))

client, err := bigtable.NewClient(ctx, cfg.Project, cfg.Instance, opts...)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 07573ab

Please sign in to comment.