Skip to content

Commit 864c53a

Browse files
authored
Merge pull request #760 from weaveworks/flag
Fix panic in lite
2 parents 20bf2cf + ee02df3 commit 864c53a

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

cmd/lite/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ func main() {
5757
&ingesterConfig, &configStoreConfig, &rulerConfig, &storageConfig, &schemaConfig, &logLevel)
5858
flag.BoolVar(&unauthenticated, "unauthenticated", false, "Set to true to disable multitenancy.")
5959
flag.Parse()
60+
ingesterConfig.SetClientConfig(distributorConfig.IngesterClientConfig)
6061

6162
// Setting the environment variable JAEGER_AGENT_HOST enables tracing
6263
trace := tracing.NewFromEnv("ingester")

pkg/ingester/client/client.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package client
22

33
import (
4+
"flag"
5+
46
"github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc"
57
"github.com/mwitkow/go-grpc-middleware"
68
"github.com/opentracing/opentracing-go"
9+
"github.com/weaveworks/common/middleware"
710
"google.golang.org/grpc"
811
_ "google.golang.org/grpc/encoding/gzip" // get gzip compressor registered
9-
10-
"flag"
11-
"github.com/weaveworks/common/middleware"
1212
)
1313

1414
type closableIngesterClient struct {
@@ -56,6 +56,12 @@ type Config struct {
5656

5757
// RegisterFlags registers configuration settings used by the ingester client config
5858
func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
59+
// lite uses both ingester.Config and distributor.Config.
60+
// Both of them has IngesterClientConfig, so calling RegisterFlags on them triggers panic.
61+
// This check ignores second call to RegisterFlags on IngesterClientConfig and then populates it manually with SetClientConfig
62+
if flag.Lookup("ingester.client.max-recv-message-size") != nil {
63+
return
64+
}
5965
// We have seen 20MB returns from queries - add a bit of headroom
6066
f.IntVar(&cfg.MaxRecvMsgSize, "ingester.client.max-recv-message-size", 64*1024*1024, "Maximum message size, in bytes, this client will receive.")
6167
flag.BoolVar(&cfg.CompressToIngester, "ingester.client.compress-to-ingester", false, "Compress data in calls to ingesters.")

pkg/ingester/ingester.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ type Config struct {
9595
KVClient ring.KVClient
9696
}
9797

98+
// SetClientConfig sets clientConfig in config
99+
func (cfg *Config) SetClientConfig(clientConfig client.Config) {
100+
cfg.clientConfig = clientConfig
101+
}
102+
98103
// RegisterFlags adds the flags required to config this to the given FlagSet
99104
func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
100105
cfg.RingConfig.RegisterFlags(f)

0 commit comments

Comments
 (0)