Skip to content

Commit c1e5bcd

Browse files
L3n41cclaude
andcommitted
[CONTINT-5217][CONTINT-5218][CONTINT-5219][CONTINT-5220] Remove IncludePreviousSample to preserve one-shot stats behavior
Drop IncludePreviousSample from ContainerStats call. This option makes the daemon collect two samples one second apart before returning, adding ~1s latency per container during metric collection. Since the codebase never uses PreCPUStats/PreRead, this delay was unnecessary. Using the zero-value options preserves the original ContainerStatsOneShot behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f923a33 commit c1e5bcd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pkg/util/docker/docker_util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ func (d *DockerUtil) AllContainerLabels(ctx context.Context) (map[string]map[str
382382
func (d *DockerUtil) GetContainerStats(ctx context.Context, containerID string) (*dcontainer.StatsResponse, error) {
383383
ctx, cancel := context.WithTimeout(ctx, d.queryTimeout)
384384
defer cancel()
385-
stats, err := d.cli.ContainerStats(ctx, containerID, client.ContainerStatsOptions{IncludePreviousSample: true})
385+
stats, err := d.cli.ContainerStats(ctx, containerID, client.ContainerStatsOptions{})
386386
if err != nil {
387387
return nil, fmt.Errorf("unable to get Docker stats: %s", err)
388388
}

0 commit comments

Comments
 (0)