Skip to content

Commit f1f4872

Browse files
authored
Add more clone logging (#4593)
This commit adds timing information to the logs when clones complete successfully. There are several other more robust but also more involved interventions we could do, and I think we should do them, but this is a strict improvement that's easy to get out as a first step. I also added logging at the precise beginning of the clone command so we know when we're doing that.
1 parent 1a83f6b commit f1f4872

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

pkg/sources/git/git.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,8 @@ func CloneRepo(ctx context.Context, userInfo *url.Userinfo, gitURL string, clone
490490
// executeClone prepares the Git URL, constructs, and executes the git clone command using the provided
491491
// clonePath. It then opens the cloned repository, returning a git.Repository object.
492492
func executeClone(ctx context.Context, params cloneParams) (*git.Repository, error) {
493+
start := time.Now()
494+
493495
cloneURL, err := GitURLParse(params.gitURL)
494496
if err != nil {
495497
return nil, err
@@ -543,6 +545,7 @@ func executeClone(ctx context.Context, params cloneParams) (*git.Repository, err
543545
"args", params.args,
544546
)
545547

548+
logger.V(3).Info("executing git clone command")
546549
outputBytes, err := cloneCmd.CombinedOutput()
547550
var output string
548551
if secretForRedaction != "" {
@@ -570,7 +573,7 @@ func executeClone(ctx context.Context, params cloneParams) (*git.Repository, err
570573
if err != nil {
571574
return nil, fmt.Errorf("could not open cloned repo: %w", err)
572575
}
573-
logger.V(1).Info("successfully cloned repo")
576+
logger.V(1).Info("successfully cloned repo", "time_seconds", time.Since(start).Seconds())
574577

575578
metricsInstance.RecordCloneOperation(statusSuccess, cloneSuccess, 0)
576579

0 commit comments

Comments
 (0)