Skip to content

Commit

Permalink
backport of commit a222dbf (#16852)
Browse files Browse the repository at this point in the history
Co-authored-by: davidadeleon <[email protected]>
  • Loading branch information
1 parent 20d1660 commit c10ccf1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog/16834.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
command/debug: fix bug where monitor was not honoring configured duration
```
13 changes: 12 additions & 1 deletion command/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c10ccf1

Please sign in to comment.