Skip to content

Commit 533c0cb

Browse files
Merge pull request #130701 from roycaihw/psi-metrics
Surface Pressure Stall Information (PSI) metrics Kubernetes-commit: 62555cadc741a8aef31acab05e9ed60f897edb1b
2 parents cd9f99a + f5162a4 commit 533c0cb

File tree

3 files changed

+51
-6
lines changed

3 files changed

+51
-6
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ require (
1414
k8s.io/api v0.0.0-20250320173055-71f613bc3510
1515
k8s.io/apimachinery v0.0.0-20250319092800-e8a77bd768fd
1616
k8s.io/apiserver v0.0.0-20250321052421-26bd744afcf5
17-
k8s.io/client-go v0.0.0-20250321035409-a27e26debde3
17+
k8s.io/client-go v0.0.0-20250321102427-387edb880f47
1818
k8s.io/component-base v0.0.0-20250321044417-f52df19102dc
19-
k8s.io/cri-api v0.0.0-20250317185948-1b6a6cdbe325
19+
k8s.io/cri-api v0.0.0-20250324173833-74299efb05fb
2020
k8s.io/klog/v2 v2.130.1
2121
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738
2222
)

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@ k8s.io/apimachinery v0.0.0-20250319092800-e8a77bd768fd h1:KoXgjwEokLM8o95kMxowg5
156156
k8s.io/apimachinery v0.0.0-20250319092800-e8a77bd768fd/go.mod h1:D2UW665TVSpInyOuG6C+PMtC1MZheP0KQz65UPQEiI4=
157157
k8s.io/apiserver v0.0.0-20250321052421-26bd744afcf5 h1:ns9q2a9Tz+xjh8ZdoLg1m+XlUIEaXzcKIOjRDwxYlwM=
158158
k8s.io/apiserver v0.0.0-20250321052421-26bd744afcf5/go.mod h1:L/DGYvU9lesrR5i4qrkv4RmqL61lMxgD5Ff7oPWWs+c=
159-
k8s.io/client-go v0.0.0-20250321035409-a27e26debde3 h1:GcRvVuLs8ITSNzN0uph78Col2FWgjY1GXYl43SfYKMo=
160-
k8s.io/client-go v0.0.0-20250321035409-a27e26debde3/go.mod h1:HyNyXRafMp0JnNyGc+FMekyJa0AMASVjWNFVH6LFRR8=
159+
k8s.io/client-go v0.0.0-20250321102427-387edb880f47 h1:G/sC+Eu4/8TXh6LwtGjaab2s1yBzb9NR95Gnu82WNyM=
160+
k8s.io/client-go v0.0.0-20250321102427-387edb880f47/go.mod h1:HyNyXRafMp0JnNyGc+FMekyJa0AMASVjWNFVH6LFRR8=
161161
k8s.io/component-base v0.0.0-20250321044417-f52df19102dc h1:gXN5n/Vs9pl/TUpRbcWbGdr0gwcdfwW48bLHcjPVMAQ=
162162
k8s.io/component-base v0.0.0-20250321044417-f52df19102dc/go.mod h1:/60jGdiJiFABDQd5hIqSNOd/at7He3C5TkrROezeEAQ=
163-
k8s.io/cri-api v0.0.0-20250317185948-1b6a6cdbe325 h1:JbRybbQHvQ3ufJiPdt8d5Xt831cAQg8U3ZAKqZLnUh0=
164-
k8s.io/cri-api v0.0.0-20250317185948-1b6a6cdbe325/go.mod h1:AWeYLzfWgDAsuMDuL4Cdv4QN6w8I38Skhl7VL5Kt88Y=
163+
k8s.io/cri-api v0.0.0-20250324173833-74299efb05fb h1:yHAFz0nT5B7BA6hM6KnThXA+Wk71vpP1Z1FwrmfgJ8o=
164+
k8s.io/cri-api v0.0.0-20250324173833-74299efb05fb/go.mod h1:AWeYLzfWgDAsuMDuL4Cdv4QN6w8I38Skhl7VL5Kt88Y=
165165
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
166166
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
167167
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff h1:/usPimJzUKKu+m+TE36gUyGcf03XZEP0ZIKgKj35LS4=

