@@ -2,30 +2,30 @@ package cgroups
22
33type ThrottlingData struct {
44 // Number of periods with throttling active
5- Periods uint64 `json:"periods,omitempty "`
5+ Periods uint64 `json:"periods,omitzero "`
66 // Number of periods when the container hit its throttling limit.
7- ThrottledPeriods uint64 `json:"throttled_periods,omitempty "`
7+ ThrottledPeriods uint64 `json:"throttled_periods,omitzero "`
88 // Aggregate time the container was throttled for in nanoseconds.
9- ThrottledTime uint64 `json:"throttled_time,omitempty "`
9+ ThrottledTime uint64 `json:"throttled_time,omitzero "`
1010}
1111
1212type BurstData struct {
1313 // Number of periods bandwidth burst occurs
14- BurstsPeriods uint64 `json:"bursts_periods,omitempty "`
14+ BurstsPeriods uint64 `json:"bursts_periods,omitzero "`
1515 // Cumulative wall-time that any cpus has used above quota in respective periods
1616 // Units: nanoseconds.
17- BurstTime uint64 `json:"burst_time,omitempty "`
17+ BurstTime uint64 `json:"burst_time,omitzero "`
1818}
1919
2020// CpuUsage denotes the usage of a CPU.
2121// All CPU stats are aggregate since container inception.
2222type CpuUsage struct {
2323 // Total CPU time consumed.
2424 // Units: nanoseconds.
25- TotalUsage uint64 `json:"total_usage,omitempty "`
25+ TotalUsage uint64 `json:"total_usage,omitzero "`
2626 // Total CPU time consumed per core.
2727 // Units: nanoseconds.
28- PercpuUsage []uint64 `json:"percpu_usage,omitempty "`
28+ PercpuUsage []uint64 `json:"percpu_usage,omitzero "`
2929 // CPU time consumed per core in kernel mode
3030 // Units: nanoseconds.
3131 PercpuUsageInKernelmode []uint64 `json:"percpu_usage_in_kernelmode"`
@@ -48,26 +48,26 @@ type PSIData struct {
4848}
4949
5050type PSIStats struct {
51- Some PSIData `json:"some,omitempty "`
52- Full PSIData `json:"full,omitempty "`
51+ Some PSIData `json:"some,omitzero "`
52+ Full PSIData `json:"full,omitzero "`
5353}
5454
5555type CpuStats struct {
56- CpuUsage CpuUsage `json:"cpu_usage,omitempty"`
57- ThrottlingData ThrottlingData `json:"throttling_data,omitempty "`
58- PSI * PSIStats `json:"psi,omitempty "`
59- BurstData BurstData `json:"burst_data,omitempty "`
56+ CpuUsage CpuUsage `json:"cpu_usage,omitzero"` //nolint:revive,staticcheck // Suppress "var-naming" warning.
57+ ThrottlingData ThrottlingData `json:"throttling_data,omitzero "`
58+ PSI * PSIStats `json:"psi,omitzero "`
59+ BurstData BurstData `json:"burst_data,omitzero "`
6060}
6161
6262type CPUSetStats struct {
6363 // List of the physical numbers of the CPUs on which processes
6464 // in that cpuset are allowed to execute
65- CPUs []uint16 `json:"cpus,omitempty "`
65+ CPUs []uint16 `json:"cpus,omitzero "`
6666 // cpu_exclusive flag
6767 CPUExclusive uint64 `json:"cpu_exclusive"`
6868 // List of memory nodes on which processes in that cpuset
6969 // are allowed to allocate memory
70- Mems []uint16 `json:"mems,omitempty "`
70+ Mems []uint16 `json:"mems,omitzero "`
7171 // mem_hardwall flag
7272 MemHardwall uint64 `json:"mem_hardwall"`
7373 // mem_exclusive flag
@@ -87,122 +87,122 @@ type CPUSetStats struct {
8787}
8888
8989type MemoryData struct {
90- Usage uint64 `json:"usage,omitempty "`
91- MaxUsage uint64 `json:"max_usage,omitempty "`
90+ Usage uint64 `json:"usage,omitzero "`
91+ MaxUsage uint64 `json:"max_usage,omitzero "`
9292 Failcnt uint64 `json:"failcnt"`
9393 Limit uint64 `json:"limit"`
9494}
9595
9696type MemoryStats struct {
9797 // memory used for cache
98- Cache uint64 `json:"cache,omitempty "`
98+ Cache uint64 `json:"cache,omitzero "`
9999 // usage of memory
100- Usage MemoryData `json:"usage,omitempty "`
100+ Usage MemoryData `json:"usage,omitzero "`
101101 // usage of memory + swap
102- SwapUsage MemoryData `json:"swap_usage,omitempty "`
102+ SwapUsage MemoryData `json:"swap_usage,omitzero "`
103103 // usage of swap only
104- SwapOnlyUsage MemoryData `json:"swap_only_usage,omitempty "`
104+ SwapOnlyUsage MemoryData `json:"swap_only_usage,omitzero "`
105105 // usage of kernel memory
106- KernelUsage MemoryData `json:"kernel_usage,omitempty "`
106+ KernelUsage MemoryData `json:"kernel_usage,omitzero "`
107107 // usage of kernel TCP memory
108- KernelTCPUsage MemoryData `json:"kernel_tcp_usage,omitempty "`
108+ KernelTCPUsage MemoryData `json:"kernel_tcp_usage,omitzero "`
109109 // usage of memory pages by NUMA node
110110 // see chapter 5.6 of memory controller documentation
111- PageUsageByNUMA PageUsageByNUMA `json:"page_usage_by_numa,omitempty "`
111+ PageUsageByNUMA PageUsageByNUMA `json:"page_usage_by_numa,omitzero "`
112112 // if true, memory usage is accounted for throughout a hierarchy of cgroups.
113113 UseHierarchy bool `json:"use_hierarchy"`
114114
115- Stats map [string ]uint64 `json:"stats,omitempty "`
116- PSI * PSIStats `json:"psi,omitempty "`
115+ Stats map [string ]uint64 `json:"stats,omitzero "`
116+ PSI * PSIStats `json:"psi,omitzero "`
117117}
118118
119119type PageUsageByNUMA struct {
120120 // Embedding is used as types can't be recursive.
121121 PageUsageByNUMAInner
122- Hierarchical PageUsageByNUMAInner `json:"hierarchical,omitempty "`
122+ Hierarchical PageUsageByNUMAInner `json:"hierarchical,omitzero "`
123123}
124124
125125type PageUsageByNUMAInner struct {
126- Total PageStats `json:"total,omitempty "`
127- File PageStats `json:"file,omitempty "`
128- Anon PageStats `json:"anon,omitempty "`
129- Unevictable PageStats `json:"unevictable,omitempty "`
126+ Total PageStats `json:"total,omitzero "`
127+ File PageStats `json:"file,omitzero "`
128+ Anon PageStats `json:"anon,omitzero "`
129+ Unevictable PageStats `json:"unevictable,omitzero "`
130130}
131131
132132type PageStats struct {
133- Total uint64 `json:"total,omitempty "`
134- Nodes map [uint8 ]uint64 `json:"nodes,omitempty "`
133+ Total uint64 `json:"total,omitzero "`
134+ Nodes map [uint8 ]uint64 `json:"nodes,omitzero "`
135135}
136136
137137type PidsStats struct {
138138 // number of pids in the cgroup
139- Current uint64 `json:"current,omitempty "`
139+ Current uint64 `json:"current,omitzero "`
140140 // active pids hard limit
141- Limit uint64 `json:"limit,omitempty "`
141+ Limit uint64 `json:"limit,omitzero "`
142142}
143143
144144type BlkioStatEntry struct {
145- Major uint64 `json:"major,omitempty "`
146- Minor uint64 `json:"minor,omitempty "`
147- Op string `json:"op,omitempty "`
148- Value uint64 `json:"value,omitempty "`
145+ Major uint64 `json:"major,omitzero "`
146+ Minor uint64 `json:"minor,omitzero "`
147+ Op string `json:"op,omitzero "`
148+ Value uint64 `json:"value,omitzero "`
149149}
150150
151151type BlkioStats struct {
152152 // number of bytes transferred to and from the block device
153- IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive,omitempty "`
154- IoServicedRecursive []BlkioStatEntry `json:"io_serviced_recursive,omitempty "`
155- IoQueuedRecursive []BlkioStatEntry `json:"io_queue_recursive,omitempty "`
156- IoServiceTimeRecursive []BlkioStatEntry `json:"io_service_time_recursive,omitempty "`
157- IoWaitTimeRecursive []BlkioStatEntry `json:"io_wait_time_recursive,omitempty "`
158- IoMergedRecursive []BlkioStatEntry `json:"io_merged_recursive,omitempty "`
159- IoTimeRecursive []BlkioStatEntry `json:"io_time_recursive,omitempty "`
160- SectorsRecursive []BlkioStatEntry `json:"sectors_recursive,omitempty "`
161- PSI * PSIStats `json:"psi,omitempty "`
162- IoCostUsage []BlkioStatEntry `json:"io_cost_usage,omitempty "`
163- IoCostWait []BlkioStatEntry `json:"io_cost_wait,omitempty "`
164- IoCostIndebt []BlkioStatEntry `json:"io_cost_indebt,omitempty "`
165- IoCostIndelay []BlkioStatEntry `json:"io_cost_indelay,omitempty "`
153+ IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive,omitzero "`
154+ IoServicedRecursive []BlkioStatEntry `json:"io_serviced_recursive,omitzero "`
155+ IoQueuedRecursive []BlkioStatEntry `json:"io_queue_recursive,omitzero "`
156+ IoServiceTimeRecursive []BlkioStatEntry `json:"io_service_time_recursive,omitzero "`
157+ IoWaitTimeRecursive []BlkioStatEntry `json:"io_wait_time_recursive,omitzero "`
158+ IoMergedRecursive []BlkioStatEntry `json:"io_merged_recursive,omitzero "`
159+ IoTimeRecursive []BlkioStatEntry `json:"io_time_recursive,omitzero "`
160+ SectorsRecursive []BlkioStatEntry `json:"sectors_recursive,omitzero "`
161+ PSI * PSIStats `json:"psi,omitzero "`
162+ IoCostUsage []BlkioStatEntry `json:"io_cost_usage,omitzero "`
163+ IoCostWait []BlkioStatEntry `json:"io_cost_wait,omitzero "`
164+ IoCostIndebt []BlkioStatEntry `json:"io_cost_indebt,omitzero "`
165+ IoCostIndelay []BlkioStatEntry `json:"io_cost_indelay,omitzero "`
166166}
167167
168168type HugetlbStats struct {
169169 // current res_counter usage for hugetlb
170- Usage uint64 `json:"usage,omitempty "`
170+ Usage uint64 `json:"usage,omitzero "`
171171 // maximum usage ever recorded.
172- MaxUsage uint64 `json:"max_usage,omitempty "`
172+ MaxUsage uint64 `json:"max_usage,omitzero "`
173173 // number of times hugetlb usage allocation failure.
174174 Failcnt uint64 `json:"failcnt"`
175175}
176176
177177type RdmaEntry struct {
178- Device string `json:"device,omitempty "`
179- HcaHandles uint32 `json:"hca_handles,omitempty "`
180- HcaObjects uint32 `json:"hca_objects,omitempty "`
178+ Device string `json:"device,omitzero "`
179+ HcaHandles uint32 `json:"hca_handles,omitzero "`
180+ HcaObjects uint32 `json:"hca_objects,omitzero "`
181181}
182182
183183type RdmaStats struct {
184- RdmaLimit []RdmaEntry `json:"rdma_limit,omitempty "`
185- RdmaCurrent []RdmaEntry `json:"rdma_current,omitempty "`
184+ RdmaLimit []RdmaEntry `json:"rdma_limit,omitzero "`
185+ RdmaCurrent []RdmaEntry `json:"rdma_current,omitzero "`
186186}
187187
188188type MiscStats struct {
189189 // current resource usage for a key in misc
190- Usage uint64 `json:"usage,omitempty "`
190+ Usage uint64 `json:"usage,omitzero "`
191191 // number of times the resource usage was about to go over the max boundary
192- Events uint64 `json:"events,omitempty "`
192+ Events uint64 `json:"events,omitzero "`
193193}
194194
195195type Stats struct {
196- CpuStats CpuStats `json:"cpu_stats,omitempty"`
197- CPUSetStats CPUSetStats `json:"cpuset_stats,omitempty "`
198- MemoryStats MemoryStats `json:"memory_stats,omitempty "`
199- PidsStats PidsStats `json:"pids_stats,omitempty "`
200- BlkioStats BlkioStats `json:"blkio_stats,omitempty "`
196+ CpuStats CpuStats `json:"cpu_stats,omitzero"` //nolint:revive,staticcheck // Suppress "var-naming" warning.
197+ CPUSetStats CPUSetStats `json:"cpuset_stats,omitzero "`
198+ MemoryStats MemoryStats `json:"memory_stats,omitzero "`
199+ PidsStats PidsStats `json:"pids_stats,omitzero "`
200+ BlkioStats BlkioStats `json:"blkio_stats,omitzero "`
201201 // the map is in the format "size of hugepage: stats of the hugepage"
202- HugetlbStats map [string ]HugetlbStats `json:"hugetlb_stats,omitempty "`
203- RdmaStats RdmaStats `json:"rdma_stats,omitempty "`
202+ HugetlbStats map [string ]HugetlbStats `json:"hugetlb_stats,omitzero "`
203+ RdmaStats RdmaStats `json:"rdma_stats,omitzero "`
204204 // the map is in the format "misc resource name: stats of the key"
205- MiscStats map [string ]MiscStats `json:"misc_stats,omitempty "`
205+ MiscStats map [string ]MiscStats `json:"misc_stats,omitzero "`
206206}
207207
208208func NewStats () * Stats {
0 commit comments