This commit is contained in:
Shreyas Goenka 2024-10-30 15:31:13 +01:00
parent c92f7bdf39
commit 821627b08b
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
1 changed files with 5 additions and 3 deletions

View File

@ -34,9 +34,11 @@ func commandString(cmd *cobra.Command) string {
} }
func withCommandInUserAgent(ctx context.Context, cmd *cobra.Command) context.Context { func withCommandInUserAgent(ctx context.Context, cmd *cobra.Command) context.Context {
// We add a uuid to the command context to trace multiple API requests made // A UUID that'll will allow use to correlate multiple API requests made by
// by the same command invocation. // the same command invocation.
newCtx := useragent.InContext(ctx, "cmd-trace-id", uuid.New().String()) // When we add telemetry to the CLI, this trace ID will allow allow us to
// correlate logs in HTTP access logs with logs in Frontend logs.
newCtx := useragent.InContext(ctx, "command-trace-id", uuid.New().String())
return useragent.InContext(newCtx, "cmd", commandString(cmd)) return useragent.InContext(newCtx, "cmd", commandString(cmd))
} }