Skip to content

Commit

Permalink
- Add missing fields and functions to unsupported stats
Browse files Browse the repository at this point in the history
- typo fix

Signed-off-by: Mohamed Abdelfatah <[email protected]>
  • Loading branch information
Mo-Fatah committed May 2, 2024
1 parent 274a509 commit d7fe9a3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions internal/config/cgmgr/stats_unsupported.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 28,8 @@ type MemoryStats struct {
KernelTCPUsage uint64
SwapUsage uint64
SwapLimit uint64
FileMapped uint64
Failcnt uint64
}

type CPUStats struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/lib/stats/stats_server_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 23,15 @@ func (ss *StatsServer) updateSandbox(sb *sandbox.Sandbox) *types.PodSandboxStats
return nil
}

// Sandbox metrics are to fullfil the CRI metrics endpoint
// Sandbox metrics are to fulfill the CRI metrics endpoint
sandboxMetrics, exists := ss.sboxMetrics[sb.ID()]
if !exists {
sandboxMetrics = NewSandboxMetrics(sb)
}
sandboxMetrics.ResetMetricsForSandbox()
sandboxMetrics.ResetContainerMetricsForSandbox()

// Sandbox stats are to fullfil the Kubelet's /stats/summary endpoint
// Sandbox stats are to fulfill the Kubelet's /stats/summary endpoint
sandboxStats := &types.PodSandboxStats{
Attributes: &types.PodSandboxAttributes{
Id: sb.ID(),
Expand Down
9 changes: 8 additions & 1 deletion internal/lib/stats/stats_server_unsupported.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 19,13 @@ func (ss *StatsServer) updateSandbox(sb *sandbox.Sandbox) *types.PodSandboxStats
// updateContainer calls into the runtime handler to update the container stats,
// as well as populates the writable layer by calling into the container storage.
// If this container already existed in the stats server, the CPU nano cores are calculated as well.
func (ss *StatsServer) updateContainer(c *oci.Container, sb *sandbox.Sandbox) *types.ContainerStats {
func (ss *StatsServer) updateContainerStats(c *oci.Container, sb *sandbox.Sandbox) *types.ContainerStats {
return &types.ContainerStats{}
}

// metricsForPodSandbox is an internal, non-locking version of MetricsForPodSandbox
// that returns (and occasionally gathers) the metrics for the given sandbox.
// Note: caller must hold the lock on the StatsServer
func (ss *StatsServer) metricsForPodSandbox(sb *sandbox.Sandbox) *SandboxMetrics {
return &SandboxMetrics{}
}

0 comments on commit d7fe9a3

Please sign in to comment.