This commit is contained in:
shreyas-goenka 2024-10-16 19:14:41 +05:30 committed by GitHub
commit 4f432bcade
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import (
"strings"
"github.com/databricks/databricks-sdk-go/useragent"
"github.com/google/uuid"
"github.com/spf13/cobra"
)
@ -33,5 +34,9 @@ func commandString(cmd *cobra.Command) string {
}
func withCommandInUserAgent(ctx context.Context, cmd *cobra.Command) context.Context {
return useragent.InContext(ctx, "cmd", commandString(cmd))
// We add a uuid to the command context to trace multiple API requests made
// by the same command invocation.
newCtx := useragent.InContext(ctx, "cmd-trace-id", uuid.New().String())
return useragent.InContext(newCtx, "cmd", commandString(cmd))
}