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.
This commit is contained in:
Pieter Noordhuis 2024-02-08 12:10:52 +01:00 committed by GitHub
parent 8e58e04e8f
commit b1b5ad8acd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -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)