summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2021-08-04 09:56:57 +0000
committerGitHub <noreply@github.com>2021-08-04 09:56:57 +0000
commit3a922cbc99f49b996c0379a9ec90ccc47a325018 (patch)
treedab0fdf142508614c6b17cc0d277ae91c58d756a /pkg/domain/infra/abi
parent1bc8c94409c1c9dc47b4569833af534beba9333f (diff)
parent34b28d95986a08bdd74dd89ce6647458cda75731 (diff)
downloadpodman-3a922cbc99f49b996c0379a9ec90ccc47a325018.tar.gz
podman-3a922cbc99f49b996c0379a9ec90ccc47a325018.tar.bz2
podman-3a922cbc99f49b996c0379a9ec90ccc47a325018.zip
Merge pull request #11003 from pascomnet/f_stats
stats: add a interval parameter to cli and api stats streaming
Diffstat (limited to 'pkg/domain/infra/abi')
-rw-r--r--pkg/domain/infra/abi/containers.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index 2003879b8..ddd768328 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -1283,6 +1283,9 @@ func (ic *ContainerEngine) Shutdown(_ context.Context) {
}
func (ic *ContainerEngine) ContainerStats(ctx context.Context, namesOrIds []string, options entities.ContainerStatsOptions) (statsChan chan entities.ContainerStatsReport, err error) {
+ if options.Interval < 1 {
+ return nil, errors.New("Invalid interval, must be a positive number greater zero")
+ }
statsChan = make(chan entities.ContainerStatsReport, 1)
containerFunc := ic.Libpod.GetRunningContainers
@@ -1363,7 +1366,7 @@ func (ic *ContainerEngine) ContainerStats(ctx context.Context, namesOrIds []stri
return
}
- time.Sleep(time.Second)
+ time.Sleep(time.Second * time.Duration(options.Interval))
goto stream
}()