From 00d5fd06eebaf321ebbfbbc74b55995eac2c69a6 Mon Sep 17 00:00:00 2001 From: punya Date: Wed, 15 Jan 2025 20:57:50 +0000 Subject: [PATCH] fix(profiler): Improve logging when profile creation fails --- profiler/profiler.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/profiler/profiler.go b/profiler/profiler.go index 9776934357be..7fd58db70eb5 100644 --- a/profiler/profiler.go +++ b/profiler/profiler.go @@ -337,7 +337,7 @@ func (a *agent) createProfile(ctx context.Context) *pb.Profile { var p *pb.Profile md := grpcmd.New(nil) - gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { debugLog("creating a new profile via profiler service") var err error p, err = a.client.CreateProfile(ctx, &req, grpc.Trailer(&md)) @@ -361,7 +361,11 @@ func (a *agent) createProfile(ctx context.Context) *pb.Profile { } })) - debugLog("successfully created profile %v", p.GetProfileType()) + if err != nil { + debugLog("failed to create new profile: %v", err) + } else { + debugLog("successfully created profile %v", p.GetProfileType()) + } return p }