mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-15 22:53:43 +00:00
Merge pull request #8036 from rye-stripe/bugfix/overhead-metrics
runtime: fix reading cgroup stats of sandboxes
This commit is contained in:
commit
defbb64ac8
@ -1742,12 +1742,14 @@ func (s *Sandbox) Stats(ctx context.Context) (SandboxStats, error) {
|
|||||||
|
|
||||||
// TODO Do we want to aggregate the overhead cgroup stats to the sandbox ones?
|
// TODO Do we want to aggregate the overhead cgroup stats to the sandbox ones?
|
||||||
switch mt := metrics.(type) {
|
switch mt := metrics.(type) {
|
||||||
case v1.Metrics:
|
case *v1.Metrics:
|
||||||
stats.CgroupStats.CPUStats.CPUUsage.TotalUsage = mt.CPU.Usage.Total
|
stats.CgroupStats.CPUStats.CPUUsage.TotalUsage = mt.CPU.Usage.Total
|
||||||
stats.CgroupStats.MemoryStats.Usage.Usage = mt.Memory.Usage.Usage
|
stats.CgroupStats.MemoryStats.Usage.Usage = mt.Memory.Usage.Usage
|
||||||
case v2.Metrics:
|
case *v2.Metrics:
|
||||||
stats.CgroupStats.CPUStats.CPUUsage.TotalUsage = mt.CPU.UsageUsec
|
stats.CgroupStats.CPUStats.CPUUsage.TotalUsage = mt.CPU.UsageUsec
|
||||||
stats.CgroupStats.MemoryStats.Usage.Usage = mt.Memory.Usage
|
stats.CgroupStats.MemoryStats.Usage.Usage = mt.Memory.Usage
|
||||||
|
default:
|
||||||
|
return SandboxStats{}, fmt.Errorf("unknown metrics type %T", mt)
|
||||||
}
|
}
|
||||||
|
|
||||||
tids, err := s.hypervisor.GetThreadIDs(ctx)
|
tids, err := s.hypervisor.GetThreadIDs(ctx)
|
||||||
|
Loading…
Reference in New Issue
Block a user