debug: limit the size of the trace
We've noticed that a trace that is captured over the full duration is too large to open on most machines. A trace.out captured over just the interval period (30s by default) should be a more than enough time to capture trace data.
This commit is contained in:
parent
bf1e2d79f8
commit
5bd73fc218
|
@ -0,0 +1,3 @@
|
|||
```release-note:improvement
|
||||
debug: reduce the capture time for trace to only a single interval instead of the full duration to make trace.out easier to open without running into OOM errors.
|
||||
```
|
|
@ -413,7 +413,7 @@ func (c *cmd) captureLongRunning(ctx context.Context) error {
|
|||
|
||||
g.Go(func() error {
|
||||
// use ctx without a timeout to allow the trace to finish sending
|
||||
return c.captureTrace(ctx, s)
|
||||
return c.captureTrace(ctx, int(c.interval.Seconds()))
|
||||
})
|
||||
}
|
||||
if c.captureTarget(targetLogs) {
|
||||
|
@ -443,8 +443,8 @@ func (c *cmd) captureGoRoutines(outputDir string) error {
|
|||
return ioutil.WriteFile(filepath.Join(outputDir, "goroutine.prof"), gr, 0644)
|
||||
}
|
||||
|
||||
func (c *cmd) captureTrace(ctx context.Context, s float64) error {
|
||||
prof, err := c.client.Debug().PProf(ctx, "trace", int(s))
|
||||
func (c *cmd) captureTrace(ctx context.Context, duration int) error {
|
||||
prof, err := c.client.Debug().PProf(ctx, "trace", duration)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to collect cpu profile: %w", err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue