From aafdd278db8769eddc8470b77f9d48aad5e64d14 Mon Sep 17 00:00:00 2001 From: abelanger5 Date: Fri, 26 Jul 2024 10:58:16 -0700 Subject: [PATCH] make max msg size configurable (#745) --- internal/services/grpc/server.go | 6 ++++++ pkg/config/server/server.go | 3 +++ 2 files changed, 9 insertions(+) diff --git a/internal/services/grpc/server.go b/internal/services/grpc/server.go index 09241a507..10121f536 100644 --- a/internal/services/grpc/server.go +++ b/internal/services/grpc/server.go @@ -259,6 +259,12 @@ func (s *Server) startGRPC() (func() error, error) { serverOpts = append(serverOpts, grpc.KeepaliveParams(kasp)) + serverOpts = append(serverOpts, grpc.MaxRecvMsgSize( + s.config.Runtime.GRPCMaxMsgSize, + ), grpc.MaxSendMsgSize( + s.config.Runtime.GRPCMaxMsgSize, + )) + grpcServer := grpc.NewServer(serverOpts...) if s.ingestor != nil { diff --git a/pkg/config/server/server.go b/pkg/config/server/server.go index b065bbd94..973b71850 100644 --- a/pkg/config/server/server.go +++ b/pkg/config/server/server.go @@ -72,6 +72,9 @@ type ConfigFileRuntime struct { // GRPCInsecure controls whether the grpc server is insecure or uses certs GRPCInsecure bool `mapstructure:"grpcInsecure" json:"grpcInsecure,omitempty" default:"false"` + // GRPCMaxMsgSize is the maximum message size that the grpc server will accept + GRPCMaxMsgSize int `mapstructure:"grpcMaxMsgSize" json:"grpcMaxMsgSize,omitempty" default:"4194304"` + // ShutdownWait is the time between the readiness probe being offline when a shutdown is triggered and the actual start of cleaning up resources. ShutdownWait time.Duration `mapstructure:"shutdownWait" json:"shutdownWait,omitempty" default:"20s"`