From 00d207c8e9cda1e88d759b8195996cf3c0c814fe Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Thu, 8 Feb 2024 11:19:11 +0100 Subject: [PATCH] Log time it takes for profile to load Aids debugging why `auth profiles` may take longer than expected. --- 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 51ae9b1850..7fdcb8f29a 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)