From 4276e8e73adca3befbc45b77d2fac8a65bee988d Mon Sep 17 00:00:00 2001 From: bpopovschi Date: Thu, 14 Nov 2019 15:45:58 +0200 Subject: [PATCH 1/4] Added current and mas swap and memory usage stats Signed-off-by: bpopovschi --- v2/manager.go | 16 ++ v2/stats/metrics.pb.go | 538 +++++++++++++++++++++++++++++++++------- v2/stats/metrics.pb.txt | 47 ++++ v2/stats/metrics.proto | 9 + v2/utils.go | 23 ++ 5 files changed, 546 insertions(+), 87 deletions(-) diff --git a/v2/manager.go b/v2/manager.go index a7137190..9968d9ce 100644 --- a/v2/manager.go +++ b/v2/manager.go @@ -326,6 +326,22 @@ func (c *Manager) Stat() (*stats.Metrics, error) { ThpFaultAlloc: out["thp_fault_alloc"].(uint64), ThpCollapseAlloc: out["thp_collapse_alloc"].(uint64), } + cur_mem := getStatFileContent(filepath.Join(c.path, "memory.current")) + max_mem := getStatFileContent(filepath.Join(c.path, "memory.max")) + cur_swap := getStatFileContent(filepath.Join(c.path, "memory.swap.current")) + max_swap := getStatFileContent(filepath.Join(c.path, "memory.swap.max")) + + usage := stats.MemoryEntry{ + Usage: cur_mem, + Limit: max_mem, + } + swwap := stats.MemoryEntry{ + Usage: cur_swap, + Limit: max_swap, + } + metrics.Memory.Usage = &usage + metrics.Memory.SwapUsage = &swwap + return &metrics, nil } diff --git a/v2/stats/metrics.pb.go b/v2/stats/metrics.pb.go index 4c366da4..c4e5a9be 100644 --- a/v2/stats/metrics.pb.go +++ b/v2/stats/metrics.pb.go @@ -150,40 +150,42 @@ func (m *CPUStat) XXX_DiscardUnknown() { var xxx_messageInfo_CPUStat proto.InternalMessageInfo type MemoryStat struct { - Anon uint64 `protobuf:"varint,1,opt,name=anon,proto3" json:"anon,omitempty"` - File uint64 `protobuf:"varint,2,opt,name=file,proto3" json:"file,omitempty"` - KernelStack uint64 `protobuf:"varint,3,opt,name=kernel_stack,json=kernelStack,proto3" json:"kernel_stack,omitempty"` - Slab uint64 `protobuf:"varint,4,opt,name=slab,proto3" json:"slab,omitempty"` - Sock uint64 `protobuf:"varint,5,opt,name=sock,proto3" json:"sock,omitempty"` - Shmem uint64 `protobuf:"varint,6,opt,name=shmem,proto3" json:"shmem,omitempty"` - FileMapped uint64 `protobuf:"varint,7,opt,name=file_mapped,json=fileMapped,proto3" json:"file_mapped,omitempty"` - FileDirty uint64 `protobuf:"varint,8,opt,name=file_dirty,json=fileDirty,proto3" json:"file_dirty,omitempty"` - FileWriteback uint64 `protobuf:"varint,9,opt,name=file_writeback,json=fileWriteback,proto3" json:"file_writeback,omitempty"` - AnonThp uint64 `protobuf:"varint,10,opt,name=anon_thp,json=anonThp,proto3" json:"anon_thp,omitempty"` - InactiveAnon uint64 `protobuf:"varint,11,opt,name=inactive_anon,json=inactiveAnon,proto3" json:"inactive_anon,omitempty"` - ActiveAnon uint64 `protobuf:"varint,12,opt,name=active_anon,json=activeAnon,proto3" json:"active_anon,omitempty"` - InactiveFile uint64 `protobuf:"varint,13,opt,name=inactive_file,json=inactiveFile,proto3" json:"inactive_file,omitempty"` - ActiveFile uint64 `protobuf:"varint,14,opt,name=active_file,json=activeFile,proto3" json:"active_file,omitempty"` - Unevictable uint64 `protobuf:"varint,15,opt,name=unevictable,proto3" json:"unevictable,omitempty"` - SlabReclaimable uint64 `protobuf:"varint,16,opt,name=slab_reclaimable,json=slabReclaimable,proto3" json:"slab_reclaimable,omitempty"` - SlabUnreclaimable uint64 `protobuf:"varint,17,opt,name=slab_unreclaimable,json=slabUnreclaimable,proto3" json:"slab_unreclaimable,omitempty"` - Pgfault uint64 `protobuf:"varint,18,opt,name=pgfault,proto3" json:"pgfault,omitempty"` - Pgmajfault uint64 `protobuf:"varint,19,opt,name=pgmajfault,proto3" json:"pgmajfault,omitempty"` - WorkingsetRefault uint64 `protobuf:"varint,20,opt,name=workingset_refault,json=workingsetRefault,proto3" json:"workingset_refault,omitempty"` - WorkingsetActivate uint64 `protobuf:"varint,21,opt,name=workingset_activate,json=workingsetActivate,proto3" json:"workingset_activate,omitempty"` - WorkingsetNodereclaim uint64 `protobuf:"varint,22,opt,name=workingset_nodereclaim,json=workingsetNodereclaim,proto3" json:"workingset_nodereclaim,omitempty"` - Pgrefill uint64 `protobuf:"varint,23,opt,name=pgrefill,proto3" json:"pgrefill,omitempty"` - Pgscan uint64 `protobuf:"varint,24,opt,name=pgscan,proto3" json:"pgscan,omitempty"` - Pgsteal uint64 `protobuf:"varint,25,opt,name=pgsteal,proto3" json:"pgsteal,omitempty"` - Pgactivate uint64 `protobuf:"varint,26,opt,name=pgactivate,proto3" json:"pgactivate,omitempty"` - Pgdeactivate uint64 `protobuf:"varint,27,opt,name=pgdeactivate,proto3" json:"pgdeactivate,omitempty"` - Pglazyfree uint64 `protobuf:"varint,28,opt,name=pglazyfree,proto3" json:"pglazyfree,omitempty"` - Pglazyfreed uint64 `protobuf:"varint,29,opt,name=pglazyfreed,proto3" json:"pglazyfreed,omitempty"` - ThpFaultAlloc uint64 `protobuf:"varint,30,opt,name=thp_fault_alloc,json=thpFaultAlloc,proto3" json:"thp_fault_alloc,omitempty"` - ThpCollapseAlloc uint64 `protobuf:"varint,31,opt,name=thp_collapse_alloc,json=thpCollapseAlloc,proto3" json:"thp_collapse_alloc,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Anon uint64 `protobuf:"varint,1,opt,name=anon,proto3" json:"anon,omitempty"` + File uint64 `protobuf:"varint,2,opt,name=file,proto3" json:"file,omitempty"` + KernelStack uint64 `protobuf:"varint,3,opt,name=kernel_stack,json=kernelStack,proto3" json:"kernel_stack,omitempty"` + Slab uint64 `protobuf:"varint,4,opt,name=slab,proto3" json:"slab,omitempty"` + Sock uint64 `protobuf:"varint,5,opt,name=sock,proto3" json:"sock,omitempty"` + Shmem uint64 `protobuf:"varint,6,opt,name=shmem,proto3" json:"shmem,omitempty"` + FileMapped uint64 `protobuf:"varint,7,opt,name=file_mapped,json=fileMapped,proto3" json:"file_mapped,omitempty"` + FileDirty uint64 `protobuf:"varint,8,opt,name=file_dirty,json=fileDirty,proto3" json:"file_dirty,omitempty"` + FileWriteback uint64 `protobuf:"varint,9,opt,name=file_writeback,json=fileWriteback,proto3" json:"file_writeback,omitempty"` + AnonThp uint64 `protobuf:"varint,10,opt,name=anon_thp,json=anonThp,proto3" json:"anon_thp,omitempty"` + InactiveAnon uint64 `protobuf:"varint,11,opt,name=inactive_anon,json=inactiveAnon,proto3" json:"inactive_anon,omitempty"` + ActiveAnon uint64 `protobuf:"varint,12,opt,name=active_anon,json=activeAnon,proto3" json:"active_anon,omitempty"` + InactiveFile uint64 `protobuf:"varint,13,opt,name=inactive_file,json=inactiveFile,proto3" json:"inactive_file,omitempty"` + ActiveFile uint64 `protobuf:"varint,14,opt,name=active_file,json=activeFile,proto3" json:"active_file,omitempty"` + Unevictable uint64 `protobuf:"varint,15,opt,name=unevictable,proto3" json:"unevictable,omitempty"` + SlabReclaimable uint64 `protobuf:"varint,16,opt,name=slab_reclaimable,json=slabReclaimable,proto3" json:"slab_reclaimable,omitempty"` + SlabUnreclaimable uint64 `protobuf:"varint,17,opt,name=slab_unreclaimable,json=slabUnreclaimable,proto3" json:"slab_unreclaimable,omitempty"` + Pgfault uint64 `protobuf:"varint,18,opt,name=pgfault,proto3" json:"pgfault,omitempty"` + Pgmajfault uint64 `protobuf:"varint,19,opt,name=pgmajfault,proto3" json:"pgmajfault,omitempty"` + WorkingsetRefault uint64 `protobuf:"varint,20,opt,name=workingset_refault,json=workingsetRefault,proto3" json:"workingset_refault,omitempty"` + WorkingsetActivate uint64 `protobuf:"varint,21,opt,name=workingset_activate,json=workingsetActivate,proto3" json:"workingset_activate,omitempty"` + WorkingsetNodereclaim uint64 `protobuf:"varint,22,opt,name=workingset_nodereclaim,json=workingsetNodereclaim,proto3" json:"workingset_nodereclaim,omitempty"` + Pgrefill uint64 `protobuf:"varint,23,opt,name=pgrefill,proto3" json:"pgrefill,omitempty"` + Pgscan uint64 `protobuf:"varint,24,opt,name=pgscan,proto3" json:"pgscan,omitempty"` + Pgsteal uint64 `protobuf:"varint,25,opt,name=pgsteal,proto3" json:"pgsteal,omitempty"` + Pgactivate uint64 `protobuf:"varint,26,opt,name=pgactivate,proto3" json:"pgactivate,omitempty"` + Pgdeactivate uint64 `protobuf:"varint,27,opt,name=pgdeactivate,proto3" json:"pgdeactivate,omitempty"` + Pglazyfree uint64 `protobuf:"varint,28,opt,name=pglazyfree,proto3" json:"pglazyfree,omitempty"` + Pglazyfreed uint64 `protobuf:"varint,29,opt,name=pglazyfreed,proto3" json:"pglazyfreed,omitempty"` + ThpFaultAlloc uint64 `protobuf:"varint,30,opt,name=thp_fault_alloc,json=thpFaultAlloc,proto3" json:"thp_fault_alloc,omitempty"` + ThpCollapseAlloc uint64 `protobuf:"varint,31,opt,name=thp_collapse_alloc,json=thpCollapseAlloc,proto3" json:"thp_collapse_alloc,omitempty"` + Usage *MemoryEntry `protobuf:"bytes,32,opt,name=usage,proto3" json:"usage,omitempty"` + SwapUsage *MemoryEntry `protobuf:"bytes,33,opt,name=swap_usage,json=swapUsage,proto3" json:"swap_usage,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *MemoryStat) Reset() { *m = MemoryStat{} } @@ -218,11 +220,54 @@ func (m *MemoryStat) XXX_DiscardUnknown() { var xxx_messageInfo_MemoryStat proto.InternalMessageInfo +type MemoryEntry struct { + Limit uint64 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` + Usage uint64 `protobuf:"varint,2,opt,name=usage,proto3" json:"usage,omitempty"` + Max uint64 `protobuf:"varint,3,opt,name=max,proto3" json:"max,omitempty"` + Failcnt uint64 `protobuf:"varint,4,opt,name=failcnt,proto3" json:"failcnt,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MemoryEntry) Reset() { *m = MemoryEntry{} } +func (*MemoryEntry) ProtoMessage() {} +func (*MemoryEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_2fc6005842049e6b, []int{4} +} +func (m *MemoryEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MemoryEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MemoryEntry.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MemoryEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_MemoryEntry.Merge(m, src) +} +func (m *MemoryEntry) XXX_Size() int { + return m.Size() +} +func (m *MemoryEntry) XXX_DiscardUnknown() { + xxx_messageInfo_MemoryEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_MemoryEntry proto.InternalMessageInfo + func init() { proto.RegisterType((*Metrics)(nil), "io.containerd.cgroups.v2.Metrics") proto.RegisterType((*PidsStat)(nil), "io.containerd.cgroups.v2.PidsStat") proto.RegisterType((*CPUStat)(nil), "io.containerd.cgroups.v2.CPUStat") proto.RegisterType((*MemoryStat)(nil), "io.containerd.cgroups.v2.MemoryStat") + proto.RegisterType((*MemoryEntry)(nil), "io.containerd.cgroups.v2.MemoryEntry") } func init() { @@ -230,59 +275,63 @@ func init() { } var fileDescriptor_2fc6005842049e6b = []byte{ - // 818 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x55, 0x4d, 0x6f, 0x1b, 0x37, - 0x10, 0x8d, 0x6a, 0xc5, 0x92, 0x47, 0x76, 0xec, 0x30, 0x8e, 0xcb, 0x38, 0xb5, 0x9c, 0xa8, 0x1f, - 0x68, 0x81, 0x56, 0x02, 0xdc, 0x8f, 0x43, 0x91, 0x8b, 0xe3, 0x22, 0x37, 0x17, 0x86, 0x12, 0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, 0x3d, 0x93, 0x1f, 0x61, 0xd8, 0xb8, 0x61, 0x1c, 0x06, 0x69, 0x6d, 0xad, - 0xac, 0x3c, 0xad, 0xd0, 0x9f, 0x37, 0x25, 0xdb, 0x87, 0xfb, 0x85, 0x2a, 0x95, 0x27, 0x8f, 0xfd, - 0x79, 0x28, 0x26, 0x7f, 0xf5, 0x60, 0x10, 0x3d, 0xb1, 0x23, 0x80, 0xda, 0x89, 0x5c, 0x26, 0xb5, - 0x93, 0x69, 0x6c, 0xdf, 0x22, 0xe4, 0xd2, 0xc9, 0x94, 0x3d, 0x85, 0xad, 0xda, 0x49, 0x1b, 0xd8, - 0x30, 0x64, 0x88, 0x00, 0x91, 0xc7, 0x30, 0x72, 0xb7, 0xce, 0xcb, 0x32, 0xd0, 0x1b, 0x44, 0x43, - 0x80, 0x48, 0x70, 0x04, 0x50, 0xd9, 0xc4, 0x48, 0xab, 0x74, 0xe6, 0x68, 0xcd, 0xfe, 0x7c, 0xab, - 0xb2, 0x17, 0x01, 0x60, 0xcf, 0x61, 0xbb, 0xb2, 0x89, 0x5f, 0x5a, 0xed, 0x7d, 0x21, 0x33, 0x7e, - 0x9f, 0x04, 0xa3, 0xca, 0xbe, 0x69, 0x20, 0xf6, 0x39, 0x3c, 0x58, 0xf3, 0xe1, 0x96, 0x4d, 0x12, - 0xed, 0xac, 0x51, 0xbc, 0x68, 0xf2, 0xc7, 0x10, 0xa0, 0x0d, 0x89, 0x31, 0xe8, 0x8b, 0x4a, 0x57, - 0x71, 0x1d, 0x3a, 0x23, 0x76, 0xa5, 0x0a, 0x19, 0x97, 0xa0, 0x33, 0x1a, 0xb8, 0x96, 0xb6, 0x92, - 0x45, 0xe2, 0xbc, 0x48, 0xaf, 0xe3, 0x06, 0xa3, 0x80, 0xbd, 0x46, 0x08, 0xdb, 0x5c, 0x21, 0x16, - 0xd1, 0x3c, 0x9d, 0x09, 0xd3, 0xe9, 0x75, 0xf4, 0x4b, 0x67, 0x4c, 0xda, 0x2d, 0x4b, 0x59, 0x46, - 0x7f, 0xa1, 0xc0, 0x84, 0xf0, 0xa2, 0xa4, 0x14, 0xc6, 0xc8, 0x8c, 0x0f, 0x42, 0x42, 0x08, 0x9d, - 0x13, 0x82, 0x09, 0x91, 0x20, 0x53, 0xd6, 0xdf, 0xf2, 0x61, 0x48, 0x08, 0x91, 0x9f, 0x10, 0xc0, - 0xf5, 0x89, 0x7e, 0x6b, 0x95, 0x97, 0x0b, 0xb4, 0xb8, 0x15, 0xd6, 0x47, 0xf4, 0x97, 0x06, 0x64, - 0x4f, 0x60, 0x88, 0x3b, 0x26, 0x7e, 0x69, 0x38, 0x84, 0x5f, 0x00, 0xd6, 0x6f, 0x96, 0x86, 0x7d, - 0x0a, 0x3b, 0xaa, 0x12, 0xa9, 0x57, 0x37, 0x32, 0xa1, 0x4c, 0x46, 0xc4, 0x6f, 0x37, 0xe0, 0x29, - 0x66, 0x73, 0x0c, 0xa3, 0xae, 0x64, 0x3b, 0xd8, 0xec, 0x08, 0xba, 0x53, 0x28, 0xc5, 0x9d, 0x0f, - 0xa7, 0xbc, 0xc2, 0x34, 0xdb, 0x29, 0x24, 0x79, 0xd0, 0x9d, 0x42, 0x82, 0x67, 0x30, 0xaa, 0x2b, - 0x79, 0xa3, 0x52, 0x2f, 0x16, 0x85, 0xe4, 0xbb, 0x21, 0xed, 0x0e, 0xc4, 0xbe, 0x82, 0x3d, 0x4c, - 0x38, 0xb1, 0x32, 0x2d, 0x84, 0x2a, 0x49, 0xb6, 0x47, 0xb2, 0x5d, 0xc4, 0xe7, 0x2d, 0xcc, 0xbe, - 0x01, 0x46, 0xd2, 0xba, 0xea, 0x8a, 0x1f, 0x92, 0xf8, 0x21, 0x32, 0x97, 0x5d, 0x02, 0xdf, 0x88, - 0xc9, 0xaf, 0x44, 0x5d, 0x78, 0xce, 0x42, 0x42, 0xb1, 0x64, 0x63, 0x00, 0x93, 0x97, 0xe2, 0xd7, - 0x40, 0x3e, 0x0a, 0xae, 0x5b,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0xbd, 0x7f, 0xde, 0x8f, 0xef, 0xfd, - 0xbe, 0x1a, 0xf7, 0xde, 0xad, 0xc6, 0xbd, 0xbf, 0x57, 0xe3, 0xde, 0x7f, 0xab, 0x71, 0x6f, 0xb1, - 0x49, 0xff, 0x05, 0xdf, 0xfe, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x72, 0x49, 0x6e, 0x1c, 0x73, 0x06, - 0x00, 0x00, + // 895 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x4d, 0x73, 0x1b, 0x45, + 0x10, 0x8d, 0xb0, 0x62, 0x5b, 0x2d, 0x3b, 0x76, 0x26, 0x8e, 0x99, 0x38, 0x58, 0xb6, 0x05, 0xa1, + 0xa0, 0x0a, 0xa4, 0x2a, 0xf3, 0x71, 0x80, 0x5c, 0x1c, 0x87, 0xdc, 0x4c, 0xb9, 0x94, 0xa8, 0x38, + 0x6e, 0x8d, 0x76, 0x47, 0xab, 0xc1, 0xfb, 0x31, 0x35, 0x33, 0x6b, 0x23, 0x4e, 0xfc, 0x11, 0x7e, + 0x0a, 0xf7, 0xdc, 0xe0, 0xc8, 0x89, 0x22, 0xfa, 0x25, 0x54, 0xf7, 0xcc, 0x7a, 0x97, 0x83, 0x8b, + 0xe2, 0x36, 0xfd, 0xde, 0xeb, 0x9e, 0xee, 0x37, 0xda, 0x16, 0x7c, 0x99, 0x2a, 0xb7, 0xa8, 0x66, + 0xa3, 0xb8, 0xcc, 0xc7, 0x71, 0x59, 0x38, 0xa1, 0x0a, 0x69, 0x92, 0x71, 0x9c, 0x9a, 0xb2, 0xd2, + 0x76, 0x7c, 0x7d, 0x3a, 0xb6, 0x4e, 0x38, 0x3b, 0xce, 0xa5, 0x33, 0x2a, 0xb6, 0x23, 0x6d, 0x4a, + 0x57, 0x32, 0xae, 0xca, 0x51, 0xa3, 0x1e, 0x05, 0xf5, 0xe8, 0xfa, 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8f, 0xd5, 0xa0, 0xf3, 0xf7, 0x6a, 0xd0, 0x99, 0xad, 0xd3, 0xbf, 0xde, + 0x17, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x6b, 0xdf, 0xd8, 0xd9, 0x5d, 0x07, 0x00, 0x00, } func (m *Metrics) Marshal() (dAtA []byte, err error) { @@ -620,6 +669,71 @@ func (m *MemoryStat) MarshalTo(dAtA []byte) (int, error) { i++ i = encodeVarintMetrics(dAtA, i, uint64(m.ThpCollapseAlloc)) } + if m.Usage != nil { + dAtA[i] = 0x82 + i++ + dAtA[i] = 0x2 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Usage.Size())) + n4, err := m.Usage.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.SwapUsage != nil { + dAtA[i] = 0x8a + i++ + dAtA[i] = 0x2 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.SwapUsage.Size())) + n5, err := m.SwapUsage.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func (m *MemoryEntry) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MemoryEntry) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Limit != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Limit)) + } + if m.Usage != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Usage)) + } + if m.Max != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Max)) + } + if m.Failcnt != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Failcnt)) + } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -806,6 +920,38 @@ func (m *MemoryStat) Size() (n int) { if m.ThpCollapseAlloc != 0 { n += 2 + sovMetrics(uint64(m.ThpCollapseAlloc)) } + if m.Usage != nil { + l = m.Usage.Size() + n += 2 + l + sovMetrics(uint64(l)) + } + if m.SwapUsage != nil { + l = m.SwapUsage.Size() + n += 2 + l + sovMetrics(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *MemoryEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Limit != 0 { + n += 1 + sovMetrics(uint64(m.Limit)) + } + if m.Usage != 0 { + n += 1 + sovMetrics(uint64(m.Usage)) + } + if m.Max != 0 { + n += 1 + sovMetrics(uint64(m.Max)) + } + if m.Failcnt != 0 { + n += 1 + sovMetrics(uint64(m.Failcnt)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -902,6 +1048,22 @@ func (this *MemoryStat) String() string { `Pglazyfreed:` + fmt.Sprintf("%v", this.Pglazyfreed) + `,`, `ThpFaultAlloc:` + fmt.Sprintf("%v", this.ThpFaultAlloc) + `,`, `ThpCollapseAlloc:` + fmt.Sprintf("%v", this.ThpCollapseAlloc) + `,`, + `Usage:` + strings.Replace(fmt.Sprintf("%v", this.Usage), "MemoryEntry", "MemoryEntry", 1) + `,`, + `SwapUsage:` + strings.Replace(fmt.Sprintf("%v", this.SwapUsage), "MemoryEntry", "MemoryEntry", 1) + `,`, + `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, + `}`, + }, "") + return s +} +func (this *MemoryEntry) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&MemoryEntry{`, + `Limit:` + fmt.Sprintf("%v", this.Limit) + `,`, + `Usage:` + fmt.Sprintf("%v", this.Usage) + `,`, + `Max:` + fmt.Sprintf("%v", this.Max) + `,`, + `Failcnt:` + fmt.Sprintf("%v", this.Failcnt) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") @@ -1955,6 +2117,208 @@ func (m *MemoryStat) Unmarshal(dAtA []byte) error { break } } + case 32: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Usage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMetrics + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Usage == nil { + m.Usage = &MemoryEntry{} + } + if err := m.Usage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 33: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SwapUsage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMetrics + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMetrics + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SwapUsage == nil { + m.SwapUsage = &MemoryEntry{} + } + if err := m.SwapUsage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMetrics(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMetrics + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMetrics + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MemoryEntry) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MemoryEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MemoryEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) + } + m.Limit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Limit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Usage", wireType) + } + m.Usage = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Usage |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Max", wireType) + } + m.Max = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Max |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Failcnt", wireType) + } + m.Failcnt = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Failcnt |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipMetrics(dAtA[iNdEx:]) diff --git a/v2/stats/metrics.pb.txt b/v2/stats/metrics.pb.txt index bc4a0a6d..887cbfae 100755 --- a/v2/stats/metrics.pb.txt +++ b/v2/stats/metrics.pb.txt @@ -313,6 +313,53 @@ file { type: TYPE_UINT64 json_name: "thpCollapseAlloc" } + field { + name: "usage" + number: 32 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".io.containerd.cgroups.v2.MemoryEntry" + json_name: "usage" + } + field { + name: "swap_usage" + number: 33 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".io.containerd.cgroups.v2.MemoryEntry" + json_name: "swapUsage" + } + } + message_type { + name: "MemoryEntry" + field { + name: "limit" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_UINT64 + json_name: "limit" + } + field { + name: "usage" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_UINT64 + json_name: "usage" + } + field { + name: "max" + number: 3 + label: LABEL_OPTIONAL + type: TYPE_UINT64 + json_name: "max" + } + field { + name: "failcnt" + number: 4 + label: LABEL_OPTIONAL + type: TYPE_UINT64 + json_name: "failcnt" + } } syntax: "proto3" } diff --git a/v2/stats/metrics.proto b/v2/stats/metrics.proto index 1f71ce23..c20c9069 100644 --- a/v2/stats/metrics.proto +++ b/v2/stats/metrics.proto @@ -56,6 +56,15 @@ message MemoryStat { uint64 pglazyfreed = 29; uint64 thp_fault_alloc = 30; uint64 thp_collapse_alloc = 31; + MemoryEntry usage = 32; + MemoryEntry swap_usage = 33; +} + +message MemoryEntry { + uint64 limit = 1; + uint64 usage = 2; + uint64 max = 3; + uint64 failcnt = 4; } // iostat diff --git a/v2/utils.go b/v2/utils.go index 7d5f711e..7f5295f9 100644 --- a/v2/utils.go +++ b/v2/utils.go @@ -19,8 +19,10 @@ package v2 import ( "bufio" "fmt" + "github.com/sirupsen/logrus" "io" "io/ioutil" + "math" "os" "strconv" "strings" @@ -216,3 +218,24 @@ func ToResources(spec *specs.LinuxResources) *Resources { } return &resources } + +// Gets uint64 parsed content of single value cgroup stat file +func getStatFileContent(filePath string) uint64 { + contents, err := ioutil.ReadFile(filePath) + if err != nil { + logrus.Error(err) + return 0 + } + trimmed := strings.TrimSpace(string(contents)) + if trimmed == "max" { + return math.MaxUint64 + } + + res, err := parseUint(trimmed, 10, 64) + if err != nil { + logrus.Errorf("unable to parse %q as a uint from Cgroup file %q", string(contents), filePath) + return res + } + + return res +} From 344a8ab471a2dd96068c8963b3e3ce2777c15b98 Mon Sep 17 00:00:00 2001 From: bpopovschi Date: Thu, 14 Nov 2019 17:57:31 +0200 Subject: [PATCH 2/4] Remove unused metrics Signed-off-by: bpopovschi --- v2/stats/metrics.pb.go | 171 +++++++++++++--------------------------- v2/stats/metrics.pb.txt | 14 ---- v2/stats/metrics.proto | 2 - 3 files changed, 56 insertions(+), 131 deletions(-) diff --git a/v2/stats/metrics.pb.go b/v2/stats/metrics.pb.go index c4e5a9be..fc9eebba 100644 --- a/v2/stats/metrics.pb.go +++ b/v2/stats/metrics.pb.go @@ -223,8 +223,6 @@ var xxx_messageInfo_MemoryStat proto.InternalMessageInfo type MemoryEntry struct { Limit uint64 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` Usage uint64 `protobuf:"varint,2,opt,name=usage,proto3" json:"usage,omitempty"` - Max uint64 `protobuf:"varint,3,opt,name=max,proto3" json:"max,omitempty"` - Failcnt uint64 `protobuf:"varint,4,opt,name=failcnt,proto3" json:"failcnt,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -275,63 +273,62 @@ func init() { } var fileDescriptor_2fc6005842049e6b = []byte{ - // 895 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x4d, 0x73, 0x1b, 0x45, - 0x10, 0x8d, 0xb0, 0x62, 0x5b, 0x2d, 0x3b, 0x76, 0x26, 0x8e, 0x99, 0x38, 0x58, 0xb6, 0x05, 0xa1, - 0xa0, 0x0a, 0xa4, 0x2a, 0xf3, 0x71, 0x80, 0x5c, 0x1c, 0x87, 0xdc, 0x4c, 0xb9, 0x94, 0xa8, 0x38, - 0x6e, 0x8d, 0x76, 0x47, 0xab, 0xc1, 0xfb, 0x31, 0x35, 0x33, 0x6b, 0x23, 0x4e, 0xfc, 0x11, 0x7e, - 0x0a, 0xf7, 0xdc, 0xe0, 0xc8, 0x89, 0x22, 0xfa, 0x25, 0x54, 0xf7, 0xcc, 0x7a, 0x97, 0x83, 0x8b, - 0xe2, 0x36, 0xfd, 0xde, 0xeb, 0x9e, 0xee, 0x37, 0xda, 0x16, 0x7c, 0x99, 0x2a, 0xb7, 0xa8, 0x66, - 0xa3, 0xb8, 0xcc, 0xc7, 0x71, 0x59, 0x38, 0xa1, 0x0a, 0x69, 0x92, 0x71, 0x9c, 0x9a, 0xb2, 0xd2, - 0x76, 0x7c, 0x7d, 0x3a, 0xb6, 0x4e, 0x38, 0x3b, 0xce, 0xa5, 0x33, 0x2a, 0xb6, 0x23, 0x6d, 0x4a, - 0x57, 0x32, 0xae, 0xca, 0x51, 0xa3, 0x1e, 0x05, 0xf5, 0xe8, 0xfa, 0xf4, 0x60, 0x2f, 0x2d, 0xd3, - 0x92, 0x44, 0x63, 0x3c, 0x79, 0xfd, 0xf0, 0xb7, 0x0e, 0x6c, 0x5c, 0xf8, 0x0a, 0xec, 0x6b, 0xe8, - 0x6a, 0x95, 0x58, 0xde, 0x39, 0xee, 0x7c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4c, 0xfc, 0xbc, 0x9c, 0x1b, 0x29, 0xf9, - 0x07, 0x75, 0x8d, 0x1a, 0xc1, 0xe7, 0x6f, 0xa2, 0x84, 0x1f, 0xfa, 0xe7, 0x6f, 0x41, 0xec, 0x63, - 0xd8, 0x71, 0x0b, 0x1d, 0x91, 0x91, 0x91, 0xc8, 0xb2, 0x32, 0xe6, 0x83, 0xfa, 0x73, 0xd7, 0xaf, - 0x10, 0x3d, 0x43, 0x90, 0x7d, 0x06, 0x0c, 0x75, 0x71, 0x99, 0x65, 0x42, 0x5b, 0x19, 0xa4, 0x47, - 0x24, 0xdd, 0x75, 0x0b, 0x7d, 0x1e, 0x08, 0xaf, 0xfe, 0x16, 0xee, 0xd3, 0x42, 0xe3, 0xc7, 0xb4, - 0x67, 0x9f, 0xfd, 0xd7, 0x9e, 0xfd, 0xae, 0x70, 0x66, 0x39, 0xf1, 0x39, 0xec, 0x25, 0x80, 0xbd, - 0x11, 0x3a, 0xf2, 0x15, 0x4e, 0xfe, 0x4f, 0x85, 0x1e, 0x26, 0x4e, 0x31, 0x6f, 0x28, 0xa1, 0xdf, - 0x62, 0x9a, 0xb5, 0xdc, 0x69, 0xad, 0x65, 0x44, 0xfd, 0x2d, 0x61, 0x59, 0xfb, 0x06, 0x76, 0x61, - 0x2d, 0x17, 0x3f, 0x85, 0xd5, 0x84, 0x47, 0x7c, 0xc5, 0xb9, 0x50, 0x59, 0x5c, 0xb8, 0xb0, 0x95, - 0xea, 0xf0, 0x05, 0x7f, 0xfb, 0x6e, 0x70, 0xef, 0xcf, 0x77, 0x83, 0x7b, 0xbf, 0xac, 0x06, 0x9d, - 0xb7, 0xab, 0x41, 0xe7, 0x8f, 0xd5, 0xa0, 0xf3, 0xf7, 0x6a, 0xd0, 0x99, 0xad, 0xd3, 0xbf, 0xde, - 0x17, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x6b, 0xdf, 0xd8, 0xd9, 0x5d, 0x07, 0x00, 0x00, + // 874 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x4d, 0x6f, 0x1b, 0x45, + 0x18, 0xee, 0x12, 0x27, 0xb6, 0x5f, 0x27, 0x4d, 0x3a, 0x4d, 0xc3, 0x34, 0x25, 0x4e, 0x62, 0x28, + 0x02, 0x09, 0x6c, 0x29, 0x7c, 0x48, 0x40, 0x2f, 0x69, 0x4a, 0x6f, 0x41, 0x91, 0x5b, 0x8b, 0xe3, + 0x6a, 0xbc, 0x3b, 0x59, 0x0f, 0xd9, 0x8f, 0xd1, 0xcc, 0x6c, 0x22, 0x73, 0xe2, 0x8f, 0xf0, 0x53, + 0xb8, 0xf7, 0x06, 0x47, 0x4e, 0x88, 0xf8, 0x97, 0xa0, 0xf7, 0x9d, 0xdd, 0xec, 0x72, 0x88, 0x10, + 0xb7, 0x79, 0x9f, 0xe7, 0x79, 0xbf, 0x9e, 0xf5, 0x8c, 0xe1, 0xcb, 0x44, 0xb9, 0x45, 0x39, 0x1f, + 0x47, 0x45, 0x36, 0x89, 0x8a, 0xdc, 0x09, 0x95, 0x4b, 0x13, 0x4f, 0xa2, 0xc4, 0x14, 0xa5, 0xb6, + 0x93, 0xeb, 0x93, 0x89, 0x75, 0xc2, 0xd9, 0x49, 0x26, 0x9d, 0x51, 0x91, 0x1d, 0x6b, 0x53, 0xb8, + 0x82, 0x71, 0x55, 0x8c, 0x1b, 0xf5, 0xb8, 0x52, 0x8f, 0xaf, 0x4f, 0xf6, 0x77, 0x93, 0x22, 0x29, + 0x48, 0x34, 0xc1, 0x93, 0xd7, 0x8f, 0x7e, 0x0b, 0xa0, 0x7b, 0xee, 0x2b, 0xb0, 0xaf, 0xa1, 0xa3, + 0x55, 0x6c, 0x79, 0x70, 0x14, 0x7c, 0x32, 0x38, 0x19, 0x8d, 0xef, 0x2b, 0x35, 0xbe, 0x50, 0xb1, + 0x7d, 0xe3, 0x84, 0x9b, 0x92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f, 0xfc, 0xe7, 0x6f, 0x41, 0xec, 0x63, 0xd8, + 0x76, 0x0b, 0x1d, 0x92, 0x91, 0xa1, 0x48, 0xd3, 0x22, 0xe2, 0xc3, 0xfa, 0xba, 0xeb, 0xd7, 0x88, + 0x9e, 0x22, 0xc8, 0x3e, 0x03, 0x86, 0xba, 0xa8, 0x48, 0x53, 0xa1, 0xad, 0xac, 0xa4, 0x87, 0x24, + 0xdd, 0x71, 0x0b, 0x7d, 0x56, 0x11, 0x5e, 0xfd, 0x1d, 0xac, 0xd3, 0x83, 0xc6, 0x8f, 0xe8, 0x9d, + 0x7d, 0xfe, 0x5f, 0xef, 0xec, 0xf7, 0xb9, 0x33, 0xcb, 0xa9, 0xcf, 0x61, 0xaf, 0x00, 0xec, 0x8d, + 0xd0, 0xa1, 0xaf, 0x70, 0xfc, 0x7f, 0x2a, 0xf4, 0x31, 0x71, 0x86, 0x79, 0xa3, 0x6f, 0x60, 0xd0, + 0x62, 0x9a, 0x67, 0x39, 0x68, 0x3d, 0xcb, 0x88, 0xfa, 0x2e, 0xd5, 0x63, 0x4d, 0xc1, 0x4b, 0xfe, + 0xee, 0x76, 0xf8, 0xe0, 0xcf, 0xdb, 0xe1, 0x83, 0x5f, 0x56, 0xc3, 0xe0, 0xdd, 0x6a, 0x18, 0xfc, + 0xb1, 0x1a, 0x06, 0x7f, 0xaf, 0x86, 0xc1, 0x7c, 0x83, 0xfe, 0xc9, 0xbe, 0xf8, 0x27, 0x00, 0x00, + 0xff, 0xff, 0x4d, 0x18, 0x91, 0x3b, 0x31, 0x07, 0x00, 0x00, } func (m *Metrics) Marshal() (dAtA []byte, err error) { @@ -724,16 +721,6 @@ func (m *MemoryEntry) MarshalTo(dAtA []byte) (int, error) { i++ i = encodeVarintMetrics(dAtA, i, uint64(m.Usage)) } - if m.Max != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintMetrics(dAtA, i, uint64(m.Max)) - } - if m.Failcnt != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintMetrics(dAtA, i, uint64(m.Failcnt)) - } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -946,12 +933,6 @@ func (m *MemoryEntry) Size() (n int) { if m.Usage != 0 { n += 1 + sovMetrics(uint64(m.Usage)) } - if m.Max != 0 { - n += 1 + sovMetrics(uint64(m.Max)) - } - if m.Failcnt != 0 { - n += 1 + sovMetrics(uint64(m.Failcnt)) - } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1062,8 +1043,6 @@ func (this *MemoryEntry) String() string { s := strings.Join([]string{`&MemoryEntry{`, `Limit:` + fmt.Sprintf("%v", this.Limit) + `,`, `Usage:` + fmt.Sprintf("%v", this.Usage) + `,`, - `Max:` + fmt.Sprintf("%v", this.Max) + `,`, - `Failcnt:` + fmt.Sprintf("%v", this.Failcnt) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") @@ -2281,44 +2260,6 @@ func (m *MemoryEntry) Unmarshal(dAtA []byte) error { break } } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Max", wireType) - } - m.Max = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Max |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Failcnt", wireType) - } - m.Failcnt = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Failcnt |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipMetrics(dAtA[iNdEx:]) diff --git a/v2/stats/metrics.pb.txt b/v2/stats/metrics.pb.txt index 887cbfae..c0dd3f12 100755 --- a/v2/stats/metrics.pb.txt +++ b/v2/stats/metrics.pb.txt @@ -346,20 +346,6 @@ file { type: TYPE_UINT64 json_name: "usage" } - field { - name: "max" - number: 3 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "max" - } - field { - name: "failcnt" - number: 4 - label: LABEL_OPTIONAL - type: TYPE_UINT64 - json_name: "failcnt" - } } syntax: "proto3" } diff --git a/v2/stats/metrics.proto b/v2/stats/metrics.proto index c20c9069..59d842f3 100644 --- a/v2/stats/metrics.proto +++ b/v2/stats/metrics.proto @@ -63,8 +63,6 @@ message MemoryStat { message MemoryEntry { uint64 limit = 1; uint64 usage = 2; - uint64 max = 3; - uint64 failcnt = 4; } // iostat From 4d88c26a2d0f62baae782ce922975473b41291a6 Mon Sep 17 00:00:00 2001 From: bpopovschi Date: Thu, 14 Nov 2019 18:09:48 +0200 Subject: [PATCH 3/4] Simplify stats Signed-off-by: bpopovschi --- v2/manager.go | 19 +- v2/stats/metrics.pb.go | 449 ++++++++++++---------------------------- v2/stats/metrics.pb.txt | 25 +-- v2/stats/metrics.proto | 11 +- 4 files changed, 153 insertions(+), 351 deletions(-) diff --git a/v2/manager.go b/v2/manager.go index 9968d9ce..d511e3b9 100644 --- a/v2/manager.go +++ b/v2/manager.go @@ -325,22 +325,11 @@ func (c *Manager) Stat() (*stats.Metrics, error) { Pglazyfreed: out["pglazyfreed"].(uint64), ThpFaultAlloc: out["thp_fault_alloc"].(uint64), ThpCollapseAlloc: out["thp_collapse_alloc"].(uint64), + Usage: getStatFileContent(filepath.Join(c.path, "memory.current")), + UsageLimit: getStatFileContent(filepath.Join(c.path, "memory.max")), + SwapUsage: getStatFileContent(filepath.Join(c.path, "memory.swap.current")), + SwapLimit: getStatFileContent(filepath.Join(c.path, "memory.swap.max")), } - cur_mem := getStatFileContent(filepath.Join(c.path, "memory.current")) - max_mem := getStatFileContent(filepath.Join(c.path, "memory.max")) - cur_swap := getStatFileContent(filepath.Join(c.path, "memory.swap.current")) - max_swap := getStatFileContent(filepath.Join(c.path, "memory.swap.max")) - - usage := stats.MemoryEntry{ - Usage: cur_mem, - Limit: max_mem, - } - swwap := stats.MemoryEntry{ - Usage: cur_swap, - Limit: max_swap, - } - metrics.Memory.Usage = &usage - metrics.Memory.SwapUsage = &swwap return &metrics, nil } diff --git a/v2/stats/metrics.pb.go b/v2/stats/metrics.pb.go index fc9eebba..0d286e3d 100644 --- a/v2/stats/metrics.pb.go +++ b/v2/stats/metrics.pb.go @@ -150,42 +150,44 @@ func (m *CPUStat) XXX_DiscardUnknown() { var xxx_messageInfo_CPUStat proto.InternalMessageInfo type MemoryStat struct { - Anon uint64 `protobuf:"varint,1,opt,name=anon,proto3" json:"anon,omitempty"` - File uint64 `protobuf:"varint,2,opt,name=file,proto3" json:"file,omitempty"` - KernelStack uint64 `protobuf:"varint,3,opt,name=kernel_stack,json=kernelStack,proto3" json:"kernel_stack,omitempty"` - Slab uint64 `protobuf:"varint,4,opt,name=slab,proto3" json:"slab,omitempty"` - Sock uint64 `protobuf:"varint,5,opt,name=sock,proto3" json:"sock,omitempty"` - Shmem uint64 `protobuf:"varint,6,opt,name=shmem,proto3" json:"shmem,omitempty"` - FileMapped uint64 `protobuf:"varint,7,opt,name=file_mapped,json=fileMapped,proto3" json:"file_mapped,omitempty"` - FileDirty uint64 `protobuf:"varint,8,opt,name=file_dirty,json=fileDirty,proto3" json:"file_dirty,omitempty"` - FileWriteback uint64 `protobuf:"varint,9,opt,name=file_writeback,json=fileWriteback,proto3" json:"file_writeback,omitempty"` - AnonThp uint64 `protobuf:"varint,10,opt,name=anon_thp,json=anonThp,proto3" json:"anon_thp,omitempty"` - InactiveAnon uint64 `protobuf:"varint,11,opt,name=inactive_anon,json=inactiveAnon,proto3" json:"inactive_anon,omitempty"` - ActiveAnon uint64 `protobuf:"varint,12,opt,name=active_anon,json=activeAnon,proto3" json:"active_anon,omitempty"` - InactiveFile uint64 `protobuf:"varint,13,opt,name=inactive_file,json=inactiveFile,proto3" json:"inactive_file,omitempty"` - ActiveFile uint64 `protobuf:"varint,14,opt,name=active_file,json=activeFile,proto3" json:"active_file,omitempty"` - Unevictable uint64 `protobuf:"varint,15,opt,name=unevictable,proto3" json:"unevictable,omitempty"` - SlabReclaimable uint64 `protobuf:"varint,16,opt,name=slab_reclaimable,json=slabReclaimable,proto3" json:"slab_reclaimable,omitempty"` - SlabUnreclaimable uint64 `protobuf:"varint,17,opt,name=slab_unreclaimable,json=slabUnreclaimable,proto3" json:"slab_unreclaimable,omitempty"` - Pgfault uint64 `protobuf:"varint,18,opt,name=pgfault,proto3" json:"pgfault,omitempty"` - Pgmajfault uint64 `protobuf:"varint,19,opt,name=pgmajfault,proto3" json:"pgmajfault,omitempty"` - WorkingsetRefault uint64 `protobuf:"varint,20,opt,name=workingset_refault,json=workingsetRefault,proto3" json:"workingset_refault,omitempty"` - WorkingsetActivate uint64 `protobuf:"varint,21,opt,name=workingset_activate,json=workingsetActivate,proto3" json:"workingset_activate,omitempty"` - WorkingsetNodereclaim uint64 `protobuf:"varint,22,opt,name=workingset_nodereclaim,json=workingsetNodereclaim,proto3" json:"workingset_nodereclaim,omitempty"` - Pgrefill uint64 `protobuf:"varint,23,opt,name=pgrefill,proto3" json:"pgrefill,omitempty"` - Pgscan uint64 `protobuf:"varint,24,opt,name=pgscan,proto3" json:"pgscan,omitempty"` - Pgsteal uint64 `protobuf:"varint,25,opt,name=pgsteal,proto3" json:"pgsteal,omitempty"` - Pgactivate uint64 `protobuf:"varint,26,opt,name=pgactivate,proto3" json:"pgactivate,omitempty"` - Pgdeactivate uint64 `protobuf:"varint,27,opt,name=pgdeactivate,proto3" json:"pgdeactivate,omitempty"` - Pglazyfree uint64 `protobuf:"varint,28,opt,name=pglazyfree,proto3" json:"pglazyfree,omitempty"` - Pglazyfreed uint64 `protobuf:"varint,29,opt,name=pglazyfreed,proto3" json:"pglazyfreed,omitempty"` - ThpFaultAlloc uint64 `protobuf:"varint,30,opt,name=thp_fault_alloc,json=thpFaultAlloc,proto3" json:"thp_fault_alloc,omitempty"` - ThpCollapseAlloc uint64 `protobuf:"varint,31,opt,name=thp_collapse_alloc,json=thpCollapseAlloc,proto3" json:"thp_collapse_alloc,omitempty"` - Usage *MemoryEntry `protobuf:"bytes,32,opt,name=usage,proto3" json:"usage,omitempty"` - SwapUsage *MemoryEntry `protobuf:"bytes,33,opt,name=swap_usage,json=swapUsage,proto3" json:"swap_usage,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Anon uint64 `protobuf:"varint,1,opt,name=anon,proto3" json:"anon,omitempty"` + File uint64 `protobuf:"varint,2,opt,name=file,proto3" json:"file,omitempty"` + KernelStack uint64 `protobuf:"varint,3,opt,name=kernel_stack,json=kernelStack,proto3" json:"kernel_stack,omitempty"` + Slab uint64 `protobuf:"varint,4,opt,name=slab,proto3" json:"slab,omitempty"` + Sock uint64 `protobuf:"varint,5,opt,name=sock,proto3" json:"sock,omitempty"` + Shmem uint64 `protobuf:"varint,6,opt,name=shmem,proto3" json:"shmem,omitempty"` + FileMapped uint64 `protobuf:"varint,7,opt,name=file_mapped,json=fileMapped,proto3" json:"file_mapped,omitempty"` + FileDirty uint64 `protobuf:"varint,8,opt,name=file_dirty,json=fileDirty,proto3" json:"file_dirty,omitempty"` + FileWriteback uint64 `protobuf:"varint,9,opt,name=file_writeback,json=fileWriteback,proto3" json:"file_writeback,omitempty"` + AnonThp uint64 `protobuf:"varint,10,opt,name=anon_thp,json=anonThp,proto3" json:"anon_thp,omitempty"` + InactiveAnon uint64 `protobuf:"varint,11,opt,name=inactive_anon,json=inactiveAnon,proto3" json:"inactive_anon,omitempty"` + ActiveAnon uint64 `protobuf:"varint,12,opt,name=active_anon,json=activeAnon,proto3" json:"active_anon,omitempty"` + InactiveFile uint64 `protobuf:"varint,13,opt,name=inactive_file,json=inactiveFile,proto3" json:"inactive_file,omitempty"` + ActiveFile uint64 `protobuf:"varint,14,opt,name=active_file,json=activeFile,proto3" json:"active_file,omitempty"` + Unevictable uint64 `protobuf:"varint,15,opt,name=unevictable,proto3" json:"unevictable,omitempty"` + SlabReclaimable uint64 `protobuf:"varint,16,opt,name=slab_reclaimable,json=slabReclaimable,proto3" json:"slab_reclaimable,omitempty"` + SlabUnreclaimable uint64 `protobuf:"varint,17,opt,name=slab_unreclaimable,json=slabUnreclaimable,proto3" json:"slab_unreclaimable,omitempty"` + Pgfault uint64 `protobuf:"varint,18,opt,name=pgfault,proto3" json:"pgfault,omitempty"` + Pgmajfault uint64 `protobuf:"varint,19,opt,name=pgmajfault,proto3" json:"pgmajfault,omitempty"` + WorkingsetRefault uint64 `protobuf:"varint,20,opt,name=workingset_refault,json=workingsetRefault,proto3" json:"workingset_refault,omitempty"` + WorkingsetActivate uint64 `protobuf:"varint,21,opt,name=workingset_activate,json=workingsetActivate,proto3" json:"workingset_activate,omitempty"` + WorkingsetNodereclaim uint64 `protobuf:"varint,22,opt,name=workingset_nodereclaim,json=workingsetNodereclaim,proto3" json:"workingset_nodereclaim,omitempty"` + Pgrefill uint64 `protobuf:"varint,23,opt,name=pgrefill,proto3" json:"pgrefill,omitempty"` + Pgscan uint64 `protobuf:"varint,24,opt,name=pgscan,proto3" json:"pgscan,omitempty"` + Pgsteal uint64 `protobuf:"varint,25,opt,name=pgsteal,proto3" json:"pgsteal,omitempty"` + Pgactivate uint64 `protobuf:"varint,26,opt,name=pgactivate,proto3" json:"pgactivate,omitempty"` + Pgdeactivate uint64 `protobuf:"varint,27,opt,name=pgdeactivate,proto3" json:"pgdeactivate,omitempty"` + Pglazyfree uint64 `protobuf:"varint,28,opt,name=pglazyfree,proto3" json:"pglazyfree,omitempty"` + Pglazyfreed uint64 `protobuf:"varint,29,opt,name=pglazyfreed,proto3" json:"pglazyfreed,omitempty"` + ThpFaultAlloc uint64 `protobuf:"varint,30,opt,name=thp_fault_alloc,json=thpFaultAlloc,proto3" json:"thp_fault_alloc,omitempty"` + ThpCollapseAlloc uint64 `protobuf:"varint,31,opt,name=thp_collapse_alloc,json=thpCollapseAlloc,proto3" json:"thp_collapse_alloc,omitempty"` + Usage uint64 `protobuf:"varint,32,opt,name=usage,proto3" json:"usage,omitempty"` + UsageLimit uint64 `protobuf:"varint,33,opt,name=usage_limit,json=usageLimit,proto3" json:"usage_limit,omitempty"` + SwapUsage uint64 `protobuf:"varint,34,opt,name=swap_usage,json=swapUsage,proto3" json:"swap_usage,omitempty"` + SwapLimit uint64 `protobuf:"varint,35,opt,name=swap_limit,json=swapLimit,proto3" json:"swap_limit,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *MemoryStat) Reset() { *m = MemoryStat{} } @@ -220,52 +222,11 @@ func (m *MemoryStat) XXX_DiscardUnknown() { var xxx_messageInfo_MemoryStat proto.InternalMessageInfo -type MemoryEntry struct { - Limit uint64 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` - Usage uint64 `protobuf:"varint,2,opt,name=usage,proto3" json:"usage,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MemoryEntry) Reset() { *m = MemoryEntry{} } -func (*MemoryEntry) ProtoMessage() {} -func (*MemoryEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_2fc6005842049e6b, []int{4} -} -func (m *MemoryEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MemoryEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MemoryEntry.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MemoryEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_MemoryEntry.Merge(m, src) -} -func (m *MemoryEntry) XXX_Size() int { - return m.Size() -} -func (m *MemoryEntry) XXX_DiscardUnknown() { - xxx_messageInfo_MemoryEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_MemoryEntry proto.InternalMessageInfo - func init() { proto.RegisterType((*Metrics)(nil), "io.containerd.cgroups.v2.Metrics") proto.RegisterType((*PidsStat)(nil), "io.containerd.cgroups.v2.PidsStat") proto.RegisterType((*CPUStat)(nil), "io.containerd.cgroups.v2.CPUStat") proto.RegisterType((*MemoryStat)(nil), "io.containerd.cgroups.v2.MemoryStat") - proto.RegisterType((*MemoryEntry)(nil), "io.containerd.cgroups.v2.MemoryEntry") } func init() { @@ -273,62 +234,61 @@ func init() { } var fileDescriptor_2fc6005842049e6b = []byte{ - // 874 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x4d, 0x6f, 0x1b, 0x45, - 0x18, 0xee, 0x12, 0x27, 0xb6, 0x5f, 0x27, 0x4d, 0x3a, 0x4d, 0xc3, 0x34, 0x25, 0x4e, 0x62, 0x28, - 0x02, 0x09, 0x6c, 0x29, 0x7c, 0x48, 0x40, 0x2f, 0x69, 0x4a, 0x6f, 0x41, 0x91, 0x5b, 0x8b, 0xe3, - 0x6a, 0xbc, 0x3b, 0x59, 0x0f, 0xd9, 0x8f, 0xd1, 0xcc, 0x6c, 0x22, 0x73, 0xe2, 0x8f, 0xf0, 0x53, - 0xb8, 0xf7, 0x06, 0x47, 0x4e, 0x88, 0xf8, 0x97, 0xa0, 0xf7, 0x9d, 0xdd, 0xec, 0x72, 0x88, 0x10, - 0xb7, 0x79, 0x9f, 0xe7, 0x79, 0xbf, 0x9e, 0xf5, 0x8c, 0xe1, 0xcb, 0x44, 0xb9, 0x45, 0x39, 0x1f, - 0x47, 0x45, 0x36, 0x89, 0x8a, 0xdc, 0x09, 0x95, 0x4b, 0x13, 0x4f, 0xa2, 0xc4, 0x14, 0xa5, 0xb6, - 0x93, 0x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xe0, 0xdd, 0x6a, 0x18, 0xfc, - 0xb1, 0x1a, 0x06, 0x7f, 0xaf, 0x86, 0xc1, 0x7c, 0x83, 0xfe, 0xc9, 0xbe, 0xf8, 0x27, 0x00, 0x00, - 0xff, 0xff, 0x4d, 0x18, 0x91, 0x3b, 0x31, 0x07, 0x00, 0x00, + // 864 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x55, 0x4d, 0x73, 0x1b, 0x45, + 0x10, 0x8d, 0xb0, 0x6c, 0x49, 0x2d, 0x3b, 0x76, 0x26, 0x8e, 0x99, 0x38, 0x58, 0xb6, 0x15, 0xa0, + 0xa0, 0x0a, 0xa4, 0x2a, 0xf3, 0x71, 0xa0, 0x72, 0x71, 0x4c, 0xe5, 0x84, 0x29, 0x97, 0x12, 0x15, + 0xc7, 0xad, 0xd1, 0xee, 0x78, 0xb5, 0x78, 0x3f, 0xa6, 0x66, 0x66, 0xed, 0x32, 0x27, 0xfe, 0x01, + 0xbf, 0x88, 0x7b, 0x6e, 0x70, 0xe4, 0x44, 0x61, 0xfd, 0x12, 0xaa, 0xbb, 0x77, 0xbd, 0x9b, 0x83, + 0x6f, 0xd3, 0xef, 0xbd, 0xee, 0xe9, 0x7e, 0xab, 0x1e, 0xc1, 0xb7, 0x71, 0xe2, 0x97, 0xe5, 0x62, + 0x12, 0x16, 0xd9, 0x34, 0x2c, 0x72, 0xaf, 0x92, 0x5c, 0xdb, 0x68, 0x1a, 0xc6, 0xb6, 0x28, 0x8d, + 0x9b, 0x5e, 0x9f, 0x4c, 0x9d, 0x57, 0xde, 0x4d, 0x33, 0xed, 0x6d, 0x12, 0xba, 0x89, 0xb1, 0x85, + 0x2f, 0x84, 0x4c, 0x8a, 0x49, 0xa3, 0x9e, 0x54, 0xea, 0xc9, 0xf5, 0xc9, 0xfe, 0x6e, 0x5c, 0xc4, + 0x05, 0x89, 0xa6, 0x78, 0x62,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 0x6a, 0x44, 0x8c, 0x61, 0xd3, 0xc4, 0x91, 0xbe, + 0x57, 0xbc, 0xe0, 0xef, 0xdf, 0xc6, 0xb8, 0x46, 0xaa, 0x7e, 0xbb, 0xbd, 0xb4, 0x5a, 0xcb, 0x4f, + 0xea, 0x1a, 0x35, 0x82, 0x9f, 0xbf, 0x89, 0x22, 0x79, 0xc0, 0x9f, 0xbf, 0x05, 0x89, 0xcf, 0x61, + 0xdb, 0x2f, 0x4d, 0x40, 0x46, 0x06, 0x2a, 0x4d, 0x8b, 0x50, 0x8e, 0xea, 0x75, 0x37, 0x6f, 0x10, + 0x3d, 0x45, 0x50, 0x7c, 0x05, 0x02, 0x75, 0x61, 0x91, 0xa6, 0xca, 0x38, 0x5d, 0x49, 0x0f, 0x49, + 0xba, 0xe3, 0x97, 0xe6, 0xac, 0x22, 0x58, 0xbd, 0x0b, 0xeb, 0xf4, 0xa0, 0xc9, 0x23, 0x5e, 0x4d, + 0x0a, 0xf0, 0xd7, 0xca, 0x0f, 0x1f, 0x3f, 0x90, 0xc7, 0xdc, 0x2e, 0x41, 0x3f, 0x21, 0x82, 0xab, + 0xe9, 0x6e, 0x94, 0x09, 0x38, 0x77, 0xcc, 0xab, 0x89, 0xc8, 0x9c, 0xf2, 0x6b, 0x9a, 0xd3, 0x5f, + 0x36, 0x34, 0x65, 0xbf, 0x96, 0xef, 0xef, 0x46, 0x8f, 0xfe, 0xb9, 0x1b, 0x3d, 0xfa, 0x7d, 0x35, + 0xea, 0xbc, 0x5f, 0x8d, 0x3a, 0x7f, 0xaf, 0x46, 0x9d, 0xff, 0x56, 0xa3, 0xce, 0x62, 0x83, 0xfe, + 0x80, 0xbe, 0xf9, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xb4, 0x54, 0x89, 0xe1, 0xe8, 0x06, 0x00, 0x00, } func (m *Metrics) Marshal() (dAtA []byte, err error) { @@ -666,60 +626,33 @@ func (m *MemoryStat) MarshalTo(dAtA []byte) (int, error) { i++ i = encodeVarintMetrics(dAtA, i, uint64(m.ThpCollapseAlloc)) } - if m.Usage != nil { - dAtA[i] = 0x82 + if m.Usage != 0 { + dAtA[i] = 0x80 i++ dAtA[i] = 0x2 i++ - i = encodeVarintMetrics(dAtA, i, uint64(m.Usage.Size())) - n4, err := m.Usage.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n4 + i = encodeVarintMetrics(dAtA, i, uint64(m.Usage)) } - if m.SwapUsage != nil { - dAtA[i] = 0x8a + if m.UsageLimit != 0 { + dAtA[i] = 0x88 i++ dAtA[i] = 0x2 i++ - i = encodeVarintMetrics(dAtA, i, uint64(m.SwapUsage.Size())) - n5, err := m.SwapUsage.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n5 + i = encodeVarintMetrics(dAtA, i, uint64(m.UsageLimit)) } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *MemoryEntry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MemoryEntry) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Limit != 0 { - dAtA[i] = 0x8 + if m.SwapUsage != 0 { + dAtA[i] = 0x90 i++ - i = encodeVarintMetrics(dAtA, i, uint64(m.Limit)) + dAtA[i] = 0x2 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.SwapUsage)) } - if m.Usage != 0 { - dAtA[i] = 0x10 + if m.SwapLimit != 0 { + dAtA[i] = 0x98 i++ - i = encodeVarintMetrics(dAtA, i, uint64(m.Usage)) + dAtA[i] = 0x2 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.SwapLimit)) } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) @@ -907,31 +840,17 @@ func (m *MemoryStat) Size() (n int) { if m.ThpCollapseAlloc != 0 { n += 2 + sovMetrics(uint64(m.ThpCollapseAlloc)) } - if m.Usage != nil { - l = m.Usage.Size() - n += 2 + l + sovMetrics(uint64(l)) + if m.Usage != 0 { + n += 2 + sovMetrics(uint64(m.Usage)) } - if m.SwapUsage != nil { - l = m.SwapUsage.Size() - n += 2 + l + sovMetrics(uint64(l)) + if m.UsageLimit != 0 { + n += 2 + sovMetrics(uint64(m.UsageLimit)) } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) + if m.SwapUsage != 0 { + n += 2 + sovMetrics(uint64(m.SwapUsage)) } - return n -} - -func (m *MemoryEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Limit != 0 { - n += 1 + sovMetrics(uint64(m.Limit)) - } - if m.Usage != 0 { - n += 1 + sovMetrics(uint64(m.Usage)) + if m.SwapLimit != 0 { + n += 2 + sovMetrics(uint64(m.SwapLimit)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -1029,20 +948,10 @@ func (this *MemoryStat) String() string { `Pglazyfreed:` + fmt.Sprintf("%v", this.Pglazyfreed) + `,`, `ThpFaultAlloc:` + fmt.Sprintf("%v", this.ThpFaultAlloc) + `,`, `ThpCollapseAlloc:` + fmt.Sprintf("%v", this.ThpCollapseAlloc) + `,`, - `Usage:` + strings.Replace(fmt.Sprintf("%v", this.Usage), "MemoryEntry", "MemoryEntry", 1) + `,`, - `SwapUsage:` + strings.Replace(fmt.Sprintf("%v", this.SwapUsage), "MemoryEntry", "MemoryEntry", 1) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func (this *MemoryEntry) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&MemoryEntry{`, - `Limit:` + fmt.Sprintf("%v", this.Limit) + `,`, `Usage:` + fmt.Sprintf("%v", this.Usage) + `,`, + `UsageLimit:` + fmt.Sprintf("%v", this.UsageLimit) + `,`, + `SwapUsage:` + fmt.Sprintf("%v", this.SwapUsage) + `,`, + `SwapLimit:` + fmt.Sprintf("%v", this.SwapLimit) + `,`, `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, `}`, }, "") @@ -2097,10 +2006,10 @@ func (m *MemoryStat) Unmarshal(dAtA []byte) error { } } case 32: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Usage", wireType) } - var msglen int + m.Usage = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowMetrics @@ -2110,33 +2019,16 @@ func (m *MemoryStat) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.Usage |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Usage == nil { - m.Usage = &MemoryEntry{} - } - if err := m.Usage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 33: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SwapUsage", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UsageLimit", wireType) } - var msglen int + m.UsageLimit = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowMetrics @@ -2146,87 +2038,16 @@ func (m *MemoryStat) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.UsageLimit |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMetrics - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.SwapUsage == nil { - m.SwapUsage = &MemoryEntry{} - } - if err := m.SwapUsage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MemoryEntry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MemoryEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MemoryEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 34: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SwapUsage", wireType) } - m.Limit = 0 + m.SwapUsage = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowMetrics @@ -2236,16 +2057,16 @@ func (m *MemoryEntry) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Limit |= uint64(b&0x7F) << shift + m.SwapUsage |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 2: + case 35: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Usage", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SwapLimit", wireType) } - m.Usage = 0 + m.SwapLimit = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowMetrics @@ -2255,7 +2076,7 @@ func (m *MemoryEntry) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Usage |= uint64(b&0x7F) << shift + m.SwapLimit |= uint64(b&0x7F) << shift if b < 0x80 { break } diff --git a/v2/stats/metrics.pb.txt b/v2/stats/metrics.pb.txt index c0dd3f12..3f667aa2 100755 --- a/v2/stats/metrics.pb.txt +++ b/v2/stats/metrics.pb.txt @@ -317,34 +317,29 @@ file { name: "usage" number: 32 label: LABEL_OPTIONAL - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v2.MemoryEntry" + type: TYPE_UINT64 json_name: "usage" } field { - name: "swap_usage" + name: "usage_limit" number: 33 label: LABEL_OPTIONAL - type: TYPE_MESSAGE - type_name: ".io.containerd.cgroups.v2.MemoryEntry" - json_name: "swapUsage" + type: TYPE_UINT64 + json_name: "usageLimit" } - } - message_type { - name: "MemoryEntry" field { - name: "limit" - number: 1 + name: "swap_usage" + number: 34 label: LABEL_OPTIONAL type: TYPE_UINT64 - json_name: "limit" + json_name: "swapUsage" } field { - name: "usage" - number: 2 + name: "swap_limit" + number: 35 label: LABEL_OPTIONAL type: TYPE_UINT64 - json_name: "usage" + json_name: "swapLimit" } } syntax: "proto3" diff --git a/v2/stats/metrics.proto b/v2/stats/metrics.proto index 59d842f3..23754340 100644 --- a/v2/stats/metrics.proto +++ b/v2/stats/metrics.proto @@ -56,13 +56,10 @@ message MemoryStat { uint64 pglazyfreed = 29; uint64 thp_fault_alloc = 30; uint64 thp_collapse_alloc = 31; - MemoryEntry usage = 32; - MemoryEntry swap_usage = 33; -} - -message MemoryEntry { - uint64 limit = 1; - uint64 usage = 2; + uint64 usage = 32; + uint64 usage_limit = 33; + uint64 swap_usage = 34; + uint64 swap_limit = 35; } // iostat From cfc1c23314b641473dd9599a31e604b75adeec8c Mon Sep 17 00:00:00 2001 From: bpopovschi Date: Fri, 15 Nov 2019 09:58:56 +0200 Subject: [PATCH 4/4] Function rename Signed-off-by: bpopovschi --- v2/manager.go | 8 ++++---- v2/utils.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/v2/manager.go b/v2/manager.go index d511e3b9..b12e2ddd 100644 --- a/v2/manager.go +++ b/v2/manager.go @@ -325,10 +325,10 @@ func (c *Manager) Stat() (*stats.Metrics, error) { Pglazyfreed: out["pglazyfreed"].(uint64), ThpFaultAlloc: out["thp_fault_alloc"].(uint64), ThpCollapseAlloc: out["thp_collapse_alloc"].(uint64), - Usage: getStatFileContent(filepath.Join(c.path, "memory.current")), - UsageLimit: getStatFileContent(filepath.Join(c.path, "memory.max")), - SwapUsage: getStatFileContent(filepath.Join(c.path, "memory.swap.current")), - SwapLimit: getStatFileContent(filepath.Join(c.path, "memory.swap.max")), + Usage: getStatFileContentUint64(filepath.Join(c.path, "memory.current")), + UsageLimit: getStatFileContentUint64(filepath.Join(c.path, "memory.max")), + SwapUsage: getStatFileContentUint64(filepath.Join(c.path, "memory.swap.current")), + SwapLimit: getStatFileContentUint64(filepath.Join(c.path, "memory.swap.max")), } return &metrics, nil diff --git a/v2/utils.go b/v2/utils.go index 7f5295f9..dc2a6bbc 100644 --- a/v2/utils.go +++ b/v2/utils.go @@ -19,7 +19,6 @@ package v2 import ( "bufio" "fmt" - "github.com/sirupsen/logrus" "io" "io/ioutil" "math" @@ -30,6 +29,7 @@ import ( "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" + "github.com/sirupsen/logrus" ) const ( @@ -220,7 +220,7 @@ func ToResources(spec *specs.LinuxResources) *Resources { } // Gets uint64 parsed content of single value cgroup stat file -func getStatFileContent(filePath string) uint64 { +func getStatFileContentUint64(filePath string) uint64 { contents, err := ioutil.ReadFile(filePath) if err != nil { logrus.Error(err)