From b1b5ad8acdc00ed963c74336d5a3fadd06b41f4d Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Thu, 8 Feb 2024 12:10:52 +0100 Subject: [PATCH] Log time it takes for profile to load (#1186) ## Changes Aids debugging why `auth profiles` may take longer than expected. ## Tests Confirmed manually that timing information shows up in the log output. --- cmd/auth/profiles.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/auth/profiles.go b/cmd/auth/profiles.go index 51ae9b18..7fdcb8f2 100644 --- a/cmd/auth/profiles.go +++ b/cmd/auth/profiles.go @@ -6,9 +6,11 @@ import ( "net/http" "os" "sync" + "time" "github.com/databricks/cli/libs/cmdio" "github.com/databricks/cli/libs/databrickscfg" + "github.com/databricks/cli/libs/log" "github.com/databricks/databricks-sdk-go" "github.com/databricks/databricks-sdk-go/config" "github.com/spf13/cobra" @@ -117,8 +119,10 @@ func newProfilesCommand() *cobra.Command { } wg.Add(1) go func() { - // load more information about profile - profile.Load(cmd.Context(), skipValidate) + ctx := cmd.Context() + t := time.Now() + profile.Load(ctx, skipValidate) + log.Debugf(ctx, "Profile %q took %s to load", profile.Name, time.Since(t)) wg.Done() }() profiles = append(profiles, profile)