From 69ea3f84ab0cbf80602708924fcebbe18470236c Mon Sep 17 00:00:00 2001 From: Mahe Tardy Date: Fri, 13 Sep 2024 12:37:24 +0200 Subject: [PATCH] tetra: add max-recv-size to processcache dump cmd When dumping a full process cache (around 65K entries) the gRPC client could not handle a response of this size. This makes it possible to configure it on demand if needed. Signed-off-by: Mahe Tardy --- cmd/tetra/dump/dump.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/tetra/dump/dump.go b/cmd/tetra/dump/dump.go index f908fbe9ef..4b02fa85f7 100644 --- a/cmd/tetra/dump/dump.go +++ b/cmd/tetra/dump/dump.go @@ -18,6 +18,7 @@ import ( "github.com/cilium/tetragon/pkg/sensors/base" "github.com/cilium/tetragon/pkg/sensors/exec/execvemap" "github.com/spf13/cobra" + "google.golang.org/grpc" ) func New() *cobra.Command { @@ -106,6 +107,7 @@ func dumpExecveMap(fname string) { func dumpProcessCache() *cobra.Command { skipZeroRefcnt := false + var maxCallRecvMsgSize int ret := &cobra.Command{ Use: "processcache", @@ -127,7 +129,7 @@ func dumpProcessCache() *cobra.Command { }, }, } - res, err := c.Client.GetDebug(c.Ctx, &req) + res, err := c.Client.GetDebug(c.Ctx, &req, grpc.MaxCallRecvMsgSize(maxCallRecvMsgSize)) if err != nil { return fmt.Errorf("failed to get process dump debug info: %w", err) } @@ -150,6 +152,7 @@ func dumpProcessCache() *cobra.Command { flags := ret.Flags() flags.BoolVar(&skipZeroRefcnt, "skip-zero-refcnt", skipZeroRefcnt, "skip entries with zero refcnt") + flags.IntVar(&maxCallRecvMsgSize, "max-recv-size", 4194304, "The maximum message size in bytes the client can receive. Default is gRPC 4MB default.") return ret }