command/debug: fix bug where monitor was not honoring configured duration (#16834)

* Use specific client with longer timeout for log debug target

* add changelog

* update changelog entry
This commit is contained in:
davidadeleon 2022-08-23 17:09:30 -04:00 committed by GitHub
parent 6a438fd087
commit 592949d7ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

3
changelog/16834.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
command/debug: fix bug where monitor was not honoring configured duration
```

View File

@ -1071,7 +1071,18 @@ func (c *DebugCommand) writeLogs(ctx context.Context) {
}
defer out.Close()
logCh, err := c.cachedClient.Sys().Monitor(ctx, "trace", c.logFormat)
// Create Monitor specific client based on the cached client
mClient, err := c.cachedClient.Clone()
if err != nil {
c.captureError("log", err)
return
}
mClient.SetToken(c.cachedClient.Token())
// Set timeout to match the context explicitly
mClient.SetClientTimeout(c.flagDuration + debugDurationGrace)
logCh, err := mClient.Sys().Monitor(ctx, "trace", c.logFormat)
if err != nil {
c.captureError("log", err)
return