pkg/apis/stats/v1alpha1/types.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ type NodeStats struct {
4646
// Stats pertaining to memory (RAM) resources.
4747
// +optional
4848
Memory *MemoryStats `json:"memory,omitempty"`
49+
// Stats pertaining to IO resources.
50+
// +optional
51+
IO *IOStats `json:"io,omitempty"`
4952
// Stats pertaining to network resources.
5053
// +optional
5154
Network *NetworkStats `json:"network,omitempty"`
@@ -127,6 +130,9 @@ type PodStats struct {
127130
// Stats pertaining to memory (RAM) resources consumed by pod cgroup (which includes all containers' resource usage and pod overhead).
128131
// +optional
129132
Memory *MemoryStats `json:"memory,omitempty"`
133+
// Stats pertaining to IO resources consumed by pod cgroup (which includes all containers' resource usage and pod overhead).
134+
// +optional
135+
IO *IOStats `json:"io,omitempty"`
130136
// Stats pertaining to network resources.
131137
// +optional
132138
Network *NetworkStats `json:"network,omitempty"`
@@ -159,6 +165,9 @@ type ContainerStats struct {
159165
// Stats pertaining to memory (RAM) resources.
160166
// +optional
161167
Memory *MemoryStats `json:"memory,omitempty"`
168+
// Stats pertaining to IO resources.
169+
// +optional
170+
IO *IOStats `json:"io,omitempty"`
162171
// Metrics for Accelerators. Each Accelerator corresponds to one element in the array.
163172
Accelerators []AcceleratorStats `json:"accelerators,omitempty"`
164173
// Stats pertaining to container rootfs usage of filesystem resources.
@@ -225,6 +234,9 @@ type CPUStats struct {
225234
// Cumulative CPU usage (sum of all cores) since object creation.
226235
// +optional
227236
UsageCoreNanoSeconds *uint64 `json:"usageCoreNanoSeconds,omitempty"`
237+
// CPU PSI stats.
238+
// +optional
239+
PSI *PSIStats `json:"psi,omitempty"`
228240
}
229241

230242
// MemoryStats contains data about memory usage.
@@ -252,6 +264,39 @@ type MemoryStats struct {
252264
// Cumulative number of major page faults.
253265
// +optional
254266
MajorPageFaults *uint64 `json:"majorPageFaults,omitempty"`
267+
// Memory PSI stats.
268+
// +optional
269+
PSI *PSIStats `json:"psi,omitempty"`
270+
}
271+
272+
// IOStats contains data about IO usage.
273+
type IOStats struct {
274+
// The time at which these stats were updated.
275+
Time metav1.Time `json:"time"`
276+
// IO PSI stats.
277+
// +optional
278+
PSI *PSIStats `json:"psi,omitempty"`
279+
}
280+
281+
// PSI statistics for an individual resource.
282+
type PSIStats struct {
283+
// PSI data for all tasks in the cgroup.
284+
Full PSIData `json:"full"`
285+
// PSI data for some tasks in the cgroup.
286+
Some PSIData `json:"some"`
287+
}
288+
289+
// PSI data for an individual resource.
290+
type PSIData struct {
291+
// Total time duration for tasks in the cgroup have waited due to congestion.
292+
// Unit: nanoseconds.
293+
Total uint64 `json:"total"`
294+
// The average (in %) tasks have waited due to congestion over a 10 second window.
295+
Avg10 float64 `json:"avg10"`
296+
// The average (in %) tasks have waited due to congestion over a 60 second window.
297+
Avg60 float64 `json:"avg60"`
298+
// The average (in %) tasks have waited due to congestion over a 300 second window.
299+
Avg300 float64 `json:"avg300"`
255300
}
256301

257302
// SwapStats contains data about memory usage

0 commit comments

Comments
 (0)