Add SwapStats to NodeStats, PodStats and ContainerStats

Signed-off-by: Itamar Holder <iholder@redhat.com>
This commit is contained in:
Itamar Holder 2023-06-27 12:43:02 +03:00
parent ff90c1cc73
commit a05d200ac8

View File

@ -59,6 +59,9 @@ type NodeStats struct {
// Stats about the rlimit of system. // Stats about the rlimit of system.
// +optional // +optional
Rlimit *RlimitStats `json:"rlimit,omitempty"` Rlimit *RlimitStats `json:"rlimit,omitempty"`
// Stats pertaining to swap resources. This is reported to non-windows systems only.
// +optional
Swap *SwapStats `json:"swap,omitempty"`
} }
// RlimitStats are stats rlimit of OS. // RlimitStats are stats rlimit of OS.
@ -131,6 +134,9 @@ type PodStats struct {
// ProcessStats pertaining to processes. // ProcessStats pertaining to processes.
// +optional // +optional
ProcessStats *ProcessStats `json:"process_stats,omitempty"` ProcessStats *ProcessStats `json:"process_stats,omitempty"`
// Stats pertaining to swap resources. This is reported to non-windows systems only.
// +optional
Swap *SwapStats `json:"swap,omitempty"`
} }
// ContainerStats holds container-level unprocessed sample stats. // ContainerStats holds container-level unprocessed sample stats.
@ -159,6 +165,9 @@ type ContainerStats struct {
// +patchMergeKey=name // +patchMergeKey=name
// +patchStrategy=merge // +patchStrategy=merge
UserDefinedMetrics []UserDefinedMetric `json:"userDefinedMetrics,omitempty" patchStrategy:"merge" patchMergeKey:"name"` UserDefinedMetrics []UserDefinedMetric `json:"userDefinedMetrics,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
// Stats pertaining to swap resources. This is reported to non-windows systems only.
// +optional
Swap *SwapStats `json:"swap,omitempty"`
} }
// PodReference contains enough information to locate the referenced pod. // PodReference contains enough information to locate the referenced pod.
@ -237,6 +246,19 @@ type MemoryStats struct {
MajorPageFaults *uint64 `json:"majorPageFaults,omitempty"` MajorPageFaults *uint64 `json:"majorPageFaults,omitempty"`
} }
// SwapStats contains data about memory usage
type SwapStats struct {
// The time at which these stats were updated.
Time metav1.Time `json:"time"`
// Available swap memory for use. This is defined as the <swap-limit> - <current-swap-usage>.
// If swap limit is undefined, this value is omitted.
// +optional
SwapAvailableBytes *uint64 `json:"swapAvailableBytes,omitempty"`
// Total swap memory in use.
// +optional
SwapUsageBytes *uint64 `json:"swapUsageBytes,omitempty"`
}
// AcceleratorStats contains stats for accelerators attached to the container. // AcceleratorStats contains stats for accelerators attached to the container.
type AcceleratorStats struct { type AcceleratorStats struct {
// Make of the accelerator (nvidia, amd, google etc.) // Make of the accelerator (nvidia, amd, google etc.)