You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(stats): report cpuPercent in the machine-readable formats
container stats already samples twice, sleeping two seconds between samples,
and computes a CPU percentage from the pair for its table. Only the second
sample was rendered for json, yaml and toml, so a consumer paid that latency
and received neither the percentage nor the earlier sample needed to derive it.
Getting a CPU percentage from the CLI meant invoking the command twice and
diffing cpuUsageUsec by hand.
Adds a StatsReport payload for the non-table formats: the latest sample plus
the derived percentage. ContainerResource.ContainerStats models a single sample
and a rate is not a property of one sample, so the derived value lives in the
command rather than widening that type.
The two-second interval is now a single constant. collectStats sleeps for it
and the percentage divides by it, so the two must agree; they were separate
literals before.
0 commit comments