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:
parent
6a438fd087
commit
592949d7ba
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
command/debug: fix bug where monitor was not honoring configured duration
|
||||||
|
```
|
|
@ -1071,7 +1071,18 @@ func (c *DebugCommand) writeLogs(ctx context.Context) {
|
||||||
}
|
}
|
||||||
defer out.Close()
|
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 {
|
if err != nil {
|
||||||
c.captureError("log", err)
|
c.captureError("log", err)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue