From 796ecbcb42dbce1c1dc012c58c82d1997b59dc7e Mon Sep 17 00:00:00 2001 From: Greg Sheremeta Date: Fri, 23 Aug 2024 17:29:51 -0400 Subject: [PATCH] more logging Signed-off-by: Greg Sheremeta --- backend/src/v2/metadata/client.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/backend/src/v2/metadata/client.go b/backend/src/v2/metadata/client.go index cfd1c2fc0e1..d5f3fc59a51 100644 --- a/backend/src/v2/metadata/client.go +++ b/backend/src/v2/metadata/client.go @@ -1131,6 +1131,28 @@ func (c *Client) getContextTypeID(ctx context.Context, contextType *pb.ContextTy func (c *Client) getOrInsertContext(ctx context.Context, name string, contextType *pb.ContextType, customProps map[string]*pb.Value) (*pb.Context, error) { fmt.Printf("getOrInsertContext: name=%q, type=%q\n", name, contextType.GetName()) + marshaler := protojson.MarshalOptions{ + Multiline: true, + Indent: " ", + } + + jsonStr, err := marshaler.Marshal(contextType) + if err != nil { + fmt.Printf("Failed to marshal: %v", err) + } + + fmt.Println("contextType:") + fmt.Println(string(jsonStr)) + + fmt.Println("customProps:") + for key, value := range customProps { + jsonStr, err := marshaler.Marshal(value) + if err != nil { + fmt.Printf("Failed to marshal key %s: %v", key, err) + } + fmt.Printf("Key: %s, Value: %s\n", key, string(jsonStr)) + } + // This function is known to be flaky and racy right after a server is initially created // and pipeline runs are just starting, so we retry up to 3 times. The actual cause of the // race isn't fully understood, but it's probably caused by deadlocks in MLMD SQL code.