From 1d763356112841231b447fd5c6fd4c4e252f3c00 Mon Sep 17 00:00:00 2001 From: Philip Gough Date: Mon, 25 Nov 2024 13:00:26 +0000 Subject: [PATCH] receive: Allow specifying a custom gRPC service config via flag (#7907) Signed-off-by: Philip Gough --- CHANGELOG.md | 1 + cmd/thanos/receive.go | 7 +++++++ docs/components/receive.md | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f89c47c855..d50aa427b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#7855](https://github.com/thanos-io/thanos/pull/7855) Compcat/Query: Add support for comma separated replica labels. - [#7654](https://github.com/thanos-io/thanos/pull/7654) *: Add '--grpc-server-tls-min-version' flag to allow user to specify TLS version, otherwise default to TLS 1.3 - [#7854](https://github.com/thanos-io/thanos/pull/7854) Query Frontend: Add `--query-frontend.force-query-stats` flag to force collection of query statistics from upstream queriers. +- [#7907](https://github.com/thanos-io/thanos/pull/7907) Receive: Add `--receive.grpc-service-config` flag to configure gRPC service config for the receivers. ### Changed diff --git a/cmd/thanos/receive.go b/cmd/thanos/receive.go index 299634546a..0372e83690 100644 --- a/cmd/thanos/receive.go +++ b/cmd/thanos/receive.go @@ -175,6 +175,10 @@ func runReceive( dialOpts = append(dialOpts, grpc.WithDefaultCallOptions(grpc.UseCompressor(conf.compression))) } + if conf.grpcServiceConfig != "" { + dialOpts = append(dialOpts, grpc.WithDefaultServiceConfig(conf.grpcServiceConfig)) + } + var bkt objstore.Bucket confContentYaml, err := conf.objStoreConfig.Content() if err != nil { @@ -856,6 +860,7 @@ type receiveConfig struct { maxBackoff *model.Duration compression string replicationProtocol string + grpcServiceConfig string tsdbMinBlockDuration *model.Duration tsdbMaxBlockDuration *model.Duration @@ -970,6 +975,8 @@ func (rc *receiveConfig) registerFlag(cmd extkingpin.FlagClause) { cmd.Flag("receive.capnproto-address", "Address for the Cap'n Proto server.").Default(fmt.Sprintf("0.0.0.0:%s", receive.DefaultCapNProtoPort)).StringVar(&rc.replicationAddr) + cmd.Flag("receive.grpc-service-config", "gRPC service configuration file or content in JSON format. See https://github.com/grpc/grpc/blob/master/doc/service_config.md").PlaceHolder("").Default("").StringVar(&rc.grpcServiceConfig) + rc.forwardTimeout = extkingpin.ModelDuration(cmd.Flag("receive-forward-timeout", "Timeout for each forward request.").Default("5s").Hidden()) rc.maxBackoff = extkingpin.ModelDuration(cmd.Flag("receive-forward-max-backoff", "Maximum backoff for each forward fan-out request").Default("5s").Hidden()) diff --git a/docs/components/receive.md b/docs/components/receive.md index dfaddd73b1..38906489ba 100644 --- a/docs/components/receive.md +++ b/docs/components/receive.md @@ -429,6 +429,10 @@ Flags: Compression algorithm to use for gRPC requests to other receivers. Must be one of: snappy, none + --receive.grpc-service-config= + gRPC service configuration file + or content in JSON format. See + https://github.com/grpc/grpc/blob/master/doc/service_config.md --receive.hashrings= Alternative to 'receive.hashrings-file' flag (lower priority). Content of file that contains