From 697dcdd4077e0bdd13af1fbb0d75eb8080a98e1e Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 5 Sep 2017 11:50:56 -0400 Subject: [PATCH 1/8] Refactor task service metrics Signed-off-by: Michael Crosby --- api/next.pb.txt | 74 ++++ api/services/tasks/v1/tasks.pb.go | 202 +++++---- api/services/tasks/v1/tasks.proto | 3 + api/types/descriptor.pb.go | 4 + api/types/metrics.pb.go | 676 ++++++++++++++++++++++++++++++ api/types/metrics.proto | 22 + linux/runcopts/next.pb.txt | 20 +- linux/runtime.go | 5 +- linux/task.go | 15 +- metrics/cgroups/cgroups.go | 11 +- runtime/task.go | 2 + services/tasks/service.go | 30 ++ 12 files changed, 965 insertions(+), 99 deletions(-) create mode 100644 api/types/metrics.pb.go create mode 100644 api/types/metrics.proto diff --git a/api/next.pb.txt b/api/next.pb.txt index 9cfb64d64..760354b20 100755 --- a/api/next.pb.txt +++ b/api/next.pb.txt @@ -2884,10 +2884,66 @@ file { } syntax: "proto3" } +file { + name: "github.com/containerd/containerd/api/types/metrics.proto" + package: "containerd.types" + dependency: "gogoproto/gogo.proto" + dependency: "google/protobuf/any.proto" + dependency: "google/protobuf/timestamp.proto" + message_type { + name: "MetricsRequest" + field { + name: "filters" + number: 1 + label: LABEL_REPEATED + type: TYPE_STRING + json_name: "filters" + } + } + message_type { + name: "MetricsResponse" + field { + name: "metrics" + number: 1 + label: LABEL_REPEATED + type: TYPE_MESSAGE + type_name: ".containerd.types.Metric" + json_name: "metrics" + } + } + message_type { + name: "Metric" + field { + name: "timestamp" + number: 1 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Timestamp" + options { + 65010: 1 + 65001: 0 + } + json_name: "timestamp" + } + field { + name: "data" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Any" + json_name: "data" + } + } + options { + go_package: "github.com/containerd/containerd/api/types;types" + } + syntax: "proto3" +} file { name: "github.com/containerd/containerd/api/types/task/task.proto" package: "containerd.v1.types" dependency: "gogoproto/gogo.proto" + dependency: "google/protobuf/timestamp.proto" message_type { name: "Process" field { @@ -2954,6 +3010,18 @@ file { type: TYPE_UINT32 json_name: "exitStatus" } + field { + name: "exited_at" + number: 10 + label: LABEL_OPTIONAL + type: TYPE_MESSAGE + type_name: ".google.protobuf.Timestamp" + options { + 65010: 1 + 65001: 0 + } + json_name: "exitedAt" + } } enum_type { name: "Status" @@ -3013,6 +3081,7 @@ file { dependency: "google/protobuf/any.proto" dependency: "gogoproto/gogo.proto" dependency: "github.com/containerd/containerd/api/types/mount.proto" + dependency: "github.com/containerd/containerd/api/types/metrics.proto" dependency: "github.com/containerd/containerd/api/types/descriptor.proto" dependency: "github.com/containerd/containerd/api/types/task/task.proto" dependency: "google/protobuf/timestamp.proto" @@ -3551,6 +3620,11 @@ file { input_type: ".containerd.services.tasks.v1.UpdateTaskRequest" output_type: ".google.protobuf.Empty" } + method { + name: "Metrics" + input_type: ".containerd.types.MetricsRequest" + output_type: ".containerd.types.MetricsResponse" + } } options { go_package: "github.com/containerd/containerd/api/services/tasks/v1;tasks" diff --git a/api/services/tasks/v1/tasks.pb.go b/api/services/tasks/v1/tasks.pb.go index 1b38aaa25..dfa43addc 100644 --- a/api/services/tasks/v1/tasks.pb.go +++ b/api/services/tasks/v1/tasks.pb.go @@ -43,6 +43,7 @@ import google_protobuf1 "github.com/gogo/protobuf/types" import _ "github.com/gogo/protobuf/gogoproto" import containerd_types "github.com/containerd/containerd/api/types" import containerd_types1 "github.com/containerd/containerd/api/types" +import containerd_types2 "github.com/containerd/containerd/api/types" import containerd_v1_types "github.com/containerd/containerd/api/types/task" import _ "github.com/gogo/protobuf/types" @@ -86,7 +87,7 @@ type CreateTaskRequest struct { Stdout string `protobuf:"bytes,5,opt,name=stdout,proto3" json:"stdout,omitempty"` Stderr string `protobuf:"bytes,6,opt,name=stderr,proto3" json:"stderr,omitempty"` Terminal bool `protobuf:"varint,7,opt,name=terminal,proto3" json:"terminal,omitempty"` - Checkpoint *containerd_types1.Descriptor `protobuf:"bytes,8,opt,name=checkpoint" json:"checkpoint,omitempty"` + Checkpoint *containerd_types2.Descriptor `protobuf:"bytes,8,opt,name=checkpoint" json:"checkpoint,omitempty"` Options *google_protobuf1.Any `protobuf:"bytes,9,opt,name=options" json:"options,omitempty"` } @@ -281,7 +282,7 @@ func (*CheckpointTaskRequest) ProtoMessage() {} func (*CheckpointTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{20} } type CheckpointTaskResponse struct { - Descriptors []*containerd_types1.Descriptor `protobuf:"bytes,1,rep,name=descriptors" json:"descriptors,omitempty"` + Descriptors []*containerd_types2.Descriptor `protobuf:"bytes,1,rep,name=descriptors" json:"descriptors,omitempty"` } func (m *CheckpointTaskResponse) Reset() { *m = CheckpointTaskResponse{} } @@ -353,6 +354,7 @@ type TasksClient interface { ListPids(ctx context.Context, in *ListPidsRequest, opts ...grpc.CallOption) (*ListPidsResponse, error) Checkpoint(ctx context.Context, in *CheckpointTaskRequest, opts ...grpc.CallOption) (*CheckpointTaskResponse, error) Update(ctx context.Context, in *UpdateTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) + Metrics(ctx context.Context, in *containerd_types1.MetricsRequest, opts ...grpc.CallOption) (*containerd_types1.MetricsResponse, error) } type tasksClient struct { @@ -498,6 +500,15 @@ func (c *tasksClient) Update(ctx context.Context, in *UpdateTaskRequest, opts .. return out, nil } +func (c *tasksClient) Metrics(ctx context.Context, in *containerd_types1.MetricsRequest, opts ...grpc.CallOption) (*containerd_types1.MetricsResponse, error) { + out := new(containerd_types1.MetricsResponse) + err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Metrics", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // Server API for Tasks service type TasksServer interface { @@ -520,6 +531,7 @@ type TasksServer interface { ListPids(context.Context, *ListPidsRequest) (*ListPidsResponse, error) Checkpoint(context.Context, *CheckpointTaskRequest) (*CheckpointTaskResponse, error) Update(context.Context, *UpdateTaskRequest) (*google_protobuf.Empty, error) + Metrics(context.Context, *containerd_types1.MetricsRequest) (*containerd_types1.MetricsResponse, error) } func RegisterTasksServer(s *grpc.Server, srv TasksServer) { @@ -796,6 +808,24 @@ func _Tasks_Update_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Tasks_Metrics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(containerd_types1.MetricsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TasksServer).Metrics(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/containerd.services.tasks.v1.Tasks/Metrics", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TasksServer).Metrics(ctx, req.(*containerd_types1.MetricsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Tasks_serviceDesc = grpc.ServiceDesc{ ServiceName: "containerd.services.tasks.v1.Tasks", HandlerType: (*TasksServer)(nil), @@ -860,6 +890,10 @@ var _Tasks_serviceDesc = grpc.ServiceDesc{ MethodName: "Update", Handler: _Tasks_Update_Handler, }, + { + MethodName: "Metrics", + Handler: _Tasks_Metrics_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "github.com/containerd/containerd/api/services/tasks/v1/tasks.proto", @@ -2058,7 +2092,7 @@ func (this *CreateTaskRequest) String() string { `Stdout:` + fmt.Sprintf("%v", this.Stdout) + `,`, `Stderr:` + fmt.Sprintf("%v", this.Stderr) + `,`, `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, - `Checkpoint:` + strings.Replace(fmt.Sprintf("%v", this.Checkpoint), "Descriptor", "containerd_types1.Descriptor", 1) + `,`, + `Checkpoint:` + strings.Replace(fmt.Sprintf("%v", this.Checkpoint), "Descriptor", "containerd_types2.Descriptor", 1) + `,`, `Options:` + strings.Replace(fmt.Sprintf("%v", this.Options), "Any", "google_protobuf1.Any", 1) + `,`, `}`, }, "") @@ -2291,7 +2325,7 @@ func (this *CheckpointTaskResponse) String() string { return "nil" } s := strings.Join([]string{`&CheckpointTaskResponse{`, - `Descriptors:` + strings.Replace(fmt.Sprintf("%v", this.Descriptors), "Descriptor", "containerd_types1.Descriptor", 1) + `,`, + `Descriptors:` + strings.Replace(fmt.Sprintf("%v", this.Descriptors), "Descriptor", "containerd_types2.Descriptor", 1) + `,`, `}`, }, "") return s @@ -2538,7 +2572,7 @@ func (m *CreateTaskRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Checkpoint == nil { - m.Checkpoint = &containerd_types1.Descriptor{} + m.Checkpoint = &containerd_types2.Descriptor{} } if err := m.Checkpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4822,7 +4856,7 @@ func (m *CheckpointTaskResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Descriptors = append(m.Descriptors, &containerd_types1.Descriptor{}) + m.Descriptors = append(m.Descriptors, &containerd_types2.Descriptor{}) if err := m.Descriptors[len(m.Descriptors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -5070,81 +5104,83 @@ func init() { } var fileDescriptorTasks = []byte{ - // 1207 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xef, 0xfa, 0x63, 0x6d, 0x3f, 0x37, 0x6d, 0x32, 0xa4, 0xc1, 0x2c, 0x95, 0x1d, 0x16, 0x09, - 0x99, 0x42, 0x77, 0xa9, 0x8b, 0x7a, 0xa0, 0x15, 0x52, 0x13, 0x87, 0xc8, 0x02, 0xd4, 0x74, 0x53, - 0x10, 0xca, 0xc5, 0x6c, 0xbc, 0x13, 0x67, 0x14, 0x7b, 0x77, 0xbb, 0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 0x9e, 0xbc, 0x2a, 0x5f, 0xfb, 0xe3, 0x55, 0xf9, 0xda, 0xcf, 0xfd, 0xb2, - 0x76, 0xd2, 0x2f, 0x6b, 0xbf, 0xf7, 0xcb, 0xda, 0x3f, 0xfd, 0xb2, 0xb6, 0xf3, 0xe8, 0xf5, 0xfe, - 0xbb, 0xf2, 0x50, 0x2c, 0x76, 0x75, 0xe1, 0xe7, 0xfe, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x17, - 0xec, 0xf8, 0x44, 0xa4, 0x11, 0x00, 0x00, + // 1238 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5f, 0x6f, 0x1b, 0x45, + 0x10, 0xef, 0xf9, 0xcf, 0xd9, 0x1e, 0x37, 0x6d, 0xb2, 0xa4, 0xc1, 0x1c, 0x95, 0xed, 0x1e, 0x12, + 0x32, 0x85, 0xde, 0x51, 0x17, 0x55, 0x88, 0x56, 0x48, 0x4d, 0x1c, 0x22, 0x0b, 0x4a, 0xd3, 0x6b, + 0x41, 0xa8, 0x2f, 0xe6, 0x72, 0xb7, 0x71, 0x56, 0xb1, 0xef, 0xae, 0xb7, 0xeb, 0x34, 0x81, 0x07, + 0xf8, 0x08, 0x7d, 0xe5, 0x85, 0xcf, 0x93, 0x47, 0x1e, 0x11, 0x42, 0x81, 0x5a, 0xe2, 0x43, 0xf0, + 0x86, 0x6e, 0x77, 0x7d, 0xb9, 0xf8, 0x7f, 0xea, 0x86, 0x97, 0x64, 0xff, 0xcc, 0xcc, 0xce, 0xfe, + 0x66, 0xf6, 0x37, 0xe3, 0x83, 0xf5, 0x36, 0x61, 0x7b, 0xbd, 0x1d, 0xc3, 0xf1, 0xbb, 0xa6, 0xe3, + 0x7b, 0xcc, 0x26, 0x1e, 0x0e, 0xdd, 0xe4, 0xd0, 0x0e, 0x88, 0x49, 0x71, 0x78, 0x40, 0x1c, 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 0x56, 0x34, 0xd4, 0xff, 0x55, 0x00, 0x45, 0xca, 0x6f, 0x20, 0x4b, 0x62, + 0x4e, 0x4c, 0x8d, 0xe7, 0xc4, 0xf4, 0x04, 0x4e, 0xcc, 0x4c, 0xe4, 0xc4, 0xec, 0x10, 0x27, 0xd6, + 0x20, 0x43, 0x03, 0xec, 0x70, 0x16, 0x9d, 0x44, 0x69, 0x5c, 0x22, 0x89, 0x52, 0x6e, 0x62, 0x2a, + 0x5d, 0x83, 0xb7, 0xce, 0x5c, 0x5d, 0x44, 0x56, 0xff, 0x45, 0x81, 0x65, 0x0b, 0x53, 0xf2, 0x03, + 0xde, 0x66, 0x47, 0x17, 0x1e, 0xaa, 0x55, 0xc8, 0xbe, 0x20, 0x2e, 0xdb, 0x93, 0x91, 0x12, 0x93, + 0x08, 0x9d, 0x3d, 0x4c, 0xda, 0x7b, 0xe2, 0xf5, 0x2f, 0x59, 0x72, 0xa6, 0xff, 0x04, 0x57, 0x36, + 0x3a, 0x3e, 0xc5, 0xcd, 0x47, 0xff, 0x87, 0x63, 0x22, 0x9c, 0x69, 0x1e, 0x05, 0x31, 0xd1, 0xbf, + 0x80, 0xe5, 0x6d, 0xbb, 0x47, 0x17, 0xe6, 0xcf, 0x2d, 0x58, 0xb1, 0x30, 0xed, 0x75, 0x17, 0x36, + 0xb4, 0x09, 0x57, 0xa3, 0xc7, 0xb9, 0x4d, 0xdc, 0x45, 0x92, 0x57, 0x7f, 0x5f, 0xf0, 0x81, 0x30, + 0x23, 0x9f, 0x38, 0x82, 0x4c, 0x40, 0x5c, 0xf1, 0xc2, 0x97, 0x2c, 0x3e, 0xd6, 0xff, 0x54, 0xe0, + 0xda, 0x46, 0x5c, 0x67, 0x17, 0xed, 0x3b, 0x5a, 0xb0, 0x12, 0xd8, 0x21, 0xf6, 0x58, 0x2b, 0x51, + 0xeb, 0x45, 0x48, 0xea, 0x11, 0xa7, 0xff, 0x71, 0x52, 0xb9, 0x99, 0xe8, 0xa0, 0xf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, 0x05, 0x00, 0x00, 0xff, 0xff, 0x63, 0x7a, + 0xe4, 0x79, 0x2e, 0x12, 0x00, 0x00, } diff --git a/api/services/tasks/v1/tasks.proto b/api/services/tasks/v1/tasks.proto index d0778ba94..c9bc4b490 100644 --- a/api/services/tasks/v1/tasks.proto +++ b/api/services/tasks/v1/tasks.proto @@ -6,6 +6,7 @@ import "google/protobuf/empty.proto"; import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; import "github.com/containerd/containerd/api/types/mount.proto"; +import "github.com/containerd/containerd/api/types/metrics.proto"; import "github.com/containerd/containerd/api/types/descriptor.proto"; import "github.com/containerd/containerd/api/types/task/task.proto"; import "google/protobuf/timestamp.proto"; @@ -46,6 +47,8 @@ service Tasks { rpc Checkpoint(CheckpointTaskRequest) returns (CheckpointTaskResponse); rpc Update(UpdateTaskRequest) returns (google.protobuf.Empty); + + rpc Metrics(types.MetricsRequest) returns (types.MetricsResponse); } message CreateTaskRequest { diff --git a/api/types/descriptor.pb.go b/api/types/descriptor.pb.go index 2f1575b00..025aef77c 100644 --- a/api/types/descriptor.pb.go +++ b/api/types/descriptor.pb.go @@ -7,10 +7,14 @@ It is generated from these files: github.com/containerd/containerd/api/types/descriptor.proto + github.com/containerd/containerd/api/types/metrics.proto github.com/containerd/containerd/api/types/mount.proto It has these top-level messages: Descriptor + MetricsRequest + MetricsResponse + Metric Mount */ package types diff --git a/api/types/metrics.pb.go b/api/types/metrics.pb.go new file mode 100644 index 000000000..8033bb206 --- /dev/null +++ b/api/types/metrics.pb.go @@ -0,0 +1,676 @@ +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/containerd/api/types/metrics.proto +// DO NOT EDIT! + +package types + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" +import google_protobuf1 "github.com/gogo/protobuf/types" +import _ "github.com/gogo/protobuf/types" + +import time "time" + +import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + +import strings "strings" +import reflect "reflect" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +type MetricsRequest struct { + Filters []string `protobuf:"bytes,1,rep,name=filters" json:"filters,omitempty"` +} + +func (m *MetricsRequest) Reset() { *m = MetricsRequest{} } +func (*MetricsRequest) ProtoMessage() {} +func (*MetricsRequest) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{0} } + +type MetricsResponse struct { + Metrics []*Metric `protobuf:"bytes,1,rep,name=metrics" json:"metrics,omitempty"` +} + +func (m *MetricsResponse) Reset() { *m = MetricsResponse{} } +func (*MetricsResponse) ProtoMessage() {} +func (*MetricsResponse) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{1} } + +type Metric struct { + Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,stdtime" json:"timestamp"` + Data *google_protobuf1.Any `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` +} + +func (m *Metric) Reset() { *m = Metric{} } +func (*Metric) ProtoMessage() {} +func (*Metric) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{2} } + +func init() { + proto.RegisterType((*MetricsRequest)(nil), "containerd.types.MetricsRequest") + proto.RegisterType((*MetricsResponse)(nil), "containerd.types.MetricsResponse") + proto.RegisterType((*Metric)(nil), "containerd.types.Metric") +} +func (m *MetricsRequest) 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 *MetricsRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Filters) > 0 { + for _, s := range m.Filters { + dAtA[i] = 0xa + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + +func (m *MetricsResponse) 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 *MetricsResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Metrics) > 0 { + for _, msg := range m.Metrics { + dAtA[i] = 0xa + i++ + i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *Metric) 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 *Metric) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintMetrics(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp))) + n1, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + if m.Data != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Data.Size())) + n2, err := m.Data.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + return i, nil +} + +func encodeFixed64Metrics(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Metrics(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintMetrics(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *MetricsRequest) Size() (n int) { + var l int + _ = l + if len(m.Filters) > 0 { + for _, s := range m.Filters { + l = len(s) + n += 1 + l + sovMetrics(uint64(l)) + } + } + return n +} + +func (m *MetricsResponse) Size() (n int) { + var l int + _ = l + if len(m.Metrics) > 0 { + for _, e := range m.Metrics { + l = e.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + } + return n +} + +func (m *Metric) Size() (n int) { + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp) + n += 1 + l + sovMetrics(uint64(l)) + if m.Data != nil { + l = m.Data.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + return n +} + +func sovMetrics(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozMetrics(x uint64) (n int) { + return sovMetrics(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *MetricsRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&MetricsRequest{`, + `Filters:` + fmt.Sprintf("%v", this.Filters) + `,`, + `}`, + }, "") + return s +} +func (this *MetricsResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&MetricsResponse{`, + `Metrics:` + strings.Replace(fmt.Sprintf("%v", this.Metrics), "Metric", "Metric", 1) + `,`, + `}`, + }, "") + return s +} +func (this *Metric) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Metric{`, + `Timestamp:` + strings.Replace(strings.Replace(this.Timestamp.String(), "Timestamp", "google_protobuf2.Timestamp", 1), `&`, ``, 1) + `,`, + `Data:` + strings.Replace(fmt.Sprintf("%v", this.Data), "Any", "google_protobuf1.Any", 1) + `,`, + `}`, + }, "") + return s +} +func valueToStringMetrics(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *MetricsRequest) 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: MetricsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MetricsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetrics + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filters = append(m.Filters, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMetrics(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMetrics + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MetricsResponse) 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: MetricsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MetricsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metrics", 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 > l { + return io.ErrUnexpectedEOF + } + m.Metrics = append(m.Metrics, &Metric{}) + if err := m.Metrics[len(m.Metrics)-1].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) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Metric) 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: Metric: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Metric: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", 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 > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", 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 > l { + return io.ErrUnexpectedEOF + } + if m.Data == nil { + m.Data = &google_protobuf1.Any{} + } + if err := m.Data.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) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipMetrics(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetrics + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetrics + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetrics + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthMetrics + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetrics + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipMetrics(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthMetrics = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMetrics = fmt.Errorf("proto: integer overflow") +) + +func init() { + proto.RegisterFile("github.com/containerd/containerd/api/types/metrics.proto", fileDescriptorMetrics) +} + +var fileDescriptorMetrics = []byte{ + // 297 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x48, 0xcf, 0x2c, 0xc9, + 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, + 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xe7, 0xa6, 0x96, + 0x14, 0x65, 0x26, 0x17, 0xeb, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0x09, 0x20, 0xd4, 0xe8, 0x81, + 0xe5, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x92, 0xfa, 0x20, 0x16, 0x44, 0x9d, 0x94, 0x64, + 0x7a, 0x7e, 0x7e, 0x7a, 0x4e, 0xaa, 0x3e, 0x98, 0x97, 0x54, 0x9a, 0xa6, 0x9f, 0x98, 0x57, 0x09, + 0x95, 0x92, 0x47, 0x97, 0x2a, 0xc9, 0xcc, 0x4d, 0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0x80, 0x28, 0x50, + 0xd2, 0xe2, 0xe2, 0xf3, 0x85, 0x58, 0x1a, 0x94, 0x5a, 0x58, 0x9a, 0x5a, 0x5c, 0x22, 0x24, 0xc1, + 0xc5, 0x9e, 0x96, 0x99, 0x53, 0x92, 0x5a, 0x54, 0x2c, 0xc1, 0xa8, 0xc0, 0xac, 0xc1, 0x19, 0x04, + 0xe3, 0x2a, 0xb9, 0x72, 0xf1, 0xc3, 0xd5, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x0a, 0x19, 0x71, + 0xb1, 0x43, 0xdd, 0x0c, 0x56, 0xcc, 0x6d, 0x24, 0xa1, 0x87, 0xee, 0x68, 0x3d, 0x88, 0x9e, 0x20, + 0x98, 0x42, 0xa5, 0x32, 0x2e, 0x36, 0x88, 0x90, 0x90, 0x13, 0x17, 0x27, 0xdc, 0x3d, 0x12, 0x8c, + 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x52, 0x7a, 0x10, 0x17, 0xeb, 0xc1, 0x5c, 0xac, 0x17, 0x02, 0x53, + 0xe1, 0xc4, 0x71, 0xe2, 0x9e, 0x3c, 0xc3, 0x84, 0xfb, 0xf2, 0x8c, 0x41, 0x08, 0x6d, 0x42, 0x1a, + 0x5c, 0x2c, 0x29, 0x89, 0x25, 0x89, 0x12, 0x4c, 0x60, 0xed, 0x22, 0x18, 0xda, 0x1d, 0xf3, 0x2a, + 0x83, 0xc0, 0x2a, 0x9c, 0xbc, 0x4e, 0x3c, 0x94, 0x63, 0xb8, 0xf1, 0x50, 0x8e, 0xa1, 0xe1, 0x91, + 0x1c, 0xe3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x18, 0x65, + 0x40, 0x7c, 0x14, 0x59, 0x83, 0xc9, 0x24, 0x36, 0xb0, 0xf9, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xa5, 0x43, 0x7b, 0x37, 0xdd, 0x01, 0x00, 0x00, +} diff --git a/api/types/metrics.proto b/api/types/metrics.proto new file mode 100644 index 000000000..444bd5038 --- /dev/null +++ b/api/types/metrics.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +package containerd.types; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/containerd/containerd/api/types;types"; + +message MetricsRequest { + repeated string filters = 1; +} + +message MetricsResponse { + repeated Metric metrics = 1; +} + +message Metric { + google.protobuf.Timestamp timestamp = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + google.protobuf.Any data = 2; +} diff --git a/linux/runcopts/next.pb.txt b/linux/runcopts/next.pb.txt index 76fb011d3..142ea3b95 100755 --- a/linux/runcopts/next.pb.txt +++ b/linux/runcopts/next.pb.txt @@ -5,17 +5,31 @@ file { message_type { name: "RuncOptions" field { - name: "criu_path" + name: "runtime" number: 1 label: LABEL_OPTIONAL type: TYPE_STRING + json_name: "runtime" + } + field { + name: "runtime_root" + number: 2 + label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "runtimeRoot" + } + field { + name: "criu_path" + number: 3 + label: LABEL_OPTIONAL + type: TYPE_STRING json_name: "criuPath" } field { name: "systemd_cgroup" - number: 2 + number: 4 label: LABEL_OPTIONAL - type: TYPE_STRING + type: TYPE_BOOL json_name: "systemdCgroup" } } diff --git a/linux/runtime.go b/linux/runtime.go index 3e3d540a3..9b852d970 100644 --- a/linux/runtime.go +++ b/linux/runtime.go @@ -245,7 +245,10 @@ func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts if err != nil { return nil, errdefs.FromGRPC(err) } - t := newTask(id, namespace, int(cr.Pid), s) + t, err := newTask(id, namespace, int(cr.Pid), s) + if err != nil { + return nil, err + } if err := r.tasks.Add(ctx, t); err != nil { return nil, err } diff --git a/linux/task.go b/linux/task.go index ebc1da318..a4b46c9b6 100644 --- a/linux/task.go +++ b/linux/task.go @@ -5,6 +5,7 @@ package linux import ( "context" + "github.com/containerd/cgroups" "github.com/containerd/containerd/api/types/task" "github.com/containerd/containerd/errdefs" client "github.com/containerd/containerd/linux/shim" @@ -18,15 +19,21 @@ type Task struct { pid int shim *client.Client namespace string + cg *cgroups.Cgroup } -func newTask(id, namespace string, pid int, shim *client.Client) *Task { +func newTask(id, namespace string, pid int, shim *client.Client) (*Task, error) { + cg, err := cgroups.Load(cgroups.V1, cgroups.PidPath(pid)) + if err != nil { + return nil, err + } return &Task{ id: id, pid: pid, shim: shim, namespace: namespace, - } + cg: cg, + }, nil } func (t *Task) ID() string { @@ -201,3 +208,7 @@ func (t *Task) Process(ctx context.Context, id string) (runtime.Process, error) t: t, }, nil } + +func (t *Task) Metrics(ctx context.Context) (interface{}, error) { + return nil, nil +} diff --git a/metrics/cgroups/cgroups.go b/metrics/cgroups/cgroups.go index 2803c1303..e2cfb9746 100644 --- a/metrics/cgroups/cgroups.go +++ b/metrics/cgroups/cgroups.go @@ -11,7 +11,6 @@ import ( "github.com/containerd/containerd/plugin" "github.com/containerd/containerd/runtime" metrics "github.com/docker/go-metrics" - "github.com/pkg/errors" "golang.org/x/net/context" ) @@ -50,15 +49,7 @@ type cgroupsMonitor struct { func (m *cgroupsMonitor) Monitor(c runtime.Task) error { info := c.Info() - state, err := c.State(m.context) - if err != nil { - return err - } - cg, err := cgroups.Load(cgroups.V1, cgroups.PidPath(int(state.Pid))) - if err != nil { - return errors.Wrapf(err, "load cgroup for %d", state.Pid) - } - if err := m.collector.Add(info.ID, info.Namespace, cg); err != nil { + if err := m.collector.Add(info.ID, info.Namespace, c); err != nil { return err } return m.oom.Add(info.ID, info.Namespace, cg, m.trigger) diff --git a/runtime/task.go b/runtime/task.go index fdef8d125..4f5032237 100644 --- a/runtime/task.go +++ b/runtime/task.go @@ -49,6 +49,8 @@ type Task interface { Update(context.Context, *types.Any) error // Process returns a process within the task for the provided id Process(context.Context, string) (Process, error) + // Metrics returns runtime specific metrics for a task + Metrics(context.Context) (interface{}, error) } type ExecOpts struct { diff --git a/services/tasks/service.go b/services/tasks/service.go index 0d51cd5b6..9015fda9b 100644 --- a/services/tasks/service.go +++ b/services/tasks/service.go @@ -7,6 +7,7 @@ import ( "io/ioutil" "os" "path/filepath" + "time" "github.com/boltdb/bolt" api "github.com/containerd/containerd/api/services/tasks/v1" @@ -23,6 +24,7 @@ import ( "github.com/containerd/containerd/mount" "github.com/containerd/containerd/plugin" "github.com/containerd/containerd/runtime" + "github.com/containerd/containerd/typeurl" google_protobuf "github.com/golang/protobuf/ptypes/empty" "golang.org/x/net/context" "google.golang.org/grpc" @@ -454,6 +456,34 @@ func (s *Service) Update(ctx context.Context, r *api.UpdateTaskRequest) (*google return empty, nil } +func (s *Service) Metrics(ctx context.Context, r *types.MetricsRequest) (*types.MetricsResponse, error) { + var resp types.MetricsResponse + for _, r := range s.runtimes { + tasks, err := r.Tasks(ctx) + if err != nil { + return nil, err + } + for _, t := range tasks { + collected := time.Now() + metrics, err := t.Metrics(ctx) + if err != nil { + log.G(ctx).WithError(err).Errorf("collecting metrics for %s", t.ID()) + continue + } + data, err := typeurl.MarshalAny(metrics) + if err != nil { + log.G(ctx).WithError(err).Errorf("marshal metrics for %s", t.ID()) + continue + } + resp.Metrics = append(resp.Metrics, &types.Metric{ + Timestamp: collected, + Data: data, + }) + } + } + return &resp, nil +} + func (s *Service) writeContent(ctx context.Context, mediaType, ref string, r io.Reader) (*types.Descriptor, error) { writer, err := s.store.Writer(ctx, ref, 0, "") if err != nil { From 0973a084cf54f3c25a750644884f2de6e3f9b7b0 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 5 Sep 2017 11:51:38 -0400 Subject: [PATCH 2/8] Update cgroups to e364e5d4183340acdf51f943ba033543 Signed-off-by: Michael Crosby --- vendor.conf | 2 +- .../github.com/containerd/cgroups/README.md | 5 + vendor/github.com/containerd/cgroups/blkio.go | 8 +- .../github.com/containerd/cgroups/cgroup.go | 12 +- .../github.com/containerd/cgroups/control.go | 2 +- vendor/github.com/containerd/cgroups/cpu.go | 15 +- .../github.com/containerd/cgroups/cpuacct.go | 17 +- .../github.com/containerd/cgroups/hugetlb.go | 10 +- .../github.com/containerd/cgroups/memory.go | 18 +- .../containerd/cgroups/metrics.pb.go | 787 ++++++++++++++++++ .../containerd/cgroups/metrics.proto | 107 +++ vendor/github.com/containerd/cgroups/pids.go | 2 +- vendor/github.com/containerd/cgroups/stats.go | 109 --- .../containerd/cgroups/subsystem.go | 2 +- .../github.com/containerd/cgroups/systemd.go | 34 +- 15 files changed, 961 insertions(+), 169 deletions(-) create mode 100644 vendor/github.com/containerd/cgroups/metrics.pb.go create mode 100644 vendor/github.com/containerd/cgroups/metrics.proto delete mode 100644 vendor/github.com/containerd/cgroups/stats.go diff --git a/vendor.conf b/vendor.conf index 10b2b5e9d..146990740 100644 --- a/vendor.conf +++ b/vendor.conf @@ -1,7 +1,7 @@ github.com/coreos/go-systemd 48702e0da86bd25e76cfef347e2adeb434a0d0a6 github.com/containerd/go-runc ba22f6a82e52be3be4eb4a00000fe816f4b41c2e github.com/containerd/console 76d18fd1d66972718ab2284449591db0b3cdb4de -github.com/containerd/cgroups e6d1aa8c71c6103624b2c6e6f4be0863b67027f1 +github.com/containerd/cgroups e364e5d4183340acdf51f943ba033543ecb747d3 github.com/docker/go-metrics 8fd5772bf1584597834c6f7961a530f06cbfbb87 github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9 github.com/godbus/dbus c7fdd8b5cd55e87b4e1f4e372cdb1db61dd6c66f diff --git a/vendor/github.com/containerd/cgroups/README.md b/vendor/github.com/containerd/cgroups/README.md index 89007ebbb..69e932a9f 100644 --- a/vendor/github.com/containerd/cgroups/README.md +++ b/vendor/github.com/containerd/cgroups/README.md @@ -92,6 +92,11 @@ processes, err := control.Processes(cgroups.Devices, recursive) stats, err := control.Stat() ``` +By adding `cgroups.IgnoreNotExist` all non-existent files will be ignored, e.g. swap memory stats without swap enabled +```go +stats, err := control.Stat(cgroups.IgnoreNotExist) +``` + ### Move process across cgroups This allows you to take processes from one cgroup and move them to another. diff --git a/vendor/github.com/containerd/cgroups/blkio.go b/vendor/github.com/containerd/cgroups/blkio.go index e1fd73ce0..88f9ce9b2 100644 --- a/vendor/github.com/containerd/cgroups/blkio.go +++ b/vendor/github.com/containerd/cgroups/blkio.go @@ -56,7 +56,7 @@ func (b *blkioController) Update(path string, resources *specs.LinuxResources) e return b.Create(path, resources) } -func (b *blkioController) Stat(path string, stats *Stats) error { +func (b *blkioController) Stat(path string, stats *Metrics) error { stats.Blkio = &BlkioStat{} settings := []blkioStatSettings{ { @@ -119,7 +119,7 @@ func (b *blkioController) Stat(path string, stats *Stats) error { return nil } -func (b *blkioController) readEntry(devices map[deviceKey]string, path, name string, entry *[]BlkioEntry) error { +func (b *blkioController) readEntry(devices map[deviceKey]string, path, name string, entry *[]*BlkioEntry) error { f, err := os.Open(filepath.Join(b.Path(path), fmt.Sprintf("blkio.%s", name))) if err != nil { return err @@ -158,7 +158,7 @@ func (b *blkioController) readEntry(devices map[deviceKey]string, path, name str if err != nil { return err } - *entry = append(*entry, BlkioEntry{ + *entry = append(*entry, &BlkioEntry{ Device: devices[deviceKey{major, minor}], Major: major, Minor: minor, @@ -235,7 +235,7 @@ type blkioSettings struct { type blkioStatSettings struct { name string - entry *[]BlkioEntry + entry *[]*BlkioEntry } func uintf(v interface{}) []byte { diff --git a/vendor/github.com/containerd/cgroups/cgroup.go b/vendor/github.com/containerd/cgroups/cgroup.go index 74a324f9e..5070bd68f 100644 --- a/vendor/github.com/containerd/cgroups/cgroup.go +++ b/vendor/github.com/containerd/cgroups/cgroup.go @@ -154,8 +154,8 @@ func (c *cgroup) Delete() error { return nil } -// Stat returns the current stats for the cgroup -func (c *cgroup) Stat(handlers ...ErrorHandler) (*Stats, error) { +// Stat returns the current metrics for the cgroup +func (c *cgroup) Stat(handlers ...ErrorHandler) (*Metrics, error) { c.mu.Lock() defer c.mu.Unlock() if c.err != nil { @@ -165,9 +165,11 @@ func (c *cgroup) Stat(handlers ...ErrorHandler) (*Stats, error) { handlers = append(handlers, errPassthrough) } var ( - stats = &Stats{} - wg = &sync.WaitGroup{} - errs = make(chan error, len(c.subsystems)) + stats = &Metrics{ + Cpu: &CpuStat{}, + } + wg = &sync.WaitGroup{} + errs = make(chan error, len(c.subsystems)) ) for _, s := range c.subsystems { if ss, ok := s.(stater); ok { diff --git a/vendor/github.com/containerd/cgroups/control.go b/vendor/github.com/containerd/cgroups/control.go index c83b2417f..2de26732c 100644 --- a/vendor/github.com/containerd/cgroups/control.go +++ b/vendor/github.com/containerd/cgroups/control.go @@ -40,7 +40,7 @@ type Cgroup interface { // subsystems are moved one at a time MoveTo(Cgroup) error // Stat returns the stats for all subsystems in the cgroup - Stat(...ErrorHandler) (*Stats, error) + Stat(...ErrorHandler) (*Metrics, error) // Update updates all the subsystems with the provided resource changes Update(resources *specs.LinuxResources) error // Processes returns all the processes in a select subsystem for the cgroup diff --git a/vendor/github.com/containerd/cgroups/cpu.go b/vendor/github.com/containerd/cgroups/cpu.go index 036bb8fd0..54bcef648 100644 --- a/vendor/github.com/containerd/cgroups/cpu.go +++ b/vendor/github.com/containerd/cgroups/cpu.go @@ -84,20 +84,13 @@ func (c *cpuController) Update(path string, resources *specs.LinuxResources) err return c.Create(path, resources) } -func (c *cpuController) Stat(path string, stats *Stats) error { +func (c *cpuController) Stat(path string, stats *Metrics) error { f, err := os.Open(filepath.Join(c.Path(path), "cpu.stat")) if err != nil { return err } defer f.Close() // get or create the cpu field because cpuacct can also set values on this struct - stats.cpuMu.Lock() - cpu := stats.Cpu - if cpu == nil { - cpu = &CpuStat{} - stats.Cpu = cpu - } - stats.cpuMu.Unlock() sc := bufio.NewScanner(f) for sc.Scan() { if err := sc.Err(); err != nil { @@ -109,11 +102,11 @@ func (c *cpuController) Stat(path string, stats *Stats) error { } switch key { case "nr_periods": - cpu.Throttling.Periods = v + stats.Cpu.Throttling.Periods = v case "nr_throttled": - cpu.Throttling.ThrottledPeriods = v + stats.Cpu.Throttling.ThrottledPeriods = v case "throttled_time": - cpu.Throttling.ThrottledTime = v + stats.Cpu.Throttling.ThrottledTime = v } } return nil diff --git a/vendor/github.com/containerd/cgroups/cpuacct.go b/vendor/github.com/containerd/cgroups/cpuacct.go index 329234887..58fbbdf4e 100644 --- a/vendor/github.com/containerd/cgroups/cpuacct.go +++ b/vendor/github.com/containerd/cgroups/cpuacct.go @@ -30,7 +30,7 @@ func (c *cpuacctController) Path(path string) string { return filepath.Join(c.root, path) } -func (c *cpuacctController) Stat(path string, stats *Stats) error { +func (c *cpuacctController) Stat(path string, stats *Metrics) error { user, kernel, err := c.getUsage(path) if err != nil { return err @@ -43,17 +43,10 @@ func (c *cpuacctController) Stat(path string, stats *Stats) error { if err != nil { return err } - stats.cpuMu.Lock() - cpu := stats.Cpu - if cpu == nil { - cpu = &CpuStat{} - stats.Cpu = cpu - } - stats.cpuMu.Unlock() - cpu.Usage.Total = total - cpu.Usage.User = user - cpu.Usage.Kernel = kernel - cpu.Usage.PerCpu = percpu + stats.Cpu.Usage.Total = total + stats.Cpu.Usage.User = user + stats.Cpu.Usage.Kernel = kernel + stats.Cpu.Usage.PerCpu = percpu return nil } diff --git a/vendor/github.com/containerd/cgroups/hugetlb.go b/vendor/github.com/containerd/cgroups/hugetlb.go index 650bb069f..20241b0d2 100644 --- a/vendor/github.com/containerd/cgroups/hugetlb.go +++ b/vendor/github.com/containerd/cgroups/hugetlb.go @@ -51,8 +51,8 @@ func (h *hugetlbController) Create(path string, resources *specs.LinuxResources) return nil } -func (h *hugetlbController) Stat(path string, stats *Stats) error { - stats.Hugetlb = make(map[string]HugetlbStat) +func (h *hugetlbController) Stat(path string, stats *Metrics) error { + stats.Hugetlb = make(map[string]*HugetlbStat) for _, size := range h.sizes { s, err := h.readSizeStat(path, size) if err != nil { @@ -63,7 +63,7 @@ func (h *hugetlbController) Stat(path string, stats *Stats) error { return nil } -func (h *hugetlbController) readSizeStat(path, size string) (HugetlbStat, error) { +func (h *hugetlbController) readSizeStat(path, size string) (*HugetlbStat, error) { var s HugetlbStat for _, t := range []struct { name string @@ -84,9 +84,9 @@ func (h *hugetlbController) readSizeStat(path, size string) (HugetlbStat, error) } { v, err := readUint(filepath.Join(h.Path(path), strings.Join([]string{"hugetlb", size, t.name}, "."))) if err != nil { - return s, err + return nil, err } *t.value = v } - return s, nil + return &s, nil } diff --git a/vendor/github.com/containerd/cgroups/memory.go b/vendor/github.com/containerd/cgroups/memory.go index 9e2ddf2e4..148a66701 100644 --- a/vendor/github.com/containerd/cgroups/memory.go +++ b/vendor/github.com/containerd/cgroups/memory.go @@ -81,7 +81,7 @@ func (m *memoryController) Update(path string, resources *specs.LinuxResources) return m.set(path, settings) } -func (m *memoryController) Stat(path string, stats *Stats) error { +func (m *memoryController) Stat(path string, stats *Metrics) error { f, err := os.Open(filepath.Join(m.Path(path), "memory.stat")) if err != nil { return err @@ -97,19 +97,19 @@ func (m *memoryController) Stat(path string, stats *Stats) error { }{ { module: "", - entry: &stats.Memory.Usage, + entry: stats.Memory.Usage, }, { module: "memsw", - entry: &stats.Memory.Swap, + entry: stats.Memory.Swap, }, { module: "kmem", - entry: &stats.Memory.Kernel, + entry: stats.Memory.Kernel, }, { module: "kmem.tcp", - entry: &stats.Memory.KernelTCP, + entry: stats.Memory.KernelTcp, }, } { for _, tt := range []struct { @@ -194,8 +194,8 @@ func (m *memoryController) parseStats(r io.Reader, stat *MemoryStat) error { line++ } stat.Cache = raw["cache"] - stat.RSS = raw["rss"] - stat.RSSHuge = raw["rss_huge"] + stat.Rss = raw["rss"] + stat.RssHuge = raw["rss_huge"] stat.MappedFile = raw["mapped_file"] stat.Dirty = raw["dirty"] stat.Writeback = raw["writeback"] @@ -211,8 +211,8 @@ func (m *memoryController) parseStats(r io.Reader, stat *MemoryStat) error { stat.HierarchicalMemoryLimit = raw["hierarchical_memory_limit"] stat.HierarchicalSwapLimit = raw["hierarchical_memsw_limit"] stat.TotalCache = raw["total_cache"] - stat.TotalRSS = raw["total_rss"] - stat.TotalRSSHuge = raw["total_rss_huge"] + stat.TotalRss = raw["total_rss"] + stat.TotalRssHuge = raw["total_rss_huge"] stat.TotalMappedFile = raw["total_mapped_file"] stat.TotalDirty = raw["total_dirty"] stat.TotalWriteback = raw["total_writeback"] diff --git a/vendor/github.com/containerd/cgroups/metrics.pb.go b/vendor/github.com/containerd/cgroups/metrics.pb.go new file mode 100644 index 000000000..2ec1ed5d6 --- /dev/null +++ b/vendor/github.com/containerd/cgroups/metrics.pb.go @@ -0,0 +1,787 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: metrics.proto + +/* +Package cgroups is a generated protocol buffer package. + +It is generated from these files: + metrics.proto + +It has these top-level messages: + Metrics + HugetlbStat + PidsStat + CpuStat + CpuUsage + Throttle + MemoryStat + MemoryEntry + BlkioStat + BlkioEntry +*/ +package cgroups + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type Metrics struct { + Hugetlb map[string]*HugetlbStat `protobuf:"bytes,1,rep,name=hugetlb" json:"hugetlb,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Pids *PidsStat `protobuf:"bytes,2,opt,name=pids" json:"pids,omitempty"` + Cpu *CpuStat `protobuf:"bytes,3,opt,name=cpu" json:"cpu,omitempty"` + Memory *MemoryStat `protobuf:"bytes,4,opt,name=memory" json:"memory,omitempty"` + Blkio *BlkioStat `protobuf:"bytes,5,opt,name=blkio" json:"blkio,omitempty"` +} + +func (m *Metrics) Reset() { *m = Metrics{} } +func (m *Metrics) String() string { return proto.CompactTextString(m) } +func (*Metrics) ProtoMessage() {} +func (*Metrics) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *Metrics) GetHugetlb() map[string]*HugetlbStat { + if m != nil { + return m.Hugetlb + } + return nil +} + +func (m *Metrics) GetPids() *PidsStat { + if m != nil { + return m.Pids + } + return nil +} + +func (m *Metrics) GetCpu() *CpuStat { + if m != nil { + return m.Cpu + } + return nil +} + +func (m *Metrics) GetMemory() *MemoryStat { + if m != nil { + return m.Memory + } + return nil +} + +func (m *Metrics) GetBlkio() *BlkioStat { + if m != nil { + return m.Blkio + } + return nil +} + +type HugetlbStat struct { + Usage uint64 `protobuf:"varint,1,opt,name=usage" json:"usage,omitempty"` + Max uint64 `protobuf:"varint,2,opt,name=max" json:"max,omitempty"` + Failcnt uint64 `protobuf:"varint,3,opt,name=failcnt" json:"failcnt,omitempty"` +} + +func (m *HugetlbStat) Reset() { *m = HugetlbStat{} } +func (m *HugetlbStat) String() string { return proto.CompactTextString(m) } +func (*HugetlbStat) ProtoMessage() {} +func (*HugetlbStat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *HugetlbStat) GetUsage() uint64 { + if m != nil { + return m.Usage + } + return 0 +} + +func (m *HugetlbStat) GetMax() uint64 { + if m != nil { + return m.Max + } + return 0 +} + +func (m *HugetlbStat) GetFailcnt() uint64 { + if m != nil { + return m.Failcnt + } + return 0 +} + +type PidsStat struct { + Current uint64 `protobuf:"varint,1,opt,name=current" json:"current,omitempty"` + Limit uint64 `protobuf:"varint,2,opt,name=limit" json:"limit,omitempty"` +} + +func (m *PidsStat) Reset() { *m = PidsStat{} } +func (m *PidsStat) String() string { return proto.CompactTextString(m) } +func (*PidsStat) ProtoMessage() {} +func (*PidsStat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *PidsStat) GetCurrent() uint64 { + if m != nil { + return m.Current + } + return 0 +} + +func (m *PidsStat) GetLimit() uint64 { + if m != nil { + return m.Limit + } + return 0 +} + +type CpuStat struct { + Usage *CpuUsage `protobuf:"bytes,1,opt,name=usage" json:"usage,omitempty"` + Throttling *Throttle `protobuf:"bytes,2,opt,name=throttling" json:"throttling,omitempty"` +} + +func (m *CpuStat) Reset() { *m = CpuStat{} } +func (m *CpuStat) String() string { return proto.CompactTextString(m) } +func (*CpuStat) ProtoMessage() {} +func (*CpuStat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *CpuStat) GetUsage() *CpuUsage { + if m != nil { + return m.Usage + } + return nil +} + +func (m *CpuStat) GetThrottling() *Throttle { + if m != nil { + return m.Throttling + } + return nil +} + +type CpuUsage struct { + // values in nanoseconds + Total uint64 `protobuf:"varint,1,opt,name=total" json:"total,omitempty"` + Kernel uint64 `protobuf:"varint,2,opt,name=kernel" json:"kernel,omitempty"` + User uint64 `protobuf:"varint,3,opt,name=user" json:"user,omitempty"` + PerCpu []uint64 `protobuf:"varint,4,rep,packed,name=per_cpu,json=perCpu" json:"per_cpu,omitempty"` +} + +func (m *CpuUsage) Reset() { *m = CpuUsage{} } +func (m *CpuUsage) String() string { return proto.CompactTextString(m) } +func (*CpuUsage) ProtoMessage() {} +func (*CpuUsage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *CpuUsage) GetTotal() uint64 { + if m != nil { + return m.Total + } + return 0 +} + +func (m *CpuUsage) GetKernel() uint64 { + if m != nil { + return m.Kernel + } + return 0 +} + +func (m *CpuUsage) GetUser() uint64 { + if m != nil { + return m.User + } + return 0 +} + +func (m *CpuUsage) GetPerCpu() []uint64 { + if m != nil { + return m.PerCpu + } + return nil +} + +type Throttle struct { + Periods uint64 `protobuf:"varint,1,opt,name=periods" json:"periods,omitempty"` + ThrottledPeriods uint64 `protobuf:"varint,2,opt,name=throttled_periods,json=throttledPeriods" json:"throttled_periods,omitempty"` + ThrottledTime uint64 `protobuf:"varint,3,opt,name=throttled_time,json=throttledTime" json:"throttled_time,omitempty"` +} + +func (m *Throttle) Reset() { *m = Throttle{} } +func (m *Throttle) String() string { return proto.CompactTextString(m) } +func (*Throttle) ProtoMessage() {} +func (*Throttle) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *Throttle) GetPeriods() uint64 { + if m != nil { + return m.Periods + } + return 0 +} + +func (m *Throttle) GetThrottledPeriods() uint64 { + if m != nil { + return m.ThrottledPeriods + } + return 0 +} + +func (m *Throttle) GetThrottledTime() uint64 { + if m != nil { + return m.ThrottledTime + } + return 0 +} + +type MemoryStat struct { + Cache uint64 `protobuf:"varint,1,opt,name=cache" json:"cache,omitempty"` + Rss uint64 `protobuf:"varint,2,opt,name=rss" json:"rss,omitempty"` + RssHuge uint64 `protobuf:"varint,3,opt,name=rss_huge,json=rssHuge" json:"rss_huge,omitempty"` + MappedFile uint64 `protobuf:"varint,4,opt,name=mapped_file,json=mappedFile" json:"mapped_file,omitempty"` + Dirty uint64 `protobuf:"varint,5,opt,name=dirty" json:"dirty,omitempty"` + Writeback uint64 `protobuf:"varint,6,opt,name=writeback" json:"writeback,omitempty"` + PgPgIn uint64 `protobuf:"varint,7,opt,name=pg_pg_in,json=pgPgIn" json:"pg_pg_in,omitempty"` + PgPgOut uint64 `protobuf:"varint,8,opt,name=pg_pg_out,json=pgPgOut" json:"pg_pg_out,omitempty"` + PgFault uint64 `protobuf:"varint,9,opt,name=pg_fault,json=pgFault" json:"pg_fault,omitempty"` + PgMajFault uint64 `protobuf:"varint,10,opt,name=pg_maj_fault,json=pgMajFault" json:"pg_maj_fault,omitempty"` + InactiveAnon uint64 `protobuf:"varint,11,opt,name=inactive_anon,json=inactiveAnon" json:"inactive_anon,omitempty"` + ActiveAnon uint64 `protobuf:"varint,12,opt,name=active_anon,json=activeAnon" json:"active_anon,omitempty"` + InactiveFile uint64 `protobuf:"varint,13,opt,name=inactive_file,json=inactiveFile" json:"inactive_file,omitempty"` + ActiveFile uint64 `protobuf:"varint,14,opt,name=active_file,json=activeFile" json:"active_file,omitempty"` + Unevictable uint64 `protobuf:"varint,15,opt,name=unevictable" json:"unevictable,omitempty"` + HierarchicalMemoryLimit uint64 `protobuf:"varint,16,opt,name=hierarchical_memory_limit,json=hierarchicalMemoryLimit" json:"hierarchical_memory_limit,omitempty"` + HierarchicalSwapLimit uint64 `protobuf:"varint,17,opt,name=hierarchical_swap_limit,json=hierarchicalSwapLimit" json:"hierarchical_swap_limit,omitempty"` + TotalCache uint64 `protobuf:"varint,18,opt,name=total_cache,json=totalCache" json:"total_cache,omitempty"` + TotalRss uint64 `protobuf:"varint,19,opt,name=total_rss,json=totalRss" json:"total_rss,omitempty"` + TotalRssHuge uint64 `protobuf:"varint,20,opt,name=total_rss_huge,json=totalRssHuge" json:"total_rss_huge,omitempty"` + TotalMappedFile uint64 `protobuf:"varint,21,opt,name=total_mapped_file,json=totalMappedFile" json:"total_mapped_file,omitempty"` + TotalDirty uint64 `protobuf:"varint,22,opt,name=total_dirty,json=totalDirty" json:"total_dirty,omitempty"` + TotalWriteback uint64 `protobuf:"varint,23,opt,name=total_writeback,json=totalWriteback" json:"total_writeback,omitempty"` + TotalPgPgIn uint64 `protobuf:"varint,24,opt,name=total_pg_pg_in,json=totalPgPgIn" json:"total_pg_pg_in,omitempty"` + TotalPgPgOut uint64 `protobuf:"varint,25,opt,name=total_pg_pg_out,json=totalPgPgOut" json:"total_pg_pg_out,omitempty"` + TotalPgFault uint64 `protobuf:"varint,26,opt,name=total_pg_fault,json=totalPgFault" json:"total_pg_fault,omitempty"` + TotalPgMajFault uint64 `protobuf:"varint,27,opt,name=total_pg_maj_fault,json=totalPgMajFault" json:"total_pg_maj_fault,omitempty"` + TotalInactiveAnon uint64 `protobuf:"varint,28,opt,name=total_inactive_anon,json=totalInactiveAnon" json:"total_inactive_anon,omitempty"` + TotalActiveAnon uint64 `protobuf:"varint,29,opt,name=total_active_anon,json=totalActiveAnon" json:"total_active_anon,omitempty"` + TotalInactiveFile uint64 `protobuf:"varint,30,opt,name=total_inactive_file,json=totalInactiveFile" json:"total_inactive_file,omitempty"` + TotalActiveFile uint64 `protobuf:"varint,31,opt,name=total_active_file,json=totalActiveFile" json:"total_active_file,omitempty"` + TotalUnevictable uint64 `protobuf:"varint,32,opt,name=total_unevictable,json=totalUnevictable" json:"total_unevictable,omitempty"` + Usage *MemoryEntry `protobuf:"bytes,33,opt,name=usage" json:"usage,omitempty"` + Swap *MemoryEntry `protobuf:"bytes,34,opt,name=swap" json:"swap,omitempty"` + Kernel *MemoryEntry `protobuf:"bytes,35,opt,name=kernel" json:"kernel,omitempty"` + KernelTcp *MemoryEntry `protobuf:"bytes,36,opt,name=kernel_tcp,json=kernelTcp" json:"kernel_tcp,omitempty"` +} + +func (m *MemoryStat) Reset() { *m = MemoryStat{} } +func (m *MemoryStat) String() string { return proto.CompactTextString(m) } +func (*MemoryStat) ProtoMessage() {} +func (*MemoryStat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +func (m *MemoryStat) GetCache() uint64 { + if m != nil { + return m.Cache + } + return 0 +} + +func (m *MemoryStat) GetRss() uint64 { + if m != nil { + return m.Rss + } + return 0 +} + +func (m *MemoryStat) GetRssHuge() uint64 { + if m != nil { + return m.RssHuge + } + return 0 +} + +func (m *MemoryStat) GetMappedFile() uint64 { + if m != nil { + return m.MappedFile + } + return 0 +} + +func (m *MemoryStat) GetDirty() uint64 { + if m != nil { + return m.Dirty + } + return 0 +} + +func (m *MemoryStat) GetWriteback() uint64 { + if m != nil { + return m.Writeback + } + return 0 +} + +func (m *MemoryStat) GetPgPgIn() uint64 { + if m != nil { + return m.PgPgIn + } + return 0 +} + +func (m *MemoryStat) GetPgPgOut() uint64 { + if m != nil { + return m.PgPgOut + } + return 0 +} + +func (m *MemoryStat) GetPgFault() uint64 { + if m != nil { + return m.PgFault + } + return 0 +} + +func (m *MemoryStat) GetPgMajFault() uint64 { + if m != nil { + return m.PgMajFault + } + return 0 +} + +func (m *MemoryStat) GetInactiveAnon() uint64 { + if m != nil { + return m.InactiveAnon + } + return 0 +} + +func (m *MemoryStat) GetActiveAnon() uint64 { + if m != nil { + return m.ActiveAnon + } + return 0 +} + +func (m *MemoryStat) GetInactiveFile() uint64 { + if m != nil { + return m.InactiveFile + } + return 0 +} + +func (m *MemoryStat) GetActiveFile() uint64 { + if m != nil { + return m.ActiveFile + } + return 0 +} + +func (m *MemoryStat) GetUnevictable() uint64 { + if m != nil { + return m.Unevictable + } + return 0 +} + +func (m *MemoryStat) GetHierarchicalMemoryLimit() uint64 { + if m != nil { + return m.HierarchicalMemoryLimit + } + return 0 +} + +func (m *MemoryStat) GetHierarchicalSwapLimit() uint64 { + if m != nil { + return m.HierarchicalSwapLimit + } + return 0 +} + +func (m *MemoryStat) GetTotalCache() uint64 { + if m != nil { + return m.TotalCache + } + return 0 +} + +func (m *MemoryStat) GetTotalRss() uint64 { + if m != nil { + return m.TotalRss + } + return 0 +} + +func (m *MemoryStat) GetTotalRssHuge() uint64 { + if m != nil { + return m.TotalRssHuge + } + return 0 +} + +func (m *MemoryStat) GetTotalMappedFile() uint64 { + if m != nil { + return m.TotalMappedFile + } + return 0 +} + +func (m *MemoryStat) GetTotalDirty() uint64 { + if m != nil { + return m.TotalDirty + } + return 0 +} + +func (m *MemoryStat) GetTotalWriteback() uint64 { + if m != nil { + return m.TotalWriteback + } + return 0 +} + +func (m *MemoryStat) GetTotalPgPgIn() uint64 { + if m != nil { + return m.TotalPgPgIn + } + return 0 +} + +func (m *MemoryStat) GetTotalPgPgOut() uint64 { + if m != nil { + return m.TotalPgPgOut + } + return 0 +} + +func (m *MemoryStat) GetTotalPgFault() uint64 { + if m != nil { + return m.TotalPgFault + } + return 0 +} + +func (m *MemoryStat) GetTotalPgMajFault() uint64 { + if m != nil { + return m.TotalPgMajFault + } + return 0 +} + +func (m *MemoryStat) GetTotalInactiveAnon() uint64 { + if m != nil { + return m.TotalInactiveAnon + } + return 0 +} + +func (m *MemoryStat) GetTotalActiveAnon() uint64 { + if m != nil { + return m.TotalActiveAnon + } + return 0 +} + +func (m *MemoryStat) GetTotalInactiveFile() uint64 { + if m != nil { + return m.TotalInactiveFile + } + return 0 +} + +func (m *MemoryStat) GetTotalActiveFile() uint64 { + if m != nil { + return m.TotalActiveFile + } + return 0 +} + +func (m *MemoryStat) GetTotalUnevictable() uint64 { + if m != nil { + return m.TotalUnevictable + } + return 0 +} + +func (m *MemoryStat) GetUsage() *MemoryEntry { + if m != nil { + return m.Usage + } + return nil +} + +func (m *MemoryStat) GetSwap() *MemoryEntry { + if m != nil { + return m.Swap + } + return nil +} + +func (m *MemoryStat) GetKernel() *MemoryEntry { + if m != nil { + return m.Kernel + } + return nil +} + +func (m *MemoryStat) GetKernelTcp() *MemoryEntry { + if m != nil { + return m.KernelTcp + } + return nil +} + +type MemoryEntry struct { + Limit uint64 `protobuf:"varint,1,opt,name=limit" json:"limit,omitempty"` + Usage uint64 `protobuf:"varint,2,opt,name=usage" json:"usage,omitempty"` + Max uint64 `protobuf:"varint,3,opt,name=max" json:"max,omitempty"` + Failcnt uint64 `protobuf:"varint,4,opt,name=failcnt" json:"failcnt,omitempty"` +} + +func (m *MemoryEntry) Reset() { *m = MemoryEntry{} } +func (m *MemoryEntry) String() string { return proto.CompactTextString(m) } +func (*MemoryEntry) ProtoMessage() {} +func (*MemoryEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } + +func (m *MemoryEntry) GetLimit() uint64 { + if m != nil { + return m.Limit + } + return 0 +} + +func (m *MemoryEntry) GetUsage() uint64 { + if m != nil { + return m.Usage + } + return 0 +} + +func (m *MemoryEntry) GetMax() uint64 { + if m != nil { + return m.Max + } + return 0 +} + +func (m *MemoryEntry) GetFailcnt() uint64 { + if m != nil { + return m.Failcnt + } + return 0 +} + +type BlkioStat struct { + IoServiceBytesRecursive []*BlkioEntry `protobuf:"bytes,1,rep,name=io_service_bytes_recursive,json=ioServiceBytesRecursive" json:"io_service_bytes_recursive,omitempty"` + IoServicedRecursive []*BlkioEntry `protobuf:"bytes,2,rep,name=io_serviced_recursive,json=ioServicedRecursive" json:"io_serviced_recursive,omitempty"` + IoQueuedRecursive []*BlkioEntry `protobuf:"bytes,3,rep,name=io_queued_recursive,json=ioQueuedRecursive" json:"io_queued_recursive,omitempty"` + IoServiceTimeRecursive []*BlkioEntry `protobuf:"bytes,4,rep,name=io_service_time_recursive,json=ioServiceTimeRecursive" json:"io_service_time_recursive,omitempty"` + IoWaitTimeRecursive []*BlkioEntry `protobuf:"bytes,5,rep,name=io_wait_time_recursive,json=ioWaitTimeRecursive" json:"io_wait_time_recursive,omitempty"` + IoMergedRecursive []*BlkioEntry `protobuf:"bytes,6,rep,name=io_merged_recursive,json=ioMergedRecursive" json:"io_merged_recursive,omitempty"` + IoTimeRecursive []*BlkioEntry `protobuf:"bytes,7,rep,name=io_time_recursive,json=ioTimeRecursive" json:"io_time_recursive,omitempty"` + SectorsRecursive []*BlkioEntry `protobuf:"bytes,8,rep,name=sectors_recursive,json=sectorsRecursive" json:"sectors_recursive,omitempty"` +} + +func (m *BlkioStat) Reset() { *m = BlkioStat{} } +func (m *BlkioStat) String() string { return proto.CompactTextString(m) } +func (*BlkioStat) ProtoMessage() {} +func (*BlkioStat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } + +func (m *BlkioStat) GetIoServiceBytesRecursive() []*BlkioEntry { + if m != nil { + return m.IoServiceBytesRecursive + } + return nil +} + +func (m *BlkioStat) GetIoServicedRecursive() []*BlkioEntry { + if m != nil { + return m.IoServicedRecursive + } + return nil +} + +func (m *BlkioStat) GetIoQueuedRecursive() []*BlkioEntry { + if m != nil { + return m.IoQueuedRecursive + } + return nil +} + +func (m *BlkioStat) GetIoServiceTimeRecursive() []*BlkioEntry { + if m != nil { + return m.IoServiceTimeRecursive + } + return nil +} + +func (m *BlkioStat) GetIoWaitTimeRecursive() []*BlkioEntry { + if m != nil { + return m.IoWaitTimeRecursive + } + return nil +} + +func (m *BlkioStat) GetIoMergedRecursive() []*BlkioEntry { + if m != nil { + return m.IoMergedRecursive + } + return nil +} + +func (m *BlkioStat) GetIoTimeRecursive() []*BlkioEntry { + if m != nil { + return m.IoTimeRecursive + } + return nil +} + +func (m *BlkioStat) GetSectorsRecursive() []*BlkioEntry { + if m != nil { + return m.SectorsRecursive + } + return nil +} + +type BlkioEntry struct { + Op string `protobuf:"bytes,1,opt,name=op" json:"op,omitempty"` + Device string `protobuf:"bytes,2,opt,name=device" json:"device,omitempty"` + Major uint64 `protobuf:"varint,3,opt,name=major" json:"major,omitempty"` + Minor uint64 `protobuf:"varint,4,opt,name=minor" json:"minor,omitempty"` + Value uint64 `protobuf:"varint,5,opt,name=value" json:"value,omitempty"` +} + +func (m *BlkioEntry) Reset() { *m = BlkioEntry{} } +func (m *BlkioEntry) String() string { return proto.CompactTextString(m) } +func (*BlkioEntry) ProtoMessage() {} +func (*BlkioEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } + +func (m *BlkioEntry) GetOp() string { + if m != nil { + return m.Op + } + return "" +} + +func (m *BlkioEntry) GetDevice() string { + if m != nil { + return m.Device + } + return "" +} + +func (m *BlkioEntry) GetMajor() uint64 { + if m != nil { + return m.Major + } + return 0 +} + +func (m *BlkioEntry) GetMinor() uint64 { + if m != nil { + return m.Minor + } + return 0 +} + +func (m *BlkioEntry) GetValue() uint64 { + if m != nil { + return m.Value + } + return 0 +} + +func init() { + proto.RegisterType((*Metrics)(nil), "cgroups.Metrics") + proto.RegisterType((*HugetlbStat)(nil), "cgroups.HugetlbStat") + proto.RegisterType((*PidsStat)(nil), "cgroups.PidsStat") + proto.RegisterType((*CpuStat)(nil), "cgroups.CpuStat") + proto.RegisterType((*CpuUsage)(nil), "cgroups.CpuUsage") + proto.RegisterType((*Throttle)(nil), "cgroups.Throttle") + proto.RegisterType((*MemoryStat)(nil), "cgroups.MemoryStat") + proto.RegisterType((*MemoryEntry)(nil), "cgroups.MemoryEntry") + proto.RegisterType((*BlkioStat)(nil), "cgroups.BlkioStat") + proto.RegisterType((*BlkioEntry)(nil), "cgroups.BlkioEntry") +} + +func init() { proto.RegisterFile("metrics.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 1175 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x96, 0x6f, 0x6f, 0xdb, 0x36, + 0x10, 0xc6, 0x61, 0x5b, 0x89, 0xed, 0x73, 0x92, 0xc6, 0x74, 0x9b, 0x28, 0x69, 0xbb, 0x7a, 0x6e, + 0x8b, 0x06, 0xc9, 0x10, 0x60, 0x2d, 0xb0, 0x0d, 0x79, 0xb3, 0xb5, 0xd9, 0xba, 0x16, 0x58, 0x56, + 0x4f, 0x49, 0xd1, 0x97, 0x82, 0x2c, 0x33, 0x0a, 0x13, 0x59, 0xe4, 0x28, 0xca, 0x69, 0xbe, 0xd8, + 0xbe, 0xc5, 0x80, 0x7d, 0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63, 0x30, 0x59, 0xc6, 0xfb, 0xf9, 0x9b, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0xda, + 0x6f, 0x7a, 0x0a, 0xb0, 0x0b, 0x00, 0x00, +} diff --git a/vendor/github.com/containerd/cgroups/metrics.proto b/vendor/github.com/containerd/cgroups/metrics.proto new file mode 100644 index 000000000..8295d2fa9 --- /dev/null +++ b/vendor/github.com/containerd/cgroups/metrics.proto @@ -0,0 +1,107 @@ +syntax = "proto3"; + +package cgroups; + +message Metrics { + map hugetlb = 1; + PidsStat pids = 2; + CpuStat cpu = 3; + MemoryStat memory = 4; + BlkioStat blkio = 5; +} + +message HugetlbStat { + uint64 usage = 1; + uint64 max = 2; + uint64 failcnt = 3; +} + +message PidsStat { + uint64 current = 1; + uint64 limit = 2; +} + +message CpuStat { + CpuUsage usage = 1; + Throttle throttling = 2; +} + +message CpuUsage { + // values in nanoseconds + uint64 total = 1; + uint64 kernel = 2; + uint64 user = 3; + repeated uint64 per_cpu = 4; +} + +message Throttle { + uint64 periods = 1; + uint64 throttled_periods = 2; + uint64 throttled_time = 3; +} + +message MemoryStat { + uint64 cache = 1; + uint64 rss = 2; + uint64 rss_huge = 3; + uint64 mapped_file = 4; + uint64 dirty = 5; + uint64 writeback = 6; + uint64 pg_pg_in = 7; + uint64 pg_pg_out = 8; + uint64 pg_fault = 9; + uint64 pg_maj_fault = 10; + uint64 inactive_anon = 11; + uint64 active_anon = 12; + uint64 inactive_file = 13; + uint64 active_file = 14; + uint64 unevictable = 15; + uint64 hierarchical_memory_limit = 16; + uint64 hierarchical_swap_limit = 17; + uint64 total_cache = 18; + uint64 total_rss = 19; + uint64 total_rss_huge = 20; + uint64 total_mapped_file = 21; + uint64 total_dirty = 22; + uint64 total_writeback = 23; + uint64 total_pg_pg_in = 24; + uint64 total_pg_pg_out = 25; + uint64 total_pg_fault = 26; + uint64 total_pg_maj_fault = 27; + uint64 total_inactive_anon = 28; + uint64 total_active_anon = 29; + uint64 total_inactive_file = 30; + uint64 total_active_file = 31; + uint64 total_unevictable = 32; + MemoryEntry usage = 33; + MemoryEntry swap = 34; + MemoryEntry kernel = 35; + MemoryEntry kernel_tcp = 36; + +} + +message MemoryEntry { + uint64 limit = 1; + uint64 usage = 2; + uint64 max = 3; + uint64 failcnt = 4; +} + +message BlkioStat { + repeated BlkioEntry io_service_bytes_recursive = 1; + repeated BlkioEntry io_serviced_recursive = 2; + repeated BlkioEntry io_queued_recursive = 3; + repeated BlkioEntry io_service_time_recursive = 4; + repeated BlkioEntry io_wait_time_recursive = 5; + repeated BlkioEntry io_merged_recursive = 6; + repeated BlkioEntry io_time_recursive = 7; + repeated BlkioEntry sectors_recursive = 8; +} + +message BlkioEntry { + string op = 1; + string device = 2; + uint64 major = 3; + uint64 minor = 4; + uint64 value = 5; +} diff --git a/vendor/github.com/containerd/cgroups/pids.go b/vendor/github.com/containerd/cgroups/pids.go index bdcc10a90..dcf4e29e1 100644 --- a/vendor/github.com/containerd/cgroups/pids.go +++ b/vendor/github.com/containerd/cgroups/pids.go @@ -46,7 +46,7 @@ func (p *pidsController) Update(path string, resources *specs.LinuxResources) er return p.Create(path, resources) } -func (p *pidsController) Stat(path string, stats *Stats) error { +func (p *pidsController) Stat(path string, stats *Metrics) error { current, err := readUint(filepath.Join(p.Path(path), "pids.current")) if err != nil { return err diff --git a/vendor/github.com/containerd/cgroups/stats.go b/vendor/github.com/containerd/cgroups/stats.go deleted file mode 100644 index 47fbfa96b..000000000 --- a/vendor/github.com/containerd/cgroups/stats.go +++ /dev/null @@ -1,109 +0,0 @@ -package cgroups - -import "sync" - -type Stats struct { - cpuMu sync.Mutex - - Hugetlb map[string]HugetlbStat - Pids *PidsStat - Cpu *CpuStat - Memory *MemoryStat - Blkio *BlkioStat -} - -type HugetlbStat struct { - Usage uint64 - Max uint64 - Failcnt uint64 -} - -type PidsStat struct { - Current uint64 - Limit uint64 -} - -type CpuStat struct { - Usage CpuUsage - Throttling Throttle -} - -type CpuUsage struct { - // Units: nanoseconds. - Total uint64 - PerCpu []uint64 - Kernel uint64 - User uint64 -} - -type Throttle struct { - Periods uint64 - ThrottledPeriods uint64 - ThrottledTime uint64 -} - -type MemoryStat struct { - Cache uint64 - RSS uint64 - RSSHuge uint64 - MappedFile uint64 - Dirty uint64 - Writeback uint64 - PgPgIn uint64 - PgPgOut uint64 - PgFault uint64 - PgMajFault uint64 - InactiveAnon uint64 - ActiveAnon uint64 - InactiveFile uint64 - ActiveFile uint64 - Unevictable uint64 - HierarchicalMemoryLimit uint64 - HierarchicalSwapLimit uint64 - TotalCache uint64 - TotalRSS uint64 - TotalRSSHuge uint64 - TotalMappedFile uint64 - TotalDirty uint64 - TotalWriteback uint64 - TotalPgPgIn uint64 - TotalPgPgOut uint64 - TotalPgFault uint64 - TotalPgMajFault uint64 - TotalInactiveAnon uint64 - TotalActiveAnon uint64 - TotalInactiveFile uint64 - TotalActiveFile uint64 - TotalUnevictable uint64 - - Usage MemoryEntry - Swap MemoryEntry - Kernel MemoryEntry - KernelTCP MemoryEntry -} - -type MemoryEntry struct { - Limit uint64 - Usage uint64 - Max uint64 - Failcnt uint64 -} - -type BlkioStat struct { - IoServiceBytesRecursive []BlkioEntry - IoServicedRecursive []BlkioEntry - IoQueuedRecursive []BlkioEntry - IoServiceTimeRecursive []BlkioEntry - IoWaitTimeRecursive []BlkioEntry - IoMergedRecursive []BlkioEntry - IoTimeRecursive []BlkioEntry - SectorsRecursive []BlkioEntry -} - -type BlkioEntry struct { - Op string - Device string - Major uint64 - Minor uint64 - Value uint64 -} diff --git a/vendor/github.com/containerd/cgroups/subsystem.go b/vendor/github.com/containerd/cgroups/subsystem.go index aab403b8a..9393eec19 100644 --- a/vendor/github.com/containerd/cgroups/subsystem.go +++ b/vendor/github.com/containerd/cgroups/subsystem.go @@ -67,7 +67,7 @@ type deleter interface { type stater interface { Subsystem - Stat(path string, stats *Stats) error + Stat(path string, stats *Metrics) error } type updater interface { diff --git a/vendor/github.com/containerd/cgroups/systemd.go b/vendor/github.com/containerd/cgroups/systemd.go index 5e052a821..fd816e32e 100644 --- a/vendor/github.com/containerd/cgroups/systemd.go +++ b/vendor/github.com/containerd/cgroups/systemd.go @@ -43,19 +43,13 @@ func Slice(slice, name string) Path { } func NewSystemd(root string) (*SystemdController, error) { - conn, err := systemdDbus.New() - if err != nil { - return nil, err - } return &SystemdController{ root: root, - conn: conn, }, nil } type SystemdController struct { mu sync.Mutex - conn *systemdDbus.Conn root string } @@ -64,6 +58,11 @@ func (s *SystemdController) Name() Name { } func (s *SystemdController) Create(path string, resources *specs.LinuxResources) error { + conn, err := systemdDbus.New() + if err != nil { + return err + } + defer conn.Close() slice, name := splitName(path) properties := []systemdDbus.Property{ systemdDbus.PropDescription(fmt.Sprintf("cgroup %s", name)), @@ -74,14 +73,29 @@ func (s *SystemdController) Create(path string, resources *specs.LinuxResources) newProperty("CPUAccounting", true), newProperty("BlockIOAccounting", true), } - _, err := s.conn.StartTransientUnit(name, "replace", properties, nil) - return err + ch := make(chan string) + _, err = conn.StartTransientUnit(name, "replace", properties, ch) + if err != nil { + return err + } + <-ch + return nil } func (s *SystemdController) Delete(path string) error { + conn, err := systemdDbus.New() + if err != nil { + return err + } + defer conn.Close() _, name := splitName(path) - _, err := s.conn.StopUnit(name, "replace", nil) - return err + ch := make(chan string) + _, err = conn.StopUnit(name, "replace", ch) + if err != nil { + return err + } + <-ch + return nil } func newProperty(name string, units interface{}) systemdDbus.Property { From ed4595282662cbaec604bb12f524d07fae2d2fbe Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 5 Sep 2017 13:05:54 -0400 Subject: [PATCH 3/8] Use cgroups proto for prom metrics Signed-off-by: Michael Crosby --- linux/task.go | 12 +++- metrics/cgroups/blkio.go | 14 ++--- metrics/cgroups/cgroups.go | 6 +- metrics/cgroups/cpu.go | 14 ++--- metrics/cgroups/hugetlb.go | 6 +- metrics/cgroups/memory.go | 112 ++++++++++++++++++------------------- metrics/cgroups/metric.go | 4 +- metrics/cgroups/metrics.go | 2 +- metrics/cgroups/pids.go | 4 +- 9 files changed, 92 insertions(+), 82 deletions(-) diff --git a/linux/task.go b/linux/task.go index a4b46c9b6..f18ec529a 100644 --- a/linux/task.go +++ b/linux/task.go @@ -19,7 +19,7 @@ type Task struct { pid int shim *client.Client namespace string - cg *cgroups.Cgroup + cg cgroups.Cgroup } func newTask(id, namespace string, pid int, shim *client.Client) (*Task, error) { @@ -210,5 +210,13 @@ func (t *Task) Process(ctx context.Context, id string) (runtime.Process, error) } func (t *Task) Metrics(ctx context.Context) (interface{}, error) { - return nil, nil + stats, err := t.cg.Stat(cgroups.IgnoreNotExist) + if err != nil { + return nil, err + } + return stats, nil +} + +func (t *Task) Cgroup() cgroups.Cgroup { + return t.cg } diff --git a/metrics/cgroups/blkio.go b/metrics/cgroups/blkio.go index 481ac3541..f47be6c91 100644 --- a/metrics/cgroups/blkio.go +++ b/metrics/cgroups/blkio.go @@ -15,7 +15,7 @@ var blkioMetrics = []*metric{ unit: metrics.Total, vt: prometheus.GaugeValue, labels: []string{"op", "device", "major", "minor"}, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Blkio == nil { return nil } @@ -28,7 +28,7 @@ var blkioMetrics = []*metric{ unit: metrics.Total, vt: prometheus.GaugeValue, labels: []string{"op", "device", "major", "minor"}, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Blkio == nil { return nil } @@ -41,7 +41,7 @@ var blkioMetrics = []*metric{ unit: metrics.Bytes, vt: prometheus.GaugeValue, labels: []string{"op", "device", "major", "minor"}, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Blkio == nil { return nil } @@ -54,7 +54,7 @@ var blkioMetrics = []*metric{ unit: metrics.Total, vt: prometheus.GaugeValue, labels: []string{"op", "device", "major", "minor"}, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Blkio == nil { return nil } @@ -67,7 +67,7 @@ var blkioMetrics = []*metric{ unit: metrics.Total, vt: prometheus.GaugeValue, labels: []string{"op", "device", "major", "minor"}, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Blkio == nil { return nil } @@ -80,7 +80,7 @@ var blkioMetrics = []*metric{ unit: metrics.Total, vt: prometheus.GaugeValue, labels: []string{"op", "device", "major", "minor"}, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Blkio == nil { return nil } @@ -93,7 +93,7 @@ var blkioMetrics = []*metric{ unit: metrics.Total, vt: prometheus.GaugeValue, labels: []string{"op", "device", "major", "minor"}, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Blkio == nil { return nil } diff --git a/metrics/cgroups/cgroups.go b/metrics/cgroups/cgroups.go index e2cfb9746..cab67ebbf 100644 --- a/metrics/cgroups/cgroups.go +++ b/metrics/cgroups/cgroups.go @@ -6,6 +6,7 @@ import ( "github.com/containerd/cgroups" eventsapi "github.com/containerd/containerd/api/services/events/v1" "github.com/containerd/containerd/events" + "github.com/containerd/containerd/linux" "github.com/containerd/containerd/log" "github.com/containerd/containerd/namespaces" "github.com/containerd/containerd/plugin" @@ -49,10 +50,11 @@ type cgroupsMonitor struct { func (m *cgroupsMonitor) Monitor(c runtime.Task) error { info := c.Info() - if err := m.collector.Add(info.ID, info.Namespace, c); err != nil { + t := c.(*linux.Task) + if err := m.collector.Add(info.ID, info.Namespace, t.Cgroup()); err != nil { return err } - return m.oom.Add(info.ID, info.Namespace, cg, m.trigger) + return m.oom.Add(info.ID, info.Namespace, t.Cgroup(), m.trigger) } func (m *cgroupsMonitor) Stop(c runtime.Task) error { diff --git a/metrics/cgroups/cpu.go b/metrics/cgroups/cpu.go index d6ffee94a..47b593955 100644 --- a/metrics/cgroups/cpu.go +++ b/metrics/cgroups/cpu.go @@ -16,7 +16,7 @@ var cpuMetrics = []*metric{ help: "The total cpu time", unit: metrics.Nanoseconds, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Cpu == nil { return nil } @@ -32,7 +32,7 @@ var cpuMetrics = []*metric{ help: "The total kernel cpu time", unit: metrics.Nanoseconds, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Cpu == nil { return nil } @@ -48,7 +48,7 @@ var cpuMetrics = []*metric{ help: "The total user cpu time", unit: metrics.Nanoseconds, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Cpu == nil { return nil } @@ -65,7 +65,7 @@ var cpuMetrics = []*metric{ unit: metrics.Nanoseconds, vt: prometheus.GaugeValue, labels: []string{"cpu"}, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Cpu == nil { return nil } @@ -84,7 +84,7 @@ var cpuMetrics = []*metric{ help: "The total cpu throttle periods", unit: metrics.Total, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Cpu == nil { return nil } @@ -100,7 +100,7 @@ var cpuMetrics = []*metric{ help: "The total cpu throttled periods", unit: metrics.Total, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Cpu == nil { return nil } @@ -116,7 +116,7 @@ var cpuMetrics = []*metric{ help: "The total cpu throttled time", unit: metrics.Nanoseconds, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Cpu == nil { return nil } diff --git a/metrics/cgroups/hugetlb.go b/metrics/cgroups/hugetlb.go index 01c406d23..75cfb17d7 100644 --- a/metrics/cgroups/hugetlb.go +++ b/metrics/cgroups/hugetlb.go @@ -15,7 +15,7 @@ var hugetlbMetrics = []*metric{ unit: metrics.Bytes, vt: prometheus.GaugeValue, labels: []string{"page"}, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Hugetlb == nil { return nil } @@ -35,7 +35,7 @@ var hugetlbMetrics = []*metric{ unit: metrics.Total, vt: prometheus.GaugeValue, labels: []string{"page"}, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Hugetlb == nil { return nil } @@ -55,7 +55,7 @@ var hugetlbMetrics = []*metric{ unit: metrics.Bytes, vt: prometheus.GaugeValue, labels: []string{"page"}, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Hugetlb == nil { return nil } diff --git a/metrics/cgroups/memory.go b/metrics/cgroups/memory.go index e942efbdf..27b574b64 100644 --- a/metrics/cgroups/memory.go +++ b/metrics/cgroups/memory.go @@ -14,7 +14,7 @@ var memoryMetrics = []*metric{ help: "The cache amount used", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -30,13 +30,13 @@ var memoryMetrics = []*metric{ help: "The rss amount used", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } return []value{ { - v: float64(stats.Memory.RSS), + v: float64(stats.Memory.Rss), }, } }, @@ -46,13 +46,13 @@ var memoryMetrics = []*metric{ help: "The rss_huge amount used", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } return []value{ { - v: float64(stats.Memory.RSSHuge), + v: float64(stats.Memory.RssHuge), }, } }, @@ -62,7 +62,7 @@ var memoryMetrics = []*metric{ help: "The mapped_file amount used", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -78,7 +78,7 @@ var memoryMetrics = []*metric{ help: "The dirty amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -94,7 +94,7 @@ var memoryMetrics = []*metric{ help: "The writeback amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -110,7 +110,7 @@ var memoryMetrics = []*metric{ help: "The pgpgin amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -126,7 +126,7 @@ var memoryMetrics = []*metric{ help: "The pgpgout amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -142,7 +142,7 @@ var memoryMetrics = []*metric{ help: "The pgfault amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -158,7 +158,7 @@ var memoryMetrics = []*metric{ help: "The pgmajfault amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -174,7 +174,7 @@ var memoryMetrics = []*metric{ help: "The inactive_anon amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -190,7 +190,7 @@ var memoryMetrics = []*metric{ help: "The active_anon amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -206,7 +206,7 @@ var memoryMetrics = []*metric{ help: "The inactive_file amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -222,7 +222,7 @@ var memoryMetrics = []*metric{ help: "The active_file amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -238,7 +238,7 @@ var memoryMetrics = []*metric{ help: "The unevictable amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -254,7 +254,7 @@ var memoryMetrics = []*metric{ help: "The hierarchical_memory_limit amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -270,7 +270,7 @@ var memoryMetrics = []*metric{ help: "The hierarchical_memsw_limit amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -286,7 +286,7 @@ var memoryMetrics = []*metric{ help: "The total_cache amount used", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -302,13 +302,13 @@ var memoryMetrics = []*metric{ help: "The total_rss amount used", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } return []value{ { - v: float64(stats.Memory.TotalRSS), + v: float64(stats.Memory.TotalRss), }, } }, @@ -318,13 +318,13 @@ var memoryMetrics = []*metric{ help: "The total_rss_huge amount used", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } return []value{ { - v: float64(stats.Memory.TotalRSSHuge), + v: float64(stats.Memory.TotalRssHuge), }, } }, @@ -334,7 +334,7 @@ var memoryMetrics = []*metric{ help: "The total_mapped_file amount used", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -350,7 +350,7 @@ var memoryMetrics = []*metric{ help: "The total_dirty amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -366,7 +366,7 @@ var memoryMetrics = []*metric{ help: "The total_writeback amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -382,7 +382,7 @@ var memoryMetrics = []*metric{ help: "The total_pgpgin amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -398,7 +398,7 @@ var memoryMetrics = []*metric{ help: "The total_pgpgout amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -414,7 +414,7 @@ var memoryMetrics = []*metric{ help: "The total_pgfault amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -430,7 +430,7 @@ var memoryMetrics = []*metric{ help: "The total_pgmajfault amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -446,7 +446,7 @@ var memoryMetrics = []*metric{ help: "The total_inactive_anon amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -462,7 +462,7 @@ var memoryMetrics = []*metric{ help: "The total_active_anon amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -478,7 +478,7 @@ var memoryMetrics = []*metric{ help: "The total_inactive_file amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -494,7 +494,7 @@ var memoryMetrics = []*metric{ help: "The total_active_file amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -510,7 +510,7 @@ var memoryMetrics = []*metric{ help: "The total_unevictable amount", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -526,7 +526,7 @@ var memoryMetrics = []*metric{ help: "The usage failcnt", unit: metrics.Total, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -542,7 +542,7 @@ var memoryMetrics = []*metric{ help: "The memory limit", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -558,7 +558,7 @@ var memoryMetrics = []*metric{ help: "The memory maximum usage", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -574,7 +574,7 @@ var memoryMetrics = []*metric{ help: "The memory usage", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -590,7 +590,7 @@ var memoryMetrics = []*metric{ help: "The swap failcnt", unit: metrics.Total, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -606,7 +606,7 @@ var memoryMetrics = []*metric{ help: "The swap limit", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -622,7 +622,7 @@ var memoryMetrics = []*metric{ help: "The swap maximum usage", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -638,7 +638,7 @@ var memoryMetrics = []*metric{ help: "The swap usage", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -654,7 +654,7 @@ var memoryMetrics = []*metric{ help: "The kernel failcnt", unit: metrics.Total, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -670,7 +670,7 @@ var memoryMetrics = []*metric{ help: "The kernel limit", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -686,7 +686,7 @@ var memoryMetrics = []*metric{ help: "The kernel maximum usage", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -702,7 +702,7 @@ var memoryMetrics = []*metric{ help: "The kernel usage", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } @@ -718,13 +718,13 @@ var memoryMetrics = []*metric{ help: "The kerneltcp failcnt", unit: metrics.Total, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } return []value{ { - v: float64(stats.Memory.KernelTCP.Failcnt), + v: float64(stats.Memory.KernelTcp.Failcnt), }, } }, @@ -734,13 +734,13 @@ var memoryMetrics = []*metric{ help: "The kerneltcp limit", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } return []value{ { - v: float64(stats.Memory.KernelTCP.Limit), + v: float64(stats.Memory.KernelTcp.Limit), }, } }, @@ -750,13 +750,13 @@ var memoryMetrics = []*metric{ help: "The kerneltcp maximum usage", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } return []value{ { - v: float64(stats.Memory.KernelTCP.Max), + v: float64(stats.Memory.KernelTcp.Max), }, } }, @@ -766,13 +766,13 @@ var memoryMetrics = []*metric{ help: "The kerneltcp usage", unit: metrics.Bytes, vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Memory == nil { return nil } return []value{ { - v: float64(stats.Memory.KernelTCP.Usage), + v: float64(stats.Memory.KernelTcp.Usage), }, } }, diff --git a/metrics/cgroups/metric.go b/metrics/cgroups/metric.go index d1a0056e0..da532dd00 100644 --- a/metrics/cgroups/metric.go +++ b/metrics/cgroups/metric.go @@ -20,7 +20,7 @@ type metric struct { vt prometheus.ValueType labels []string // getValues returns the value and labels for the data - getValues func(stats *cgroups.Stats) []value + getValues func(stats *cgroups.Metrics) []value } func (m *metric) desc(ns *metrics.Namespace) *prometheus.Desc { @@ -28,7 +28,7 @@ func (m *metric) desc(ns *metrics.Namespace) *prometheus.Desc { return ns.NewDesc(m.name, m.help, m.unit, append([]string{"container_id", "namespace"}, m.labels...)...) } -func (m *metric) collect(id, namespace string, stats *cgroups.Stats, ns *metrics.Namespace, ch chan<- prometheus.Metric) { +func (m *metric) collect(id, namespace string, stats *cgroups.Metrics, ns *metrics.Namespace, ch chan<- prometheus.Metric) { values := m.getValues(stats) for _, v := range values { ch <- prometheus.MustNewConstMetric(m.desc(ns), m.vt, v.v, append([]string{id, namespace}, v.l...)...) diff --git a/metrics/cgroups/metrics.go b/metrics/cgroups/metrics.go index e47696467..6e8b8257c 100644 --- a/metrics/cgroups/metrics.go +++ b/metrics/cgroups/metrics.go @@ -123,7 +123,7 @@ func (c *Collector) Remove(id, namespace string) { delete(c.cgroups, taskID(id, namespace)) } -func blkioValues(l []cgroups.BlkioEntry) []value { +func blkioValues(l []*cgroups.BlkioEntry) []value { var out []value for _, e := range l { out = append(out, value{ diff --git a/metrics/cgroups/pids.go b/metrics/cgroups/pids.go index 35e7d4fd8..d95a682c7 100644 --- a/metrics/cgroups/pids.go +++ b/metrics/cgroups/pids.go @@ -14,7 +14,7 @@ var pidMetrics = []*metric{ help: "The limit to the number of pids allowed", unit: metrics.Unit("limit"), vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Pids == nil { return nil } @@ -30,7 +30,7 @@ var pidMetrics = []*metric{ help: "The current number of pids", unit: metrics.Unit("current"), vt: prometheus.GaugeValue, - getValues: func(stats *cgroups.Stats) []value { + getValues: func(stats *cgroups.Metrics) []value { if stats.Pids == nil { return nil } From f45269be6bc3aaebf26957a511f67414bd47df83 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 5 Sep 2017 13:19:55 -0400 Subject: [PATCH 4/8] Update cgroups to 4be134fe43b9e207558365ad2675546b Signed-off-by: Michael Crosby --- vendor.conf | 2 +- vendor/github.com/containerd/cgroups/cgroup.go | 5 ++++- vendor/github.com/containerd/cgroups/memory.go | 7 ++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/vendor.conf b/vendor.conf index 146990740..a42e331c3 100644 --- a/vendor.conf +++ b/vendor.conf @@ -1,7 +1,7 @@ github.com/coreos/go-systemd 48702e0da86bd25e76cfef347e2adeb434a0d0a6 github.com/containerd/go-runc ba22f6a82e52be3be4eb4a00000fe816f4b41c2e github.com/containerd/console 76d18fd1d66972718ab2284449591db0b3cdb4de -github.com/containerd/cgroups e364e5d4183340acdf51f943ba033543ecb747d3 +github.com/containerd/cgroups 4be134fe43b9e207558365ad2675546b4910f696 github.com/docker/go-metrics 8fd5772bf1584597834c6f7961a530f06cbfbb87 github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9 github.com/godbus/dbus c7fdd8b5cd55e87b4e1f4e372cdb1db61dd6c66f diff --git a/vendor/github.com/containerd/cgroups/cgroup.go b/vendor/github.com/containerd/cgroups/cgroup.go index 5070bd68f..8094faf5d 100644 --- a/vendor/github.com/containerd/cgroups/cgroup.go +++ b/vendor/github.com/containerd/cgroups/cgroup.go @@ -166,7 +166,10 @@ func (c *cgroup) Stat(handlers ...ErrorHandler) (*Metrics, error) { } var ( stats = &Metrics{ - Cpu: &CpuStat{}, + Cpu: &CpuStat{ + Throttling: &Throttle{}, + Usage: &CpuUsage{}, + }, } wg = &sync.WaitGroup{} errs = make(chan error, len(c.subsystems)) diff --git a/vendor/github.com/containerd/cgroups/memory.go b/vendor/github.com/containerd/cgroups/memory.go index 148a66701..1f7c1159a 100644 --- a/vendor/github.com/containerd/cgroups/memory.go +++ b/vendor/github.com/containerd/cgroups/memory.go @@ -87,7 +87,12 @@ func (m *memoryController) Stat(path string, stats *Metrics) error { return err } defer f.Close() - stats.Memory = &MemoryStat{} + stats.Memory = &MemoryStat{ + Usage: &MemoryEntry{}, + Swap: &MemoryEntry{}, + Kernel: &MemoryEntry{}, + KernelTcp: &MemoryEntry{}, + } if err := m.parseStats(f, stats.Memory); err != nil { return err } From 8510512e7e2547df62b56a76a43aa61f67c77dfd Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 5 Sep 2017 13:52:52 -0400 Subject: [PATCH 5/8] Add test for client metrics Signed-off-by: Michael Crosby --- api/next.pb.txt | 9 +++- api/types/metrics.pb.go | 86 +++++++++++++++++++++++++++++---------- api/types/metrics.proto | 3 +- container_test.go | 58 ++++++++++++++++++++++++++ services/tasks/service.go | 59 +++++++++++++++++++-------- task.go | 14 +++++++ 6 files changed, 188 insertions(+), 41 deletions(-) diff --git a/api/next.pb.txt b/api/next.pb.txt index 760354b20..ac5566f3a 100755 --- a/api/next.pb.txt +++ b/api/next.pb.txt @@ -2926,9 +2926,16 @@ file { json_name: "timestamp" } field { - name: "data" + name: "id" number: 2 label: LABEL_OPTIONAL + type: TYPE_STRING + json_name: "id" + } + field { + name: "data" + number: 3 + label: LABEL_OPTIONAL type: TYPE_MESSAGE type_name: ".google.protobuf.Any" json_name: "data" diff --git a/api/types/metrics.pb.go b/api/types/metrics.pb.go index 8033bb206..5d795d55a 100644 --- a/api/types/metrics.pb.go +++ b/api/types/metrics.pb.go @@ -44,7 +44,8 @@ func (*MetricsResponse) Descriptor() ([]byte, []int) { return fileDescriptorMetr type Metric struct { Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,stdtime" json:"timestamp"` - Data *google_protobuf1.Any `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"` + ID string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + Data *google_protobuf1.Any `protobuf:"bytes,3,opt,name=data" json:"data,omitempty"` } func (m *Metric) Reset() { *m = Metric{} } @@ -142,9 +143,15 @@ func (m *Metric) MarshalTo(dAtA []byte) (int, error) { return 0, err } i += n1 - if m.Data != nil { + if len(m.ID) > 0 { dAtA[i] = 0x12 i++ + i = encodeVarintMetrics(dAtA, i, uint64(len(m.ID))) + i += copy(dAtA[i:], m.ID) + } + if m.Data != nil { + dAtA[i] = 0x1a + i++ i = encodeVarintMetrics(dAtA, i, uint64(m.Data.Size())) n2, err := m.Data.MarshalTo(dAtA[i:]) if err != nil { @@ -211,6 +218,10 @@ func (m *Metric) Size() (n int) { _ = l l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp) n += 1 + l + sovMetrics(uint64(l)) + l = len(m.ID) + if l > 0 { + n += 1 + l + sovMetrics(uint64(l)) + } if m.Data != nil { l = m.Data.Size() n += 1 + l + sovMetrics(uint64(l)) @@ -257,6 +268,7 @@ func (this *Metric) String() string { } s := strings.Join([]string{`&Metric{`, `Timestamp:` + strings.Replace(strings.Replace(this.Timestamp.String(), "Timestamp", "google_protobuf2.Timestamp", 1), `&`, ``, 1) + `,`, + `ID:` + fmt.Sprintf("%v", this.ID) + `,`, `Data:` + strings.Replace(fmt.Sprintf("%v", this.Data), "Any", "google_protobuf1.Any", 1) + `,`, `}`, }, "") @@ -490,6 +502,35 @@ func (m *Metric) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetrics + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) } @@ -653,24 +694,25 @@ func init() { } var fileDescriptorMetrics = []byte{ - // 297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x48, 0xcf, 0x2c, 0xc9, - 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, - 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xe7, 0xa6, 0x96, - 0x14, 0x65, 0x26, 0x17, 0xeb, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0x09, 0x20, 0xd4, 0xe8, 0x81, - 0xe5, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x92, 0xfa, 0x20, 0x16, 0x44, 0x9d, 0x94, 0x64, - 0x7a, 0x7e, 0x7e, 0x7a, 0x4e, 0xaa, 0x3e, 0x98, 0x97, 0x54, 0x9a, 0xa6, 0x9f, 0x98, 0x57, 0x09, - 0x95, 0x92, 0x47, 0x97, 0x2a, 0xc9, 0xcc, 0x4d, 0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0x80, 0x28, 0x50, - 0xd2, 0xe2, 0xe2, 0xf3, 0x85, 0x58, 0x1a, 0x94, 0x5a, 0x58, 0x9a, 0x5a, 0x5c, 0x22, 0x24, 0xc1, - 0xc5, 0x9e, 0x96, 0x99, 0x53, 0x92, 0x5a, 0x54, 0x2c, 0xc1, 0xa8, 0xc0, 0xac, 0xc1, 0x19, 0x04, - 0xe3, 0x2a, 0xb9, 0x72, 0xf1, 0xc3, 0xd5, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x0a, 0x19, 0x71, - 0xb1, 0x43, 0xdd, 0x0c, 0x56, 0xcc, 0x6d, 0x24, 0xa1, 0x87, 0xee, 0x68, 0x3d, 0x88, 0x9e, 0x20, - 0x98, 0x42, 0xa5, 0x32, 0x2e, 0x36, 0x88, 0x90, 0x90, 0x13, 0x17, 0x27, 0xdc, 0x3d, 0x12, 0x8c, - 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x52, 0x7a, 0x10, 0x17, 0xeb, 0xc1, 0x5c, 0xac, 0x17, 0x02, 0x53, - 0xe1, 0xc4, 0x71, 0xe2, 0x9e, 0x3c, 0xc3, 0x84, 0xfb, 0xf2, 0x8c, 0x41, 0x08, 0x6d, 0x42, 0x1a, - 0x5c, 0x2c, 0x29, 0x89, 0x25, 0x89, 0x12, 0x4c, 0x60, 0xed, 0x22, 0x18, 0xda, 0x1d, 0xf3, 0x2a, - 0x83, 0xc0, 0x2a, 0x9c, 0xbc, 0x4e, 0x3c, 0x94, 0x63, 0xb8, 0xf1, 0x50, 0x8e, 0xa1, 0xe1, 0x91, - 0x1c, 0xe3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x18, 0x65, - 0x40, 0x7c, 0x14, 0x59, 0x83, 0xc9, 0x24, 0x36, 0xb0, 0xf9, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xa5, 0x43, 0x7b, 0x37, 0xdd, 0x01, 0x00, 0x00, + // 319 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0x31, 0x4b, 0x03, 0x31, + 0x14, 0xc7, 0x9b, 0xab, 0xb4, 0x36, 0x05, 0x95, 0xa3, 0x48, 0xec, 0x90, 0x2b, 0x9d, 0x0e, 0x87, + 0x44, 0xea, 0x22, 0x38, 0x79, 0xe8, 0xa0, 0xe0, 0x12, 0x9c, 0xdc, 0xd2,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xa2, 0xfd, 0x72, 0x19, 0x34, 0xde, 0x3e, 0x03, 0xc0, 0xb6, 0x63, 0xfe, 0x31, + 0xf4, 0x64, 0x8c, 0xbc, 0x01, 0x08, 0x3b, 0x51, 0xab, 0x5a, 0x06, 0xde, 0xed, 0x35, 0xf3, 0x64, + 0xec, 0x87, 0x70, 0x2f, 0xe6, 0x86, 0xa3, 0xa6, 0x5d, 0xdb, 0xfb, 0xb3, 0xf6, 0x2a, 0x5b, 0x30, + 0x4b, 0x44, 0x77, 0xe5, 0x0a, 0x37, 0x3e, 0x56, 0xb8, 0xf1, 0x52, 0x61, 0x50, 0x56, 0x18, 0xbc, + 0x57, 0x18, 0x7c, 0x55, 0x18, 0x3c, 0x9e, 0xfd, 0xff, 0xef, 0x2e, 0xed, 0x39, 0x6e, 0xd9, 0xfd, + 0xe7, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x95, 0xe4, 0x62, 0x3d, 0xf6, 0x01, 0x00, 0x00, } diff --git a/api/types/metrics.proto b/api/types/metrics.proto index 444bd5038..6441be331 100644 --- a/api/types/metrics.proto +++ b/api/types/metrics.proto @@ -18,5 +18,6 @@ message MetricsResponse { message Metric { google.protobuf.Timestamp timestamp = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; - google.protobuf.Any data = 2; + string id = 2; + google.protobuf.Any data = 3; } diff --git a/container_test.go b/container_test.go index 7085bf3d1..c102b13c2 100644 --- a/container_test.go +++ b/container_test.go @@ -1307,3 +1307,61 @@ func TestDeleteContainerExecCreated(t *testing.T) { } <-finished } + +func TestContainerMetrics(t *testing.T) { + t.Parallel() + + client, err := newClient(t, address) + if err != nil { + t.Fatal(err) + } + defer client.Close() + + var ( + image Image + ctx, cancel = testContext() + id = t.Name() + ) + defer cancel() + + if runtime.GOOS != "windows" { + image, err = client.GetImage(ctx, testImage) + if err != nil { + t.Error(err) + return + } + } + container, err := client.NewContainer(ctx, id, WithNewSpec(withImageConfig(image), WithProcessArgs("sleep", "30")), withNewSnapshot(id, image)) + if err != nil { + t.Error(err) + return + } + defer container.Delete(ctx, WithSnapshotCleanup) + + task, err := container.NewTask(ctx, empty()) + if err != nil { + t.Error(err) + return + } + defer task.Delete(ctx) + + statusC, err := task.Wait(ctx) + if err != nil { + t.Error(err) + return + } + + metric, err := task.Metrics(ctx) + if err != nil { + t.Error(err) + } + if metric.ID != id { + t.Errorf("expected metric id %q but received %q", id, metric.ID) + } + if err := task.Kill(ctx, syscall.SIGKILL); err != nil { + t.Error(err) + return + } + + <-statusC +} diff --git a/services/tasks/service.go b/services/tasks/service.go index 9015fda9b..56686ab3e 100644 --- a/services/tasks/service.go +++ b/services/tasks/service.go @@ -18,6 +18,7 @@ import ( "github.com/containerd/containerd/content" "github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/events" + "github.com/containerd/containerd/filters" "github.com/containerd/containerd/images" "github.com/containerd/containerd/log" "github.com/containerd/containerd/metadata" @@ -457,33 +458,57 @@ func (s *Service) Update(ctx context.Context, r *api.UpdateTaskRequest) (*google } func (s *Service) Metrics(ctx context.Context, r *types.MetricsRequest) (*types.MetricsResponse, error) { + filter, err := filters.ParseAll(r.Filters...) + if err != nil { + return nil, err + } var resp types.MetricsResponse for _, r := range s.runtimes { tasks, err := r.Tasks(ctx) if err != nil { return nil, err } - for _, t := range tasks { - collected := time.Now() - metrics, err := t.Metrics(ctx) - if err != nil { - log.G(ctx).WithError(err).Errorf("collecting metrics for %s", t.ID()) - continue - } - data, err := typeurl.MarshalAny(metrics) - if err != nil { - log.G(ctx).WithError(err).Errorf("marshal metrics for %s", t.ID()) - continue - } - resp.Metrics = append(resp.Metrics, &types.Metric{ - Timestamp: collected, - Data: data, - }) - } + getTasksMetrics(ctx, filter, tasks, &resp) } return &resp, nil } +func getTasksMetrics(ctx context.Context, filter filters.Filter, tasks []runtime.Task, r *types.MetricsResponse) { + for _, tk := range tasks { + if !filter.Match(filters.AdapterFunc(func(fieldpath []string) (string, bool) { + t := tk + switch fieldpath[0] { + case "id": + return t.ID(), true + case "namespace": + return t.Info().Namespace, true + case "runtime": + return t.Info().Runtime, true + } + return "", false + })) { + continue + } + + collected := time.Now() + metrics, err := tk.Metrics(ctx) + if err != nil { + log.G(ctx).WithError(err).Errorf("collecting metrics for %s", tk.ID()) + continue + } + data, err := typeurl.MarshalAny(metrics) + if err != nil { + log.G(ctx).WithError(err).Errorf("marshal metrics for %s", tk.ID()) + continue + } + r.Metrics = append(r.Metrics, &types.Metric{ + ID: tk.ID(), + Timestamp: collected, + Data: data, + }) + } +} + func (s *Service) writeContent(ctx context.Context, mediaType, ref string, r io.Reader) (*types.Descriptor, error) { writer, err := s.store.Writer(ctx, ref, 0, "") if err != nil { diff --git a/task.go b/task.go index 93a57e545..1da9a77c9 100644 --- a/task.go +++ b/task.go @@ -118,6 +118,8 @@ type Task interface { Update(context.Context, ...UpdateTaskOpts) error // LoadProcess loads a previously created exec'd process LoadProcess(context.Context, string, IOAttach) (Process, error) + // Metrics returns task metrics for runtime specific metrics + Metrics(context.Context) (*types.Metric, error) } var _ = (Task)(&task{}) @@ -472,6 +474,18 @@ func (t *task) LoadProcess(ctx context.Context, id string, ioAttach IOAttach) (P }, nil } +func (t *task) Metrics(ctx context.Context) (*types.Metric, error) { + response, err := t.client.TaskService().Metrics(ctx, &types.MetricsRequest{ + Filters: []string{ + "id==" + t.id, + }, + }) + if err != nil { + return nil, errdefs.FromGRPC(err) + } + return response.Metrics[0], nil +} + func (t *task) checkpointTask(ctx context.Context, index *v1.Index, request *tasks.CheckpointTaskRequest) error { response, err := t.client.TaskService().Checkpoint(ctx, request) if err != nil { From c07f7cab379fdfa59b981a2914397c1770428617 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 5 Sep 2017 13:57:12 -0400 Subject: [PATCH 6/8] Add task.Metrics to windows Signed-off-by: Michael Crosby --- container_test.go | 3 +++ windows/task.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/container_test.go b/container_test.go index c102b13c2..cbae4e67c 100644 --- a/container_test.go +++ b/container_test.go @@ -1309,6 +1309,9 @@ func TestDeleteContainerExecCreated(t *testing.T) { } func TestContainerMetrics(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("metrics are currently not supported on windows") + } t.Parallel() client, err := newClient(t, address) diff --git a/windows/task.go b/windows/task.go index 33e5b7041..2fa85eb0a 100644 --- a/windows/task.go +++ b/windows/task.go @@ -270,6 +270,10 @@ func (t *task) Process(ctx context.Context, id string) (p runtime.Process, err e return p, err } +func (t *task) Metrics(ctx context.Context) (interface{}, error) { + return nil, errors.Wrap(errdefs.ErrUnavailable, "not supported") +} + func (t *task) newProcess(ctx context.Context, id string, conf *hcsshim.ProcessConfig, pset *pipeSet) (*process, error) { var ( err error From 4c5ed9c06809acb7542d38afd5a248b6af575c85 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 5 Sep 2017 17:34:10 -0400 Subject: [PATCH 7/8] Move metrics requests to services Signed-off-by: Michael Crosby --- api/next.pb.txt | 46 +-- api/services/tasks/v1/tasks.pb.go | 459 ++++++++++++++++++++++++------ api/services/tasks/v1/tasks.proto | 10 +- api/types/descriptor.pb.go | 2 - api/types/metrics.pb.go | 325 ++------------------- api/types/metrics.proto | 8 - linux/runtime.go | 14 +- services/tasks/service.go | 6 +- task.go | 2 +- 9 files changed, 436 insertions(+), 436 deletions(-) diff --git a/api/next.pb.txt b/api/next.pb.txt index ac5566f3a..30b45c500 100755 --- a/api/next.pb.txt +++ b/api/next.pb.txt @@ -2890,27 +2890,6 @@ file { dependency: "gogoproto/gogo.proto" dependency: "google/protobuf/any.proto" dependency: "google/protobuf/timestamp.proto" - message_type { - name: "MetricsRequest" - field { - name: "filters" - number: 1 - label: LABEL_REPEATED - type: TYPE_STRING - json_name: "filters" - } - } - message_type { - name: "MetricsResponse" - field { - name: "metrics" - number: 1 - label: LABEL_REPEATED - type: TYPE_MESSAGE - type_name: ".containerd.types.Metric" - json_name: "metrics" - } - } message_type { name: "Metric" field { @@ -3550,6 +3529,27 @@ file { json_name: "resources" } } + message_type { + name: "MetricsRequest" + field { + name: "filters" + number: 1 + label: LABEL_REPEATED + type: TYPE_STRING + json_name: "filters" + } + } + message_type { + name: "MetricsResponse" + field { + name: "metrics" + number: 1 + label: LABEL_REPEATED + type: TYPE_MESSAGE + type_name: ".containerd.types.Metric" + json_name: "metrics" + } + } service { name: "Tasks" method { @@ -3629,8 +3629,8 @@ file { } method { name: "Metrics" - input_type: ".containerd.types.MetricsRequest" - output_type: ".containerd.types.MetricsResponse" + input_type: ".containerd.services.tasks.v1.MetricsRequest" + output_type: ".containerd.services.tasks.v1.MetricsResponse" } } options { diff --git a/api/services/tasks/v1/tasks.pb.go b/api/services/tasks/v1/tasks.pb.go index dfa43addc..fb6efa8dd 100644 --- a/api/services/tasks/v1/tasks.pb.go +++ b/api/services/tasks/v1/tasks.pb.go @@ -32,6 +32,8 @@ CheckpointTaskRequest CheckpointTaskResponse UpdateTaskRequest + MetricsRequest + MetricsResponse */ package tasks @@ -298,6 +300,22 @@ func (m *UpdateTaskRequest) Reset() { *m = UpdateTaskRequest{ func (*UpdateTaskRequest) ProtoMessage() {} func (*UpdateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{22} } +type MetricsRequest struct { + Filters []string `protobuf:"bytes,1,rep,name=filters" json:"filters,omitempty"` +} + +func (m *MetricsRequest) Reset() { *m = MetricsRequest{} } +func (*MetricsRequest) ProtoMessage() {} +func (*MetricsRequest) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{23} } + +type MetricsResponse struct { + Metrics []*containerd_types1.Metric `protobuf:"bytes,1,rep,name=metrics" json:"metrics,omitempty"` +} + +func (m *MetricsResponse) Reset() { *m = MetricsResponse{} } +func (*MetricsResponse) ProtoMessage() {} +func (*MetricsResponse) Descriptor() ([]byte, []int) { return fileDescriptorTasks, []int{24} } + func init() { proto.RegisterType((*CreateTaskRequest)(nil), "containerd.services.tasks.v1.CreateTaskRequest") proto.RegisterType((*CreateTaskResponse)(nil), "containerd.services.tasks.v1.CreateTaskResponse") @@ -322,6 +340,8 @@ func init() { proto.RegisterType((*CheckpointTaskRequest)(nil), "containerd.services.tasks.v1.CheckpointTaskRequest") proto.RegisterType((*CheckpointTaskResponse)(nil), "containerd.services.tasks.v1.CheckpointTaskResponse") proto.RegisterType((*UpdateTaskRequest)(nil), "containerd.services.tasks.v1.UpdateTaskRequest") + proto.RegisterType((*MetricsRequest)(nil), "containerd.services.tasks.v1.MetricsRequest") + proto.RegisterType((*MetricsResponse)(nil), "containerd.services.tasks.v1.MetricsResponse") } // Reference imports to suppress errors if they are not otherwise used. @@ -354,7 +374,7 @@ type TasksClient interface { ListPids(ctx context.Context, in *ListPidsRequest, opts ...grpc.CallOption) (*ListPidsResponse, error) Checkpoint(ctx context.Context, in *CheckpointTaskRequest, opts ...grpc.CallOption) (*CheckpointTaskResponse, error) Update(ctx context.Context, in *UpdateTaskRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) - Metrics(ctx context.Context, in *containerd_types1.MetricsRequest, opts ...grpc.CallOption) (*containerd_types1.MetricsResponse, error) + Metrics(ctx context.Context, in *MetricsRequest, opts ...grpc.CallOption) (*MetricsResponse, error) } type tasksClient struct { @@ -500,8 +520,8 @@ func (c *tasksClient) Update(ctx context.Context, in *UpdateTaskRequest, opts .. return out, nil } -func (c *tasksClient) Metrics(ctx context.Context, in *containerd_types1.MetricsRequest, opts ...grpc.CallOption) (*containerd_types1.MetricsResponse, error) { - out := new(containerd_types1.MetricsResponse) +func (c *tasksClient) Metrics(ctx context.Context, in *MetricsRequest, opts ...grpc.CallOption) (*MetricsResponse, error) { + out := new(MetricsResponse) err := grpc.Invoke(ctx, "/containerd.services.tasks.v1.Tasks/Metrics", in, out, c.cc, opts...) if err != nil { return nil, err @@ -531,7 +551,7 @@ type TasksServer interface { ListPids(context.Context, *ListPidsRequest) (*ListPidsResponse, error) Checkpoint(context.Context, *CheckpointTaskRequest) (*CheckpointTaskResponse, error) Update(context.Context, *UpdateTaskRequest) (*google_protobuf.Empty, error) - Metrics(context.Context, *containerd_types1.MetricsRequest) (*containerd_types1.MetricsResponse, error) + Metrics(context.Context, *MetricsRequest) (*MetricsResponse, error) } func RegisterTasksServer(s *grpc.Server, srv TasksServer) { @@ -809,7 +829,7 @@ func _Tasks_Update_Handler(srv interface{}, ctx context.Context, dec func(interf } func _Tasks_Metrics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(containerd_types1.MetricsRequest) + in := new(MetricsRequest) if err := dec(in); err != nil { return nil, err } @@ -821,7 +841,7 @@ func _Tasks_Metrics_Handler(srv interface{}, ctx context.Context, dec func(inter FullMethod: "/containerd.services.tasks.v1.Tasks/Metrics", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TasksServer).Metrics(ctx, req.(*containerd_types1.MetricsRequest)) + return srv.(TasksServer).Metrics(ctx, req.(*MetricsRequest)) } return interceptor(ctx, in, info, handler) } @@ -1695,6 +1715,69 @@ func (m *UpdateTaskRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *MetricsRequest) 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 *MetricsRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Filters) > 0 { + for _, s := range m.Filters { + dAtA[i] = 0xa + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + +func (m *MetricsResponse) 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 *MetricsResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Metrics) > 0 { + for _, msg := range m.Metrics { + dAtA[i] = 0xa + i++ + i = encodeVarintTasks(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + func encodeFixed64Tasks(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) dAtA[offset+1] = uint8(v >> 8) @@ -2068,6 +2151,30 @@ func (m *UpdateTaskRequest) Size() (n int) { return n } +func (m *MetricsRequest) Size() (n int) { + var l int + _ = l + if len(m.Filters) > 0 { + for _, s := range m.Filters { + l = len(s) + n += 1 + l + sovTasks(uint64(l)) + } + } + return n +} + +func (m *MetricsResponse) Size() (n int) { + var l int + _ = l + if len(m.Metrics) > 0 { + for _, e := range m.Metrics { + l = e.Size() + n += 1 + l + sovTasks(uint64(l)) + } + } + return n +} + func sovTasks(x uint64) (n int) { for { n++ @@ -2341,6 +2448,26 @@ func (this *UpdateTaskRequest) String() string { }, "") return s } +func (this *MetricsRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&MetricsRequest{`, + `Filters:` + fmt.Sprintf("%v", this.Filters) + `,`, + `}`, + }, "") + return s +} +func (this *MetricsResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&MetricsResponse{`, + `Metrics:` + strings.Replace(fmt.Sprintf("%v", this.Metrics), "Metric", "containerd_types1.Metric", 1) + `,`, + `}`, + }, "") + return s +} func valueToStringTasks(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -4994,6 +5121,166 @@ func (m *UpdateTaskRequest) Unmarshal(dAtA []byte) error { } return nil } +func (m *MetricsRequest) 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 ErrIntOverflowTasks + } + 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: MetricsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MetricsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTasks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTasks + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Filters = append(m.Filters, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTasks(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTasks + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MetricsResponse) 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 ErrIntOverflowTasks + } + 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: MetricsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MetricsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metrics", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTasks + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTasks + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metrics = append(m.Metrics, &containerd_types1.Metric{}) + if err := m.Metrics[len(m.Metrics)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTasks(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTasks + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTasks(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 @@ -5104,83 +5391,85 @@ func init() { } var fileDescriptorTasks = []byte{ - // 1238 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5f, 0x6f, 0x1b, 0x45, - 0x10, 0xef, 0xf9, 0xcf, 0xd9, 0x1e, 0x37, 0x6d, 0xb2, 0xa4, 0xc1, 0x1c, 0x95, 0xed, 0x1e, 0x12, - 0x32, 0x85, 0xde, 0x51, 0x17, 0x55, 0x88, 0x56, 0x48, 0x4d, 0x1c, 0x22, 0x0b, 0x4a, 0xd3, 0x6b, - 0x41, 0xa8, 0x2f, 0xe6, 0x72, 0xb7, 0x71, 0x56, 0xb1, 0xef, 0xae, 0xb7, 0xeb, 0x34, 0x81, 0x07, - 0xf8, 0x08, 0x7d, 0xe5,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x1a, 0xc4, 0xd0, 0xac, 0x81, 0xba, 0x4b, - 0x3a, 0x0c, 0x87, 0xc2, 0x5b, 0x4b, 0xce, 0xa2, 0xa4, 0x49, 0xc8, 0xc6, 0x6f, 0x23, 0xcb, 0x29, - 0xbe, 0xa4, 0x70, 0xc6, 0x98, 0x7e, 0xac, 0x10, 0xd5, 0x5f, 0x2a, 0x50, 0xfc, 0x92, 0x74, 0x3a, - 0x17, 0x0d, 0x12, 0x27, 0x1c, 0xd2, 0x8e, 0x68, 0x45, 0xe4, 0x96, 0x9c, 0x45, 0xa9, 0x68, 0x77, - 0x3a, 0x3c, 0xa3, 0xf2, 0x56, 0x34, 0xd4, 0xff, 0x55, 0x00, 0x45, 0xca, 0x6f, 0x20, 0x4b, 0x62, - 0x4e, 0x4c, 0x8d, 0xe7, 0xc4, 0xf4, 0x04, 0x4e, 0xcc, 0x4c, 0xe4, 0xc4, 0xec, 0x10, 0x27, 0xd6, - 0x20, 0x43, 0x03, 0xec, 0x70, 0x16, 0x9d, 0x44, 0x69, 0x5c, 0x22, 0x89, 0x52, 0x6e, 0x62, 0x2a, - 0x5d, 0x83, 0xb7, 0xce, 0x5c, 0x5d, 0x44, 0x56, 0xff, 0x45, 0x81, 0x65, 0x0b, 0x53, 0xf2, 0x03, - 0xde, 0x66, 0x47, 0x17, 0x1e, 0xaa, 0x55, 0xc8, 0xbe, 0x20, 0x2e, 0xdb, 0x93, 0x91, 0x12, 0x93, - 0x08, 0x9d, 0x3d, 0x4c, 0xda, 0x7b, 0xe2, 0xf5, 0x2f, 0x59, 0x72, 0xa6, 0xff, 0x04, 0x57, 0x36, - 0x3a, 0x3e, 0xc5, 0xcd, 0x47, 0xff, 0x87, 0x63, 0x22, 0x9c, 0x69, 0x1e, 0x05, 0x31, 0xd1, 0xbf, - 0x80, 0xe5, 0x6d, 0xbb, 0x47, 0x17, 0xe6, 0xcf, 0x2d, 0x58, 0xb1, 0x30, 0xed, 0x75, 0x17, 0x36, - 0xb4, 0x09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b9, - 0x87, 0xe2, 0x63, 0x03, 0xaa, 0x8e, 0xf9, 0xc9, 0x2d, 0xb6, 0x06, 0x46, 0x6e, 0x4c, 0x91, 0x10, - 0x2e, 0xae, 0x7f, 0x7b, 0xfc, 0xaa, 0x7c, 0xe9, 0xf7, 0x57, 0xe5, 0x4b, 0x3f, 0xf7, 0xcb, 0xca, - 0x71, 0xbf, 0xac, 0xfc, 0xd6, 0x2f, 0x2b, 0x7f, 0xf7, 0xcb, 0xca, 0xb3, 0xfb, 0xaf, 0xf7, 0x9d, - 0xe7, 0x1e, 0x1f, 0xec, 0xa8, 0xdc, 0xef, 0x3b, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x63, 0x7a, - 0xe4, 0x79, 0x2e, 0x12, 0x00, 0x00, + // 1274 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xef, 0xc6, 0xf6, 0xda, 0x7e, 0x6e, 0xda, 0x64, 0x48, 0xc3, 0xb2, 0x54, 0x71, 0x58, 0x24, + 0x64, 0x02, 0xdd, 0xa5, 0x2e, 0xaa, 0x10, 0xad, 0x90, 0x9a, 0x3f, 0x44, 0x16, 0x54, 0x4d, 0xb7, + 0x05, 0xa1, 0x5e, 0xc2, 0x76, 0x77, 0xe2, 0x8c, 0x62, 0xef, 0x6e, 0x77, 0xc6, 0x69, 0x03, 0x07, + 0xf8, 0x08, 0xbd, 0x72, 0xe1, 0xf3, 0xe4, 0xc8, 0x11, 0x21, 0x14, 0xa8, 0xbf, 0x05, 0x07, 0x24, + 0x34, 0x7f, 0x76, 0xb3, 0xb1, 0xe3, 0xd8, 0xa9, 0x1b, 0x2e, 0xed, 0xcc, 0xec, 0xef, 0xbd, 0x79, + 0xf3, 0x9b, 0x37, 0xef, 0xfd, 0x1c, 0x58, 0x6d, 0x13, 0xb6, 0xdb, 0x7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, + 0x5a, 0xcb, 0x48, 0xda, 0x76, 0xa0, 0xac, 0xca, 0xfb, 0xb8, 0x5c, 0x39, 0xd9, 0x31, 0xcc, 0x1b, + 0x13, 0xa2, 0x65, 0xe8, 0xab, 0xdf, 0x1e, 0xbe, 0x5a, 0xba, 0xf4, 0xfb, 0xab, 0xa5, 0x4b, 0x3f, + 0xf7, 0x97, 0xb4, 0xc3, 0xfe, 0x92, 0xf6, 0x5b, 0x7f, 0x49, 0xfb, 0xbb, 0xbf, 0xa4, 0x3d, 0xb9, + 0xfb, 0x7a, 0x7f, 0x72, 0xba, 0x23, 0x06, 0x4f, 0x75, 0x71, 0x9e, 0x5b, 0xff, 0x05, 0x00, 0x00, + 0xff, 0xff, 0x5e, 0xf6, 0xae, 0x85, 0xb9, 0x12, 0x00, 0x00, } diff --git a/api/services/tasks/v1/tasks.proto b/api/services/tasks/v1/tasks.proto index c9bc4b490..8fb5e8032 100644 --- a/api/services/tasks/v1/tasks.proto +++ b/api/services/tasks/v1/tasks.proto @@ -48,7 +48,7 @@ service Tasks { rpc Update(UpdateTaskRequest) returns (google.protobuf.Empty); - rpc Metrics(types.MetricsRequest) returns (types.MetricsResponse); + rpc Metrics(MetricsRequest) returns (MetricsResponse); } message CreateTaskRequest { @@ -186,3 +186,11 @@ message UpdateTaskRequest { string container_id = 1; google.protobuf.Any resources = 2; } + +message MetricsRequest { + repeated string filters = 1; +} + +message MetricsResponse { + repeated types.Metric metrics = 1; +} diff --git a/api/types/descriptor.pb.go b/api/types/descriptor.pb.go index 025aef77c..e1db00bec 100644 --- a/api/types/descriptor.pb.go +++ b/api/types/descriptor.pb.go @@ -12,8 +12,6 @@ It has these top-level messages: Descriptor - MetricsRequest - MetricsResponse Metric Mount */ diff --git a/api/types/metrics.pb.go b/api/types/metrics.pb.go index 5d795d55a..f9aacf941 100644 --- a/api/types/metrics.pb.go +++ b/api/types/metrics.pb.go @@ -26,22 +26,6 @@ var _ = fmt.Errorf var _ = math.Inf var _ = time.Kitchen -type MetricsRequest struct { - Filters []string `protobuf:"bytes,1,rep,name=filters" json:"filters,omitempty"` -} - -func (m *MetricsRequest) Reset() { *m = MetricsRequest{} } -func (*MetricsRequest) ProtoMessage() {} -func (*MetricsRequest) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{0} } - -type MetricsResponse struct { - Metrics []*Metric `protobuf:"bytes,1,rep,name=metrics" json:"metrics,omitempty"` -} - -func (m *MetricsResponse) Reset() { *m = MetricsResponse{} } -func (*MetricsResponse) ProtoMessage() {} -func (*MetricsResponse) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{1} } - type Metric struct { Timestamp time.Time `protobuf:"bytes,1,opt,name=timestamp,stdtime" json:"timestamp"` ID string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` @@ -50,76 +34,11 @@ type Metric struct { func (m *Metric) Reset() { *m = Metric{} } func (*Metric) ProtoMessage() {} -func (*Metric) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{2} } +func (*Metric) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{0} } func init() { - proto.RegisterType((*MetricsRequest)(nil), "containerd.types.MetricsRequest") - proto.RegisterType((*MetricsResponse)(nil), "containerd.types.MetricsResponse") proto.RegisterType((*Metric)(nil), "containerd.types.Metric") } -func (m *MetricsRequest) 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 *MetricsRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Filters) > 0 { - for _, s := range m.Filters { - dAtA[i] = 0xa - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - return i, nil -} - -func (m *MetricsResponse) 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 *MetricsResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Metrics) > 0 { - for _, msg := range m.Metrics { - dAtA[i] = 0xa - i++ - i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - func (m *Metric) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -189,30 +108,6 @@ func encodeVarintMetrics(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return offset + 1 } -func (m *MetricsRequest) Size() (n int) { - var l int - _ = l - if len(m.Filters) > 0 { - for _, s := range m.Filters { - l = len(s) - n += 1 + l + sovMetrics(uint64(l)) - } - } - return n -} - -func (m *MetricsResponse) Size() (n int) { - var l int - _ = l - if len(m.Metrics) > 0 { - for _, e := range m.Metrics { - l = e.Size() - n += 1 + l + sovMetrics(uint64(l)) - } - } - return n -} - func (m *Metric) Size() (n int) { var l int _ = l @@ -242,26 +137,6 @@ func sovMetrics(x uint64) (n int) { func sozMetrics(x uint64) (n int) { return sovMetrics(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (this *MetricsRequest) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&MetricsRequest{`, - `Filters:` + fmt.Sprintf("%v", this.Filters) + `,`, - `}`, - }, "") - return s -} -func (this *MetricsResponse) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&MetricsResponse{`, - `Metrics:` + strings.Replace(fmt.Sprintf("%v", this.Metrics), "Metric", "Metric", 1) + `,`, - `}`, - }, "") - return s -} func (this *Metric) String() string { if this == nil { return "nil" @@ -282,166 +157,6 @@ func valueToStringMetrics(v interface{}) string { pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } -func (m *MetricsRequest) 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: MetricsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MetricsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMetrics - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMetrics - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Filters = append(m.Filters, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMetrics(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMetrics - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MetricsResponse) 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: MetricsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MetricsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metrics", 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 > l { - return io.ErrUnexpectedEOF - } - m.Metrics = append(m.Metrics, &Metric{}) - if err := m.Metrics[len(m.Metrics)-1].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) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *Metric) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -694,25 +409,21 @@ func init() { } var fileDescriptorMetrics = []byte{ - // 319 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0x31, 0x4b, 0x03, 0x31, - 0x14, 0xc7, 0x9b, 0xab, 0xb4, 0x36, 0x05, 0x95, 0xa3, 0x48, 0xec, 0x90, 0x2b, 0x9d, 0x0e, 0x87, - 0x44, 0xea, 0x22, 0x38, 0x79, 0xe8, 0xa0, 0xe0, 0x12, 0x9c, 0xdc, 0xd2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0xa2, 0xfd, 0x72, 0x19, 0x34, 0xde, 0x3e, 0x03, 0xc0, 0xb6, 0x63, 0xfe, 0x31, - 0xf4, 0x64, 0x8c, 0xbc, 0x01, 0x08, 0x3b, 0x51, 0xab, 0x5a, 0x06, 0xde, 0xed, 0x35, 0xf3, 0x64, - 0xec, 0x87, 0x70, 0x2f, 0xe6, 0x86, 0xa3, 0xa6, 0x5d, 0xdb, 0xfb, 0xb3, 0xf6, 0x2a, 0x5b, 0x30, - 0x4b, 0x44, 0x77, 0xe5, 0x0a, 0x37, 0x3e, 0x56, 0xb8, 0xf1, 0x52, 0x61, 0x50, 0x56, 0x18, 0xbc, - 0x57, 0x18, 0x7c, 0x55, 0x18, 0x3c, 0x9e, 0xfd, 0xff, 0xef, 0x2e, 0xed, 0x39, 0x6e, 0xd9, 0xfd, - 0xe7, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x95, 0xe4, 0x62, 0x3d, 0xf6, 0x01, 0x00, 0x00, + // 256 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x48, 0xcf, 0x2c, 0xc9, + 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xcc, 0xcc, 0x4b, 0x2d, + 0x4a, 0x41, 0x66, 0x26, 0x16, 0x64, 0xea, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0xe7, 0xa6, 0x96, + 0x14, 0x65, 0x26, 0x17, 0xeb, 0x15, 0x14, 0xe5, 0x97, 0xe4, 0x0b, 0x09, 0x20, 0xd4, 0xe8, 0x81, + 0xe5, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x92, 0xfa, 0x20, 0x16, 0x44, 0x9d, 0x94, 0x64, + 0x7a, 0x7e, 0x7e, 0x7a, 0x4e, 0xaa, 0x3e, 0x98, 0x97, 0x54, 0x9a, 0xa6, 0x9f, 0x98, 0x57, 0x09, + 0x95, 0x92, 0x47, 0x97, 0x2a, 0xc9, 0xcc, 0x4d, 0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0x80, 0x28, 0x50, + 0xea, 0x63, 0xe4, 0x62, 0xf3, 0x05, 0xdb, 0x2a, 0xe4, 0xc4, 0xc5, 0x09, 0x97, 0x95, 0x60, 0x54, + 0x60, 0xd4, 0xe0, 0x36, 0x92, 0xd2, 0x83, 0xe8, 0xd7, 0x83, 0xe9, 0xd7, 0x0b, 0x81, 0xa9, 0x70, + 0xe2, 0x38, 0x71, 0x4f, 0x9e, 0x61, 0xc2, 0x7d, 0x79, 0xc6, 0x20, 0x84, 0x36, 0x21, 0x31, 0x2e, + 0xa6, 0xcc, 0x14, 0x09, 0x26, 0x05, 0x46, 0x0d, 0x4e, 0x27, 0xb6, 0x47, 0xf7, 0xe4, 0x99, 0x3c, + 0x5d, 0x82, 0x98, 0x32, 0x53, 0x84, 0x34, 0xb8, 0x58, 0x52, 0x12, 0x4b, 0x12, 0x25, 0x98, 0xc1, + 0xc6, 0x8a, 0x60, 0x18, 0xeb, 0x98, 0x57, 0x19, 0x04, 0x56, 0xe1, 0xe4, 0x75, 0xe2, 0xa1, 0x1c, + 0xc3, 0x8d, 0x87, 0x72, 0x0c, 0x0d, 0x8f, 0xe4, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, + 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x28, 0x03, 0xe2, 0x03, 0xd2, 0x1a, 0x4c, 0x26, 0xb1, 0x81, + 0xcd, 0x37, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x51, 0x36, 0x74, 0x83, 0x01, 0x00, 0x00, } diff --git a/api/types/metrics.proto b/api/types/metrics.proto index 6441be331..d1629c7ee 100644 --- a/api/types/metrics.proto +++ b/api/types/metrics.proto @@ -8,14 +8,6 @@ import "google/protobuf/timestamp.proto"; option go_package = "github.com/containerd/containerd/api/types;types"; -message MetricsRequest { - repeated string filters = 1; -} - -message MetricsResponse { - repeated Metric metrics = 1; -} - message Metric { google.protobuf.Timestamp timestamp = 1 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; string id = 2; diff --git a/linux/runtime.go b/linux/runtime.go index 9b852d970..3ee8bf635 100644 --- a/linux/runtime.go +++ b/linux/runtime.go @@ -344,13 +344,13 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) { filepath.Join(r.state, ns, id), filepath.Join(r.root, ns, id), ) + pid, _ := runc.ReadPidFile(filepath.Join(bundle.path, client.InitPidFile)) s, err := bundle.NewShimClient(ctx, ns, ShimConnect(), nil) if err != nil { log.G(ctx).WithError(err).WithFields(logrus.Fields{ "id": id, "namespace": ns, }).Error("connecting to shim") - pid, _ := runc.ReadPidFile(filepath.Join(bundle.path, client.InitPidFile)) err := r.cleanupAfterDeadShim(ctx, bundle, ns, id, pid, nil) if err != nil { log.G(ctx).WithError(err).WithField("bundle", bundle.path). @@ -358,11 +358,13 @@ func (r *Runtime) loadTasks(ctx context.Context, ns string) ([]*Task, error) { } continue } - o = append(o, &Task{ - id: id, - shim: s, - namespace: ns, - }) + + t, err := newTask(id, ns, pid, s) + if err != nil { + log.G(ctx).WithError(err).Error("loading task type") + continue + } + o = append(o, t) } return o, nil } diff --git a/services/tasks/service.go b/services/tasks/service.go index 56686ab3e..1198af84d 100644 --- a/services/tasks/service.go +++ b/services/tasks/service.go @@ -457,12 +457,12 @@ func (s *Service) Update(ctx context.Context, r *api.UpdateTaskRequest) (*google return empty, nil } -func (s *Service) Metrics(ctx context.Context, r *types.MetricsRequest) (*types.MetricsResponse, error) { +func (s *Service) Metrics(ctx context.Context, r *api.MetricsRequest) (*api.MetricsResponse, error) { filter, err := filters.ParseAll(r.Filters...) if err != nil { return nil, err } - var resp types.MetricsResponse + var resp api.MetricsResponse for _, r := range s.runtimes { tasks, err := r.Tasks(ctx) if err != nil { @@ -473,7 +473,7 @@ func (s *Service) Metrics(ctx context.Context, r *types.MetricsRequest) (*types. return &resp, nil } -func getTasksMetrics(ctx context.Context, filter filters.Filter, tasks []runtime.Task, r *types.MetricsResponse) { +func getTasksMetrics(ctx context.Context, filter filters.Filter, tasks []runtime.Task, r *api.MetricsResponse) { for _, tk := range tasks { if !filter.Match(filters.AdapterFunc(func(fieldpath []string) (string, bool) { t := tk diff --git a/task.go b/task.go index 1da9a77c9..779b299ef 100644 --- a/task.go +++ b/task.go @@ -475,7 +475,7 @@ func (t *task) LoadProcess(ctx context.Context, id string, ioAttach IOAttach) (P } func (t *task) Metrics(ctx context.Context) (*types.Metric, error) { - response, err := t.client.TaskService().Metrics(ctx, &types.MetricsRequest{ + response, err := t.client.TaskService().Metrics(ctx, &tasks.MetricsRequest{ Filters: []string{ "id==" + t.id, }, From 2ed3c62e2702128f271a8f03d04565ef74a282ee Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Wed, 6 Sep 2017 16:18:02 -0400 Subject: [PATCH 8/8] Update cgroups to 5933ab4dc4f7caa3a73a1dc141bd11f4 Signed-off-by: Michael Crosby --- metrics/cgroups/cpu.go | 28 +- metrics/cgroups/hugetlb.go | 12 +- metrics/cgroups/memory.go | 16 +- metrics/cgroups/metrics.go | 2 +- task.go | 4 + vendor.conf | 2 +- vendor/github.com/containerd/cgroups/blkio.go | 12 +- .../github.com/containerd/cgroups/cgroup.go | 4 +- vendor/github.com/containerd/cgroups/cpu.go | 6 +- .../github.com/containerd/cgroups/cpuacct.go | 8 +- .../github.com/containerd/cgroups/hugetlb.go | 7 +- .../github.com/containerd/cgroups/memory.go | 12 +- .../containerd/cgroups/metrics.pb.go | 4486 ++++++++++++++--- .../containerd/cgroups/metrics.proto | 50 +- 14 files changed, 3861 insertions(+), 788 deletions(-) diff --git a/metrics/cgroups/cpu.go b/metrics/cgroups/cpu.go index 47b593955..ed1a31498 100644 --- a/metrics/cgroups/cpu.go +++ b/metrics/cgroups/cpu.go @@ -17,12 +17,12 @@ var cpuMetrics = []*metric{ unit: metrics.Nanoseconds, vt: prometheus.GaugeValue, getValues: func(stats *cgroups.Metrics) []value { - if stats.Cpu == nil { + if stats.CPU == nil { return nil } return []value{ { - v: float64(stats.Cpu.Usage.Total), + v: float64(stats.CPU.Usage.Total), }, } }, @@ -33,12 +33,12 @@ var cpuMetrics = []*metric{ unit: metrics.Nanoseconds, vt: prometheus.GaugeValue, getValues: func(stats *cgroups.Metrics) []value { - if stats.Cpu == nil { + if stats.CPU == nil { return nil } return []value{ { - v: float64(stats.Cpu.Usage.Kernel), + v: float64(stats.CPU.Usage.Kernel), }, } }, @@ -49,12 +49,12 @@ var cpuMetrics = []*metric{ unit: metrics.Nanoseconds, vt: prometheus.GaugeValue, getValues: func(stats *cgroups.Metrics) []value { - if stats.Cpu == nil { + if stats.CPU == nil { return nil } return []value{ { - v: float64(stats.Cpu.Usage.User), + v: float64(stats.CPU.Usage.User), }, } }, @@ -66,11 +66,11 @@ var cpuMetrics = []*metric{ vt: prometheus.GaugeValue, labels: []string{"cpu"}, getValues: func(stats *cgroups.Metrics) []value { - if stats.Cpu == nil { + if stats.CPU == nil { return nil } var out []value - for i, v := range stats.Cpu.Usage.PerCpu { + for i, v := range stats.CPU.Usage.PerCPU { out = append(out, value{ v: float64(v), l: []string{strconv.Itoa(i)}, @@ -85,12 +85,12 @@ var cpuMetrics = []*metric{ unit: metrics.Total, vt: prometheus.GaugeValue, getValues: func(stats *cgroups.Metrics) []value { - if stats.Cpu == nil { + if stats.CPU == nil { return nil } return []value{ { - v: float64(stats.Cpu.Throttling.Periods), + v: float64(stats.CPU.Throttling.Periods), }, } }, @@ -101,12 +101,12 @@ var cpuMetrics = []*metric{ unit: metrics.Total, vt: prometheus.GaugeValue, getValues: func(stats *cgroups.Metrics) []value { - if stats.Cpu == nil { + if stats.CPU == nil { return nil } return []value{ { - v: float64(stats.Cpu.Throttling.ThrottledPeriods), + v: float64(stats.CPU.Throttling.ThrottledPeriods), }, } }, @@ -117,12 +117,12 @@ var cpuMetrics = []*metric{ unit: metrics.Nanoseconds, vt: prometheus.GaugeValue, getValues: func(stats *cgroups.Metrics) []value { - if stats.Cpu == nil { + if stats.CPU == nil { return nil } return []value{ { - v: float64(stats.Cpu.Throttling.ThrottledTime), + v: float64(stats.CPU.Throttling.ThrottledTime), }, } }, diff --git a/metrics/cgroups/hugetlb.go b/metrics/cgroups/hugetlb.go index 75cfb17d7..eec95aa70 100644 --- a/metrics/cgroups/hugetlb.go +++ b/metrics/cgroups/hugetlb.go @@ -20,10 +20,10 @@ var hugetlbMetrics = []*metric{ return nil } var out []value - for page, v := range stats.Hugetlb { + for _, v := range stats.Hugetlb { out = append(out, value{ v: float64(v.Usage), - l: []string{page}, + l: []string{v.Pagesize}, }) } return out @@ -40,10 +40,10 @@ var hugetlbMetrics = []*metric{ return nil } var out []value - for page, v := range stats.Hugetlb { + for _, v := range stats.Hugetlb { out = append(out, value{ v: float64(v.Failcnt), - l: []string{page}, + l: []string{v.Pagesize}, }) } return out @@ -60,10 +60,10 @@ var hugetlbMetrics = []*metric{ return nil } var out []value - for page, v := range stats.Hugetlb { + for _, v := range stats.Hugetlb { out = append(out, value{ v: float64(v.Max), - l: []string{page}, + l: []string{v.Pagesize}, }) } return out diff --git a/metrics/cgroups/memory.go b/metrics/cgroups/memory.go index 27b574b64..9613a4432 100644 --- a/metrics/cgroups/memory.go +++ b/metrics/cgroups/memory.go @@ -36,7 +36,7 @@ var memoryMetrics = []*metric{ } return []value{ { - v: float64(stats.Memory.Rss), + v: float64(stats.Memory.RSS), }, } }, @@ -52,7 +52,7 @@ var memoryMetrics = []*metric{ } return []value{ { - v: float64(stats.Memory.RssHuge), + v: float64(stats.Memory.RSSHuge), }, } }, @@ -308,7 +308,7 @@ var memoryMetrics = []*metric{ } return []value{ { - v: float64(stats.Memory.TotalRss), + v: float64(stats.Memory.TotalRSS), }, } }, @@ -324,7 +324,7 @@ var memoryMetrics = []*metric{ } return []value{ { - v: float64(stats.Memory.TotalRssHuge), + v: float64(stats.Memory.TotalRSSHuge), }, } }, @@ -724,7 +724,7 @@ var memoryMetrics = []*metric{ } return []value{ { - v: float64(stats.Memory.KernelTcp.Failcnt), + v: float64(stats.Memory.KernelTCP.Failcnt), }, } }, @@ -740,7 +740,7 @@ var memoryMetrics = []*metric{ } return []value{ { - v: float64(stats.Memory.KernelTcp.Limit), + v: float64(stats.Memory.KernelTCP.Limit), }, } }, @@ -756,7 +756,7 @@ var memoryMetrics = []*metric{ } return []value{ { - v: float64(stats.Memory.KernelTcp.Max), + v: float64(stats.Memory.KernelTCP.Max), }, } }, @@ -772,7 +772,7 @@ var memoryMetrics = []*metric{ } return []value{ { - v: float64(stats.Memory.KernelTcp.Usage), + v: float64(stats.Memory.KernelTCP.Usage), }, } }, diff --git a/metrics/cgroups/metrics.go b/metrics/cgroups/metrics.go index 6e8b8257c..3039b8d58 100644 --- a/metrics/cgroups/metrics.go +++ b/metrics/cgroups/metrics.go @@ -123,7 +123,7 @@ func (c *Collector) Remove(id, namespace string) { delete(c.cgroups, taskID(id, namespace)) } -func blkioValues(l []*cgroups.BlkioEntry) []value { +func blkioValues(l []*cgroups.BlkIOEntry) []value { var out []value for _, e := range l { out = append(out, value{ diff --git a/task.go b/task.go index 779b299ef..12cea56a8 100644 --- a/task.go +++ b/task.go @@ -119,6 +119,10 @@ type Task interface { // LoadProcess loads a previously created exec'd process LoadProcess(context.Context, string, IOAttach) (Process, error) // Metrics returns task metrics for runtime specific metrics + // + // The metric types are generic to containerd and change depending on the runtime + // For the built in Linux runtime, github.com/containerd/cgroups.Metrics + // are returned in protobuf format Metrics(context.Context) (*types.Metric, error) } diff --git a/vendor.conf b/vendor.conf index a42e331c3..b6944e38c 100644 --- a/vendor.conf +++ b/vendor.conf @@ -1,7 +1,7 @@ github.com/coreos/go-systemd 48702e0da86bd25e76cfef347e2adeb434a0d0a6 github.com/containerd/go-runc ba22f6a82e52be3be4eb4a00000fe816f4b41c2e github.com/containerd/console 76d18fd1d66972718ab2284449591db0b3cdb4de -github.com/containerd/cgroups 4be134fe43b9e207558365ad2675546b4910f696 +github.com/containerd/cgroups 5933ab4dc4f7caa3a73a1dc141bd11f42b5c9163 github.com/docker/go-metrics 8fd5772bf1584597834c6f7961a530f06cbfbb87 github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9 github.com/godbus/dbus c7fdd8b5cd55e87b4e1f4e372cdb1db61dd6c66f diff --git a/vendor/github.com/containerd/cgroups/blkio.go b/vendor/github.com/containerd/cgroups/blkio.go index 88f9ce9b2..078d12b2a 100644 --- a/vendor/github.com/containerd/cgroups/blkio.go +++ b/vendor/github.com/containerd/cgroups/blkio.go @@ -57,7 +57,7 @@ func (b *blkioController) Update(path string, resources *specs.LinuxResources) e } func (b *blkioController) Stat(path string, stats *Metrics) error { - stats.Blkio = &BlkioStat{} + stats.Blkio = &BlkIOStat{} settings := []blkioStatSettings{ { name: "throttle.io_serviced", @@ -119,7 +119,7 @@ func (b *blkioController) Stat(path string, stats *Metrics) error { return nil } -func (b *blkioController) readEntry(devices map[deviceKey]string, path, name string, entry *[]*BlkioEntry) error { +func (b *blkioController) readEntry(devices map[deviceKey]string, path, name string, entry *[]*BlkIOEntry) error { f, err := os.Open(filepath.Join(b.Path(path), fmt.Sprintf("blkio.%s", name))) if err != nil { return err @@ -131,7 +131,7 @@ func (b *blkioController) readEntry(devices map[deviceKey]string, path, name str return err } // format: dev type amount - fields := strings.FieldsFunc(sc.Text(), splitBlkioStatLine) + fields := strings.FieldsFunc(sc.Text(), splitBlkIOStatLine) if len(fields) < 3 { if len(fields) == 2 && fields[0] == "Total" { // skip total line @@ -158,7 +158,7 @@ func (b *blkioController) readEntry(devices map[deviceKey]string, path, name str if err != nil { return err } - *entry = append(*entry, &BlkioEntry{ + *entry = append(*entry, &BlkIOEntry{ Device: devices[deviceKey{major, minor}], Major: major, Minor: minor, @@ -235,7 +235,7 @@ type blkioSettings struct { type blkioStatSettings struct { name string - entry *[]*BlkioEntry + entry *[]*BlkIOEntry } func uintf(v interface{}) []byte { @@ -257,7 +257,7 @@ func throttleddev(v interface{}) []byte { return []byte(fmt.Sprintf("%d:%d %d", td.Major, td.Minor, td.Rate)) } -func splitBlkioStatLine(r rune) bool { +func splitBlkIOStatLine(r rune) bool { return r == ' ' || r == ':' } diff --git a/vendor/github.com/containerd/cgroups/cgroup.go b/vendor/github.com/containerd/cgroups/cgroup.go index 8094faf5d..694e22305 100644 --- a/vendor/github.com/containerd/cgroups/cgroup.go +++ b/vendor/github.com/containerd/cgroups/cgroup.go @@ -166,9 +166,9 @@ func (c *cgroup) Stat(handlers ...ErrorHandler) (*Metrics, error) { } var ( stats = &Metrics{ - Cpu: &CpuStat{ + CPU: &CPUStat{ Throttling: &Throttle{}, - Usage: &CpuUsage{}, + Usage: &CPUUsage{}, }, } wg = &sync.WaitGroup{} diff --git a/vendor/github.com/containerd/cgroups/cpu.go b/vendor/github.com/containerd/cgroups/cpu.go index 54bcef648..7df1b1cdf 100644 --- a/vendor/github.com/containerd/cgroups/cpu.go +++ b/vendor/github.com/containerd/cgroups/cpu.go @@ -102,11 +102,11 @@ func (c *cpuController) Stat(path string, stats *Metrics) error { } switch key { case "nr_periods": - stats.Cpu.Throttling.Periods = v + stats.CPU.Throttling.Periods = v case "nr_throttled": - stats.Cpu.Throttling.ThrottledPeriods = v + stats.CPU.Throttling.ThrottledPeriods = v case "throttled_time": - stats.Cpu.Throttling.ThrottledTime = v + stats.CPU.Throttling.ThrottledTime = v } } return nil diff --git a/vendor/github.com/containerd/cgroups/cpuacct.go b/vendor/github.com/containerd/cgroups/cpuacct.go index 58fbbdf4e..443692d21 100644 --- a/vendor/github.com/containerd/cgroups/cpuacct.go +++ b/vendor/github.com/containerd/cgroups/cpuacct.go @@ -43,10 +43,10 @@ func (c *cpuacctController) Stat(path string, stats *Metrics) error { if err != nil { return err } - stats.Cpu.Usage.Total = total - stats.Cpu.Usage.User = user - stats.Cpu.Usage.Kernel = kernel - stats.Cpu.Usage.PerCpu = percpu + stats.CPU.Usage.Total = total + stats.CPU.Usage.User = user + stats.CPU.Usage.Kernel = kernel + stats.CPU.Usage.PerCPU = percpu return nil } diff --git a/vendor/github.com/containerd/cgroups/hugetlb.go b/vendor/github.com/containerd/cgroups/hugetlb.go index 20241b0d2..af75e1b8e 100644 --- a/vendor/github.com/containerd/cgroups/hugetlb.go +++ b/vendor/github.com/containerd/cgroups/hugetlb.go @@ -52,19 +52,20 @@ func (h *hugetlbController) Create(path string, resources *specs.LinuxResources) } func (h *hugetlbController) Stat(path string, stats *Metrics) error { - stats.Hugetlb = make(map[string]*HugetlbStat) for _, size := range h.sizes { s, err := h.readSizeStat(path, size) if err != nil { return err } - stats.Hugetlb[size] = s + stats.Hugetlb = append(stats.Hugetlb, s) } return nil } func (h *hugetlbController) readSizeStat(path, size string) (*HugetlbStat, error) { - var s HugetlbStat + s := HugetlbStat{ + Pagesize: size, + } for _, t := range []struct { name string value *uint64 diff --git a/vendor/github.com/containerd/cgroups/memory.go b/vendor/github.com/containerd/cgroups/memory.go index 1f7c1159a..3fee605a9 100644 --- a/vendor/github.com/containerd/cgroups/memory.go +++ b/vendor/github.com/containerd/cgroups/memory.go @@ -91,7 +91,7 @@ func (m *memoryController) Stat(path string, stats *Metrics) error { Usage: &MemoryEntry{}, Swap: &MemoryEntry{}, Kernel: &MemoryEntry{}, - KernelTcp: &MemoryEntry{}, + KernelTCP: &MemoryEntry{}, } if err := m.parseStats(f, stats.Memory); err != nil { return err @@ -114,7 +114,7 @@ func (m *memoryController) Stat(path string, stats *Metrics) error { }, { module: "kmem.tcp", - entry: stats.Memory.KernelTcp, + entry: stats.Memory.KernelTCP, }, } { for _, tt := range []struct { @@ -199,8 +199,8 @@ func (m *memoryController) parseStats(r io.Reader, stat *MemoryStat) error { line++ } stat.Cache = raw["cache"] - stat.Rss = raw["rss"] - stat.RssHuge = raw["rss_huge"] + stat.RSS = raw["rss"] + stat.RSSHuge = raw["rss_huge"] stat.MappedFile = raw["mapped_file"] stat.Dirty = raw["dirty"] stat.Writeback = raw["writeback"] @@ -216,8 +216,8 @@ func (m *memoryController) parseStats(r io.Reader, stat *MemoryStat) error { stat.HierarchicalMemoryLimit = raw["hierarchical_memory_limit"] stat.HierarchicalSwapLimit = raw["hierarchical_memsw_limit"] stat.TotalCache = raw["total_cache"] - stat.TotalRss = raw["total_rss"] - stat.TotalRssHuge = raw["total_rss_huge"] + stat.TotalRSS = raw["total_rss"] + stat.TotalRSSHuge = raw["total_rss_huge"] stat.TotalMappedFile = raw["total_mapped_file"] stat.TotalDirty = raw["total_dirty"] stat.TotalWriteback = raw["total_writeback"] diff --git a/vendor/github.com/containerd/cgroups/metrics.pb.go b/vendor/github.com/containerd/cgroups/metrics.pb.go index 2ec1ed5d6..c1125588a 100644 --- a/vendor/github.com/containerd/cgroups/metrics.pb.go +++ b/vendor/github.com/containerd/cgroups/metrics.pb.go @@ -1,29 +1,36 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: metrics.proto +// Code generated by protoc-gen-gogo. +// source: github.com/containerd/cgroups/metrics.proto +// DO NOT EDIT! /* -Package cgroups is a generated protocol buffer package. + Package cgroups is a generated protocol buffer package. -It is generated from these files: - metrics.proto + It is generated from these files: + github.com/containerd/cgroups/metrics.proto -It has these top-level messages: - Metrics - HugetlbStat - PidsStat - CpuStat - CpuUsage - Throttle - MemoryStat - MemoryEntry - BlkioStat - BlkioEntry + It has these top-level messages: + Metrics + HugetlbStat + PidsStat + CPUStat + CPUUsage + Throttle + MemoryStat + MemoryEntry + BlkIOStat + BlkIOEntry */ package cgroups -import proto "github.com/golang/protobuf/proto" +import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" +import _ "github.com/gogo/protobuf/gogoproto" + +import strings "strings" +import reflect "reflect" + +import io "io" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -34,754 +41,3811 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package type Metrics struct { - Hugetlb map[string]*HugetlbStat `protobuf:"bytes,1,rep,name=hugetlb" json:"hugetlb,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - Pids *PidsStat `protobuf:"bytes,2,opt,name=pids" json:"pids,omitempty"` - Cpu *CpuStat `protobuf:"bytes,3,opt,name=cpu" json:"cpu,omitempty"` - Memory *MemoryStat `protobuf:"bytes,4,opt,name=memory" json:"memory,omitempty"` - Blkio *BlkioStat `protobuf:"bytes,5,opt,name=blkio" json:"blkio,omitempty"` + Hugetlb []*HugetlbStat `protobuf:"bytes,1,rep,name=hugetlb" json:"hugetlb,omitempty"` + Pids *PidsStat `protobuf:"bytes,2,opt,name=pids" json:"pids,omitempty"` + CPU *CPUStat `protobuf:"bytes,3,opt,name=cpu" json:"cpu,omitempty"` + Memory *MemoryStat `protobuf:"bytes,4,opt,name=memory" json:"memory,omitempty"` + Blkio *BlkIOStat `protobuf:"bytes,5,opt,name=blkio" json:"blkio,omitempty"` } func (m *Metrics) Reset() { *m = Metrics{} } -func (m *Metrics) String() string { return proto.CompactTextString(m) } func (*Metrics) ProtoMessage() {} -func (*Metrics) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -func (m *Metrics) GetHugetlb() map[string]*HugetlbStat { - if m != nil { - return m.Hugetlb - } - return nil -} - -func (m *Metrics) GetPids() *PidsStat { - if m != nil { - return m.Pids - } - return nil -} - -func (m *Metrics) GetCpu() *CpuStat { - if m != nil { - return m.Cpu - } - return nil -} - -func (m *Metrics) GetMemory() *MemoryStat { - if m != nil { - return m.Memory - } - return nil -} - -func (m *Metrics) GetBlkio() *BlkioStat { - if m != nil { - return m.Blkio - } - return nil -} +func (*Metrics) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{0} } type HugetlbStat struct { - Usage uint64 `protobuf:"varint,1,opt,name=usage" json:"usage,omitempty"` - Max uint64 `protobuf:"varint,2,opt,name=max" json:"max,omitempty"` - Failcnt uint64 `protobuf:"varint,3,opt,name=failcnt" json:"failcnt,omitempty"` + Usage uint64 `protobuf:"varint,1,opt,name=usage,proto3" json:"usage,omitempty"` + Max uint64 `protobuf:"varint,2,opt,name=max,proto3" json:"max,omitempty"` + Failcnt uint64 `protobuf:"varint,3,opt,name=failcnt,proto3" json:"failcnt,omitempty"` + Pagesize string `protobuf:"bytes,4,opt,name=pagesize,proto3" json:"pagesize,omitempty"` } func (m *HugetlbStat) Reset() { *m = HugetlbStat{} } -func (m *HugetlbStat) String() string { return proto.CompactTextString(m) } func (*HugetlbStat) ProtoMessage() {} -func (*HugetlbStat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -func (m *HugetlbStat) GetUsage() uint64 { - if m != nil { - return m.Usage - } - return 0 -} - -func (m *HugetlbStat) GetMax() uint64 { - if m != nil { - return m.Max - } - return 0 -} - -func (m *HugetlbStat) GetFailcnt() uint64 { - if m != nil { - return m.Failcnt - } - return 0 -} +func (*HugetlbStat) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{1} } type PidsStat struct { - Current uint64 `protobuf:"varint,1,opt,name=current" json:"current,omitempty"` - Limit uint64 `protobuf:"varint,2,opt,name=limit" json:"limit,omitempty"` + Current uint64 `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"` + Limit uint64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` } func (m *PidsStat) Reset() { *m = PidsStat{} } -func (m *PidsStat) String() string { return proto.CompactTextString(m) } func (*PidsStat) ProtoMessage() {} -func (*PidsStat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +func (*PidsStat) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{2} } -func (m *PidsStat) GetCurrent() uint64 { - if m != nil { - return m.Current - } - return 0 -} - -func (m *PidsStat) GetLimit() uint64 { - if m != nil { - return m.Limit - } - return 0 -} - -type CpuStat struct { - Usage *CpuUsage `protobuf:"bytes,1,opt,name=usage" json:"usage,omitempty"` +type CPUStat struct { + Usage *CPUUsage `protobuf:"bytes,1,opt,name=usage" json:"usage,omitempty"` Throttling *Throttle `protobuf:"bytes,2,opt,name=throttling" json:"throttling,omitempty"` } -func (m *CpuStat) Reset() { *m = CpuStat{} } -func (m *CpuStat) String() string { return proto.CompactTextString(m) } -func (*CpuStat) ProtoMessage() {} -func (*CpuStat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +func (m *CPUStat) Reset() { *m = CPUStat{} } +func (*CPUStat) ProtoMessage() {} +func (*CPUStat) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{3} } -func (m *CpuStat) GetUsage() *CpuUsage { - if m != nil { - return m.Usage - } - return nil -} - -func (m *CpuStat) GetThrottling() *Throttle { - if m != nil { - return m.Throttling - } - return nil -} - -type CpuUsage struct { +type CPUUsage struct { // values in nanoseconds - Total uint64 `protobuf:"varint,1,opt,name=total" json:"total,omitempty"` - Kernel uint64 `protobuf:"varint,2,opt,name=kernel" json:"kernel,omitempty"` - User uint64 `protobuf:"varint,3,opt,name=user" json:"user,omitempty"` - PerCpu []uint64 `protobuf:"varint,4,rep,packed,name=per_cpu,json=perCpu" json:"per_cpu,omitempty"` + Total uint64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + Kernel uint64 `protobuf:"varint,2,opt,name=kernel,proto3" json:"kernel,omitempty"` + User uint64 `protobuf:"varint,3,opt,name=user,proto3" json:"user,omitempty"` + PerCPU []uint64 `protobuf:"varint,4,rep,packed,name=per_cpu,json=perCpu" json:"per_cpu,omitempty"` } -func (m *CpuUsage) Reset() { *m = CpuUsage{} } -func (m *CpuUsage) String() string { return proto.CompactTextString(m) } -func (*CpuUsage) ProtoMessage() {} -func (*CpuUsage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } - -func (m *CpuUsage) GetTotal() uint64 { - if m != nil { - return m.Total - } - return 0 -} - -func (m *CpuUsage) GetKernel() uint64 { - if m != nil { - return m.Kernel - } - return 0 -} - -func (m *CpuUsage) GetUser() uint64 { - if m != nil { - return m.User - } - return 0 -} - -func (m *CpuUsage) GetPerCpu() []uint64 { - if m != nil { - return m.PerCpu - } - return nil -} +func (m *CPUUsage) Reset() { *m = CPUUsage{} } +func (*CPUUsage) ProtoMessage() {} +func (*CPUUsage) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{4} } type Throttle struct { - Periods uint64 `protobuf:"varint,1,opt,name=periods" json:"periods,omitempty"` - ThrottledPeriods uint64 `protobuf:"varint,2,opt,name=throttled_periods,json=throttledPeriods" json:"throttled_periods,omitempty"` - ThrottledTime uint64 `protobuf:"varint,3,opt,name=throttled_time,json=throttledTime" json:"throttled_time,omitempty"` + Periods uint64 `protobuf:"varint,1,opt,name=periods,proto3" json:"periods,omitempty"` + ThrottledPeriods uint64 `protobuf:"varint,2,opt,name=throttled_periods,json=throttledPeriods,proto3" json:"throttled_periods,omitempty"` + ThrottledTime uint64 `protobuf:"varint,3,opt,name=throttled_time,json=throttledTime,proto3" json:"throttled_time,omitempty"` } func (m *Throttle) Reset() { *m = Throttle{} } -func (m *Throttle) String() string { return proto.CompactTextString(m) } func (*Throttle) ProtoMessage() {} -func (*Throttle) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } - -func (m *Throttle) GetPeriods() uint64 { - if m != nil { - return m.Periods - } - return 0 -} - -func (m *Throttle) GetThrottledPeriods() uint64 { - if m != nil { - return m.ThrottledPeriods - } - return 0 -} - -func (m *Throttle) GetThrottledTime() uint64 { - if m != nil { - return m.ThrottledTime - } - return 0 -} +func (*Throttle) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{5} } type MemoryStat struct { - Cache uint64 `protobuf:"varint,1,opt,name=cache" json:"cache,omitempty"` - Rss uint64 `protobuf:"varint,2,opt,name=rss" json:"rss,omitempty"` - RssHuge uint64 `protobuf:"varint,3,opt,name=rss_huge,json=rssHuge" json:"rss_huge,omitempty"` - MappedFile uint64 `protobuf:"varint,4,opt,name=mapped_file,json=mappedFile" json:"mapped_file,omitempty"` - Dirty uint64 `protobuf:"varint,5,opt,name=dirty" json:"dirty,omitempty"` - Writeback uint64 `protobuf:"varint,6,opt,name=writeback" json:"writeback,omitempty"` - PgPgIn uint64 `protobuf:"varint,7,opt,name=pg_pg_in,json=pgPgIn" json:"pg_pg_in,omitempty"` - PgPgOut uint64 `protobuf:"varint,8,opt,name=pg_pg_out,json=pgPgOut" json:"pg_pg_out,omitempty"` - PgFault uint64 `protobuf:"varint,9,opt,name=pg_fault,json=pgFault" json:"pg_fault,omitempty"` - PgMajFault uint64 `protobuf:"varint,10,opt,name=pg_maj_fault,json=pgMajFault" json:"pg_maj_fault,omitempty"` - InactiveAnon uint64 `protobuf:"varint,11,opt,name=inactive_anon,json=inactiveAnon" json:"inactive_anon,omitempty"` - ActiveAnon uint64 `protobuf:"varint,12,opt,name=active_anon,json=activeAnon" json:"active_anon,omitempty"` - InactiveFile uint64 `protobuf:"varint,13,opt,name=inactive_file,json=inactiveFile" json:"inactive_file,omitempty"` - ActiveFile uint64 `protobuf:"varint,14,opt,name=active_file,json=activeFile" json:"active_file,omitempty"` - Unevictable uint64 `protobuf:"varint,15,opt,name=unevictable" json:"unevictable,omitempty"` - HierarchicalMemoryLimit uint64 `protobuf:"varint,16,opt,name=hierarchical_memory_limit,json=hierarchicalMemoryLimit" json:"hierarchical_memory_limit,omitempty"` - HierarchicalSwapLimit uint64 `protobuf:"varint,17,opt,name=hierarchical_swap_limit,json=hierarchicalSwapLimit" json:"hierarchical_swap_limit,omitempty"` - TotalCache uint64 `protobuf:"varint,18,opt,name=total_cache,json=totalCache" json:"total_cache,omitempty"` - TotalRss uint64 `protobuf:"varint,19,opt,name=total_rss,json=totalRss" json:"total_rss,omitempty"` - TotalRssHuge uint64 `protobuf:"varint,20,opt,name=total_rss_huge,json=totalRssHuge" json:"total_rss_huge,omitempty"` - TotalMappedFile uint64 `protobuf:"varint,21,opt,name=total_mapped_file,json=totalMappedFile" json:"total_mapped_file,omitempty"` - TotalDirty uint64 `protobuf:"varint,22,opt,name=total_dirty,json=totalDirty" json:"total_dirty,omitempty"` - TotalWriteback uint64 `protobuf:"varint,23,opt,name=total_writeback,json=totalWriteback" json:"total_writeback,omitempty"` - TotalPgPgIn uint64 `protobuf:"varint,24,opt,name=total_pg_pg_in,json=totalPgPgIn" json:"total_pg_pg_in,omitempty"` - TotalPgPgOut uint64 `protobuf:"varint,25,opt,name=total_pg_pg_out,json=totalPgPgOut" json:"total_pg_pg_out,omitempty"` - TotalPgFault uint64 `protobuf:"varint,26,opt,name=total_pg_fault,json=totalPgFault" json:"total_pg_fault,omitempty"` - TotalPgMajFault uint64 `protobuf:"varint,27,opt,name=total_pg_maj_fault,json=totalPgMajFault" json:"total_pg_maj_fault,omitempty"` - TotalInactiveAnon uint64 `protobuf:"varint,28,opt,name=total_inactive_anon,json=totalInactiveAnon" json:"total_inactive_anon,omitempty"` - TotalActiveAnon uint64 `protobuf:"varint,29,opt,name=total_active_anon,json=totalActiveAnon" json:"total_active_anon,omitempty"` - TotalInactiveFile uint64 `protobuf:"varint,30,opt,name=total_inactive_file,json=totalInactiveFile" json:"total_inactive_file,omitempty"` - TotalActiveFile uint64 `protobuf:"varint,31,opt,name=total_active_file,json=totalActiveFile" json:"total_active_file,omitempty"` - TotalUnevictable uint64 `protobuf:"varint,32,opt,name=total_unevictable,json=totalUnevictable" json:"total_unevictable,omitempty"` + Cache uint64 `protobuf:"varint,1,opt,name=cache,proto3" json:"cache,omitempty"` + RSS uint64 `protobuf:"varint,2,opt,name=rss,proto3" json:"rss,omitempty"` + RSSHuge uint64 `protobuf:"varint,3,opt,name=rss_huge,json=rssHuge,proto3" json:"rss_huge,omitempty"` + MappedFile uint64 `protobuf:"varint,4,opt,name=mapped_file,json=mappedFile,proto3" json:"mapped_file,omitempty"` + Dirty uint64 `protobuf:"varint,5,opt,name=dirty,proto3" json:"dirty,omitempty"` + Writeback uint64 `protobuf:"varint,6,opt,name=writeback,proto3" json:"writeback,omitempty"` + PgPgIn uint64 `protobuf:"varint,7,opt,name=pg_pg_in,json=pgPgIn,proto3" json:"pg_pg_in,omitempty"` + PgPgOut uint64 `protobuf:"varint,8,opt,name=pg_pg_out,json=pgPgOut,proto3" json:"pg_pg_out,omitempty"` + PgFault uint64 `protobuf:"varint,9,opt,name=pg_fault,json=pgFault,proto3" json:"pg_fault,omitempty"` + PgMajFault uint64 `protobuf:"varint,10,opt,name=pg_maj_fault,json=pgMajFault,proto3" json:"pg_maj_fault,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"` + HierarchicalMemoryLimit uint64 `protobuf:"varint,16,opt,name=hierarchical_memory_limit,json=hierarchicalMemoryLimit,proto3" json:"hierarchical_memory_limit,omitempty"` + HierarchicalSwapLimit uint64 `protobuf:"varint,17,opt,name=hierarchical_swap_limit,json=hierarchicalSwapLimit,proto3" json:"hierarchical_swap_limit,omitempty"` + TotalCache uint64 `protobuf:"varint,18,opt,name=total_cache,json=totalCache,proto3" json:"total_cache,omitempty"` + TotalRSS uint64 `protobuf:"varint,19,opt,name=total_rss,json=totalRss,proto3" json:"total_rss,omitempty"` + TotalRSSHuge uint64 `protobuf:"varint,20,opt,name=total_rss_huge,json=totalRssHuge,proto3" json:"total_rss_huge,omitempty"` + TotalMappedFile uint64 `protobuf:"varint,21,opt,name=total_mapped_file,json=totalMappedFile,proto3" json:"total_mapped_file,omitempty"` + TotalDirty uint64 `protobuf:"varint,22,opt,name=total_dirty,json=totalDirty,proto3" json:"total_dirty,omitempty"` + TotalWriteback uint64 `protobuf:"varint,23,opt,name=total_writeback,json=totalWriteback,proto3" json:"total_writeback,omitempty"` + TotalPgPgIn uint64 `protobuf:"varint,24,opt,name=total_pg_pg_in,json=totalPgPgIn,proto3" json:"total_pg_pg_in,omitempty"` + TotalPgPgOut uint64 `protobuf:"varint,25,opt,name=total_pg_pg_out,json=totalPgPgOut,proto3" json:"total_pg_pg_out,omitempty"` + TotalPgFault uint64 `protobuf:"varint,26,opt,name=total_pg_fault,json=totalPgFault,proto3" json:"total_pg_fault,omitempty"` + TotalPgMajFault uint64 `protobuf:"varint,27,opt,name=total_pg_maj_fault,json=totalPgMajFault,proto3" json:"total_pg_maj_fault,omitempty"` + TotalInactiveAnon uint64 `protobuf:"varint,28,opt,name=total_inactive_anon,json=totalInactiveAnon,proto3" json:"total_inactive_anon,omitempty"` + TotalActiveAnon uint64 `protobuf:"varint,29,opt,name=total_active_anon,json=totalActiveAnon,proto3" json:"total_active_anon,omitempty"` + TotalInactiveFile uint64 `protobuf:"varint,30,opt,name=total_inactive_file,json=totalInactiveFile,proto3" json:"total_inactive_file,omitempty"` + TotalActiveFile uint64 `protobuf:"varint,31,opt,name=total_active_file,json=totalActiveFile,proto3" json:"total_active_file,omitempty"` + TotalUnevictable uint64 `protobuf:"varint,32,opt,name=total_unevictable,json=totalUnevictable,proto3" json:"total_unevictable,omitempty"` Usage *MemoryEntry `protobuf:"bytes,33,opt,name=usage" json:"usage,omitempty"` Swap *MemoryEntry `protobuf:"bytes,34,opt,name=swap" json:"swap,omitempty"` Kernel *MemoryEntry `protobuf:"bytes,35,opt,name=kernel" json:"kernel,omitempty"` - KernelTcp *MemoryEntry `protobuf:"bytes,36,opt,name=kernel_tcp,json=kernelTcp" json:"kernel_tcp,omitempty"` + KernelTCP *MemoryEntry `protobuf:"bytes,36,opt,name=kernel_tcp,json=kernelTcp" json:"kernel_tcp,omitempty"` } func (m *MemoryStat) Reset() { *m = MemoryStat{} } -func (m *MemoryStat) String() string { return proto.CompactTextString(m) } func (*MemoryStat) ProtoMessage() {} -func (*MemoryStat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } - -func (m *MemoryStat) GetCache() uint64 { - if m != nil { - return m.Cache - } - return 0 -} - -func (m *MemoryStat) GetRss() uint64 { - if m != nil { - return m.Rss - } - return 0 -} - -func (m *MemoryStat) GetRssHuge() uint64 { - if m != nil { - return m.RssHuge - } - return 0 -} - -func (m *MemoryStat) GetMappedFile() uint64 { - if m != nil { - return m.MappedFile - } - return 0 -} - -func (m *MemoryStat) GetDirty() uint64 { - if m != nil { - return m.Dirty - } - return 0 -} - -func (m *MemoryStat) GetWriteback() uint64 { - if m != nil { - return m.Writeback - } - return 0 -} - -func (m *MemoryStat) GetPgPgIn() uint64 { - if m != nil { - return m.PgPgIn - } - return 0 -} - -func (m *MemoryStat) GetPgPgOut() uint64 { - if m != nil { - return m.PgPgOut - } - return 0 -} - -func (m *MemoryStat) GetPgFault() uint64 { - if m != nil { - return m.PgFault - } - return 0 -} - -func (m *MemoryStat) GetPgMajFault() uint64 { - if m != nil { - return m.PgMajFault - } - return 0 -} - -func (m *MemoryStat) GetInactiveAnon() uint64 { - if m != nil { - return m.InactiveAnon - } - return 0 -} - -func (m *MemoryStat) GetActiveAnon() uint64 { - if m != nil { - return m.ActiveAnon - } - return 0 -} - -func (m *MemoryStat) GetInactiveFile() uint64 { - if m != nil { - return m.InactiveFile - } - return 0 -} - -func (m *MemoryStat) GetActiveFile() uint64 { - if m != nil { - return m.ActiveFile - } - return 0 -} - -func (m *MemoryStat) GetUnevictable() uint64 { - if m != nil { - return m.Unevictable - } - return 0 -} - -func (m *MemoryStat) GetHierarchicalMemoryLimit() uint64 { - if m != nil { - return m.HierarchicalMemoryLimit - } - return 0 -} - -func (m *MemoryStat) GetHierarchicalSwapLimit() uint64 { - if m != nil { - return m.HierarchicalSwapLimit - } - return 0 -} - -func (m *MemoryStat) GetTotalCache() uint64 { - if m != nil { - return m.TotalCache - } - return 0 -} - -func (m *MemoryStat) GetTotalRss() uint64 { - if m != nil { - return m.TotalRss - } - return 0 -} - -func (m *MemoryStat) GetTotalRssHuge() uint64 { - if m != nil { - return m.TotalRssHuge - } - return 0 -} - -func (m *MemoryStat) GetTotalMappedFile() uint64 { - if m != nil { - return m.TotalMappedFile - } - return 0 -} - -func (m *MemoryStat) GetTotalDirty() uint64 { - if m != nil { - return m.TotalDirty - } - return 0 -} - -func (m *MemoryStat) GetTotalWriteback() uint64 { - if m != nil { - return m.TotalWriteback - } - return 0 -} - -func (m *MemoryStat) GetTotalPgPgIn() uint64 { - if m != nil { - return m.TotalPgPgIn - } - return 0 -} - -func (m *MemoryStat) GetTotalPgPgOut() uint64 { - if m != nil { - return m.TotalPgPgOut - } - return 0 -} - -func (m *MemoryStat) GetTotalPgFault() uint64 { - if m != nil { - return m.TotalPgFault - } - return 0 -} - -func (m *MemoryStat) GetTotalPgMajFault() uint64 { - if m != nil { - return m.TotalPgMajFault - } - return 0 -} - -func (m *MemoryStat) GetTotalInactiveAnon() uint64 { - if m != nil { - return m.TotalInactiveAnon - } - return 0 -} - -func (m *MemoryStat) GetTotalActiveAnon() uint64 { - if m != nil { - return m.TotalActiveAnon - } - return 0 -} - -func (m *MemoryStat) GetTotalInactiveFile() uint64 { - if m != nil { - return m.TotalInactiveFile - } - return 0 -} - -func (m *MemoryStat) GetTotalActiveFile() uint64 { - if m != nil { - return m.TotalActiveFile - } - return 0 -} - -func (m *MemoryStat) GetTotalUnevictable() uint64 { - if m != nil { - return m.TotalUnevictable - } - return 0 -} - -func (m *MemoryStat) GetUsage() *MemoryEntry { - if m != nil { - return m.Usage - } - return nil -} - -func (m *MemoryStat) GetSwap() *MemoryEntry { - if m != nil { - return m.Swap - } - return nil -} - -func (m *MemoryStat) GetKernel() *MemoryEntry { - if m != nil { - return m.Kernel - } - return nil -} - -func (m *MemoryStat) GetKernelTcp() *MemoryEntry { - if m != nil { - return m.KernelTcp - } - return nil -} +func (*MemoryStat) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{6} } type MemoryEntry struct { - Limit uint64 `protobuf:"varint,1,opt,name=limit" json:"limit,omitempty"` - Usage uint64 `protobuf:"varint,2,opt,name=usage" json:"usage,omitempty"` - Max uint64 `protobuf:"varint,3,opt,name=max" json:"max,omitempty"` - Failcnt uint64 `protobuf:"varint,4,opt,name=failcnt" json:"failcnt,omitempty"` + 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"` } func (m *MemoryEntry) Reset() { *m = MemoryEntry{} } -func (m *MemoryEntry) String() string { return proto.CompactTextString(m) } func (*MemoryEntry) ProtoMessage() {} -func (*MemoryEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } +func (*MemoryEntry) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{7} } -func (m *MemoryEntry) GetLimit() uint64 { - if m != nil { - return m.Limit - } - return 0 +type BlkIOStat struct { + IoServiceBytesRecursive []*BlkIOEntry `protobuf:"bytes,1,rep,name=io_service_bytes_recursive,json=ioServiceBytesRecursive" json:"io_service_bytes_recursive,omitempty"` + IoServicedRecursive []*BlkIOEntry `protobuf:"bytes,2,rep,name=io_serviced_recursive,json=ioServicedRecursive" json:"io_serviced_recursive,omitempty"` + IoQueuedRecursive []*BlkIOEntry `protobuf:"bytes,3,rep,name=io_queued_recursive,json=ioQueuedRecursive" json:"io_queued_recursive,omitempty"` + IoServiceTimeRecursive []*BlkIOEntry `protobuf:"bytes,4,rep,name=io_service_time_recursive,json=ioServiceTimeRecursive" json:"io_service_time_recursive,omitempty"` + IoWaitTimeRecursive []*BlkIOEntry `protobuf:"bytes,5,rep,name=io_wait_time_recursive,json=ioWaitTimeRecursive" json:"io_wait_time_recursive,omitempty"` + IoMergedRecursive []*BlkIOEntry `protobuf:"bytes,6,rep,name=io_merged_recursive,json=ioMergedRecursive" json:"io_merged_recursive,omitempty"` + IoTimeRecursive []*BlkIOEntry `protobuf:"bytes,7,rep,name=io_time_recursive,json=ioTimeRecursive" json:"io_time_recursive,omitempty"` + SectorsRecursive []*BlkIOEntry `protobuf:"bytes,8,rep,name=sectors_recursive,json=sectorsRecursive" json:"sectors_recursive,omitempty"` } -func (m *MemoryEntry) GetUsage() uint64 { - if m != nil { - return m.Usage - } - return 0 +func (m *BlkIOStat) Reset() { *m = BlkIOStat{} } +func (*BlkIOStat) ProtoMessage() {} +func (*BlkIOStat) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{8} } + +type BlkIOEntry struct { + Op string `protobuf:"bytes,1,opt,name=op,proto3" json:"op,omitempty"` + Device string `protobuf:"bytes,2,opt,name=device,proto3" json:"device,omitempty"` + Major uint64 `protobuf:"varint,3,opt,name=major,proto3" json:"major,omitempty"` + Minor uint64 `protobuf:"varint,4,opt,name=minor,proto3" json:"minor,omitempty"` + Value uint64 `protobuf:"varint,5,opt,name=value,proto3" json:"value,omitempty"` } -func (m *MemoryEntry) GetMax() uint64 { - if m != nil { - return m.Max - } - return 0 -} - -func (m *MemoryEntry) GetFailcnt() uint64 { - if m != nil { - return m.Failcnt - } - return 0 -} - -type BlkioStat struct { - IoServiceBytesRecursive []*BlkioEntry `protobuf:"bytes,1,rep,name=io_service_bytes_recursive,json=ioServiceBytesRecursive" json:"io_service_bytes_recursive,omitempty"` - IoServicedRecursive []*BlkioEntry `protobuf:"bytes,2,rep,name=io_serviced_recursive,json=ioServicedRecursive" json:"io_serviced_recursive,omitempty"` - IoQueuedRecursive []*BlkioEntry `protobuf:"bytes,3,rep,name=io_queued_recursive,json=ioQueuedRecursive" json:"io_queued_recursive,omitempty"` - IoServiceTimeRecursive []*BlkioEntry `protobuf:"bytes,4,rep,name=io_service_time_recursive,json=ioServiceTimeRecursive" json:"io_service_time_recursive,omitempty"` - IoWaitTimeRecursive []*BlkioEntry `protobuf:"bytes,5,rep,name=io_wait_time_recursive,json=ioWaitTimeRecursive" json:"io_wait_time_recursive,omitempty"` - IoMergedRecursive []*BlkioEntry `protobuf:"bytes,6,rep,name=io_merged_recursive,json=ioMergedRecursive" json:"io_merged_recursive,omitempty"` - IoTimeRecursive []*BlkioEntry `protobuf:"bytes,7,rep,name=io_time_recursive,json=ioTimeRecursive" json:"io_time_recursive,omitempty"` - SectorsRecursive []*BlkioEntry `protobuf:"bytes,8,rep,name=sectors_recursive,json=sectorsRecursive" json:"sectors_recursive,omitempty"` -} - -func (m *BlkioStat) Reset() { *m = BlkioStat{} } -func (m *BlkioStat) String() string { return proto.CompactTextString(m) } -func (*BlkioStat) ProtoMessage() {} -func (*BlkioStat) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } - -func (m *BlkioStat) GetIoServiceBytesRecursive() []*BlkioEntry { - if m != nil { - return m.IoServiceBytesRecursive - } - return nil -} - -func (m *BlkioStat) GetIoServicedRecursive() []*BlkioEntry { - if m != nil { - return m.IoServicedRecursive - } - return nil -} - -func (m *BlkioStat) GetIoQueuedRecursive() []*BlkioEntry { - if m != nil { - return m.IoQueuedRecursive - } - return nil -} - -func (m *BlkioStat) GetIoServiceTimeRecursive() []*BlkioEntry { - if m != nil { - return m.IoServiceTimeRecursive - } - return nil -} - -func (m *BlkioStat) GetIoWaitTimeRecursive() []*BlkioEntry { - if m != nil { - return m.IoWaitTimeRecursive - } - return nil -} - -func (m *BlkioStat) GetIoMergedRecursive() []*BlkioEntry { - if m != nil { - return m.IoMergedRecursive - } - return nil -} - -func (m *BlkioStat) GetIoTimeRecursive() []*BlkioEntry { - if m != nil { - return m.IoTimeRecursive - } - return nil -} - -func (m *BlkioStat) GetSectorsRecursive() []*BlkioEntry { - if m != nil { - return m.SectorsRecursive - } - return nil -} - -type BlkioEntry struct { - Op string `protobuf:"bytes,1,opt,name=op" json:"op,omitempty"` - Device string `protobuf:"bytes,2,opt,name=device" json:"device,omitempty"` - Major uint64 `protobuf:"varint,3,opt,name=major" json:"major,omitempty"` - Minor uint64 `protobuf:"varint,4,opt,name=minor" json:"minor,omitempty"` - Value uint64 `protobuf:"varint,5,opt,name=value" json:"value,omitempty"` -} - -func (m *BlkioEntry) Reset() { *m = BlkioEntry{} } -func (m *BlkioEntry) String() string { return proto.CompactTextString(m) } -func (*BlkioEntry) ProtoMessage() {} -func (*BlkioEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } - -func (m *BlkioEntry) GetOp() string { - if m != nil { - return m.Op - } - return "" -} - -func (m *BlkioEntry) GetDevice() string { - if m != nil { - return m.Device - } - return "" -} - -func (m *BlkioEntry) GetMajor() uint64 { - if m != nil { - return m.Major - } - return 0 -} - -func (m *BlkioEntry) GetMinor() uint64 { - if m != nil { - return m.Minor - } - return 0 -} - -func (m *BlkioEntry) GetValue() uint64 { - if m != nil { - return m.Value - } - return 0 -} +func (m *BlkIOEntry) Reset() { *m = BlkIOEntry{} } +func (*BlkIOEntry) ProtoMessage() {} +func (*BlkIOEntry) Descriptor() ([]byte, []int) { return fileDescriptorMetrics, []int{9} } func init() { - proto.RegisterType((*Metrics)(nil), "cgroups.Metrics") - proto.RegisterType((*HugetlbStat)(nil), "cgroups.HugetlbStat") - proto.RegisterType((*PidsStat)(nil), "cgroups.PidsStat") - proto.RegisterType((*CpuStat)(nil), "cgroups.CpuStat") - proto.RegisterType((*CpuUsage)(nil), "cgroups.CpuUsage") - proto.RegisterType((*Throttle)(nil), "cgroups.Throttle") - proto.RegisterType((*MemoryStat)(nil), "cgroups.MemoryStat") - proto.RegisterType((*MemoryEntry)(nil), "cgroups.MemoryEntry") - proto.RegisterType((*BlkioStat)(nil), "cgroups.BlkioStat") - proto.RegisterType((*BlkioEntry)(nil), "cgroups.BlkioEntry") + proto.RegisterType((*Metrics)(nil), "io.containerd.cgroups.v1.Metrics") + proto.RegisterType((*HugetlbStat)(nil), "io.containerd.cgroups.v1.HugetlbStat") + proto.RegisterType((*PidsStat)(nil), "io.containerd.cgroups.v1.PidsStat") + proto.RegisterType((*CPUStat)(nil), "io.containerd.cgroups.v1.CPUStat") + proto.RegisterType((*CPUUsage)(nil), "io.containerd.cgroups.v1.CPUUsage") + proto.RegisterType((*Throttle)(nil), "io.containerd.cgroups.v1.Throttle") + proto.RegisterType((*MemoryStat)(nil), "io.containerd.cgroups.v1.MemoryStat") + proto.RegisterType((*MemoryEntry)(nil), "io.containerd.cgroups.v1.MemoryEntry") + proto.RegisterType((*BlkIOStat)(nil), "io.containerd.cgroups.v1.BlkIOStat") + proto.RegisterType((*BlkIOEntry)(nil), "io.containerd.cgroups.v1.BlkIOEntry") +} +func (m *Metrics) 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 init() { proto.RegisterFile("metrics.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 1175 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x96, 0x6f, 0x6f, 0xdb, 0x36, - 0x10, 0xc6, 0x61, 0x5b, 0x89, 0xed, 0x73, 0x92, 0xc6, 0x74, 0x9b, 0x28, 0x69, 0xbb, 0x7a, 0x6e, - 0x8b, 0x06, 0xc9, 0x10, 0x60, 0x2d, 0xb0, 0x0d, 0x79, 0xb3, 0xb5, 0xd9, 0xba, 0x16, 0x58, 0x56, - 0x4f, 0x49, 0xd1, 0x97, 0x82, 0x2c, 0x33, 0x0a, 0x13, 0x59, 0xe4, 0x28, 0xca, 0x69, 0xbe, 0xd8, - 0xbe, 0xc5, 0x80, 0x7d, 0xa4, 0x81, 0x47, 0x4a, 0xa2, 0xf3, 0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b, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0xda, - 0x6f, 0x7a, 0x0a, 0xb0, 0x0b, 0x00, 0x00, +func (m *Metrics) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Hugetlb) > 0 { + for _, msg := range m.Hugetlb { + dAtA[i] = 0xa + i++ + i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.Pids != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Pids.Size())) + n1, err := m.Pids.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.CPU != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.CPU.Size())) + n2, err := m.CPU.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if m.Memory != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Memory.Size())) + n3, err := m.Memory.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.Blkio != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Blkio.Size())) + n4, err := m.Blkio.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + return i, nil +} + +func (m *HugetlbStat) 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 *HugetlbStat) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Usage != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Usage)) + } + if m.Max != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Max)) + } + if m.Failcnt != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Failcnt)) + } + if len(m.Pagesize) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(len(m.Pagesize))) + i += copy(dAtA[i:], m.Pagesize) + } + return i, nil +} + +func (m *PidsStat) 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 *PidsStat) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Current != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Current)) + } + if m.Limit != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Limit)) + } + return i, nil +} + +func (m *CPUStat) 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 *CPUStat) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Usage != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Usage.Size())) + n5, err := m.Usage.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + if m.Throttling != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Throttling.Size())) + n6, err := m.Throttling.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + return i, nil +} + +func (m *CPUUsage) 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 *CPUUsage) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Total != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Total)) + } + if m.Kernel != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Kernel)) + } + if m.User != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.User)) + } + if len(m.PerCPU) > 0 { + dAtA8 := make([]byte, len(m.PerCPU)*10) + var j7 int + for _, num := range m.PerCPU { + for num >= 1<<7 { + dAtA8[j7] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j7++ + } + dAtA8[j7] = uint8(num) + j7++ + } + dAtA[i] = 0x22 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(j7)) + i += copy(dAtA[i:], dAtA8[:j7]) + } + return i, nil +} + +func (m *Throttle) 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 *Throttle) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Periods != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Periods)) + } + if m.ThrottledPeriods != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.ThrottledPeriods)) + } + if m.ThrottledTime != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.ThrottledTime)) + } + return i, nil +} + +func (m *MemoryStat) 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 *MemoryStat) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Cache != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Cache)) + } + if m.RSS != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.RSS)) + } + if m.RSSHuge != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.RSSHuge)) + } + if m.MappedFile != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.MappedFile)) + } + if m.Dirty != 0 { + dAtA[i] = 0x28 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Dirty)) + } + if m.Writeback != 0 { + dAtA[i] = 0x30 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Writeback)) + } + if m.PgPgIn != 0 { + dAtA[i] = 0x38 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.PgPgIn)) + } + if m.PgPgOut != 0 { + dAtA[i] = 0x40 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.PgPgOut)) + } + if m.PgFault != 0 { + dAtA[i] = 0x48 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.PgFault)) + } + if m.PgMajFault != 0 { + dAtA[i] = 0x50 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.PgMajFault)) + } + if m.InactiveAnon != 0 { + dAtA[i] = 0x58 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.InactiveAnon)) + } + if m.ActiveAnon != 0 { + dAtA[i] = 0x60 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.ActiveAnon)) + } + if m.InactiveFile != 0 { + dAtA[i] = 0x68 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.InactiveFile)) + } + if m.ActiveFile != 0 { + dAtA[i] = 0x70 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.ActiveFile)) + } + if m.Unevictable != 0 { + dAtA[i] = 0x78 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Unevictable)) + } + if m.HierarchicalMemoryLimit != 0 { + dAtA[i] = 0x80 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.HierarchicalMemoryLimit)) + } + if m.HierarchicalSwapLimit != 0 { + dAtA[i] = 0x88 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.HierarchicalSwapLimit)) + } + if m.TotalCache != 0 { + dAtA[i] = 0x90 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.TotalCache)) + } + if m.TotalRSS != 0 { + dAtA[i] = 0x98 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.TotalRSS)) + } + if m.TotalRSSHuge != 0 { + dAtA[i] = 0xa0 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.TotalRSSHuge)) + } + if m.TotalMappedFile != 0 { + dAtA[i] = 0xa8 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.TotalMappedFile)) + } + if m.TotalDirty != 0 { + dAtA[i] = 0xb0 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.TotalDirty)) + } + if m.TotalWriteback != 0 { + dAtA[i] = 0xb8 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.TotalWriteback)) + } + if m.TotalPgPgIn != 0 { + dAtA[i] = 0xc0 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.TotalPgPgIn)) + } + if m.TotalPgPgOut != 0 { + dAtA[i] = 0xc8 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.TotalPgPgOut)) + } + if m.TotalPgFault != 0 { + dAtA[i] = 0xd0 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.TotalPgFault)) + } + if m.TotalPgMajFault != 0 { + dAtA[i] = 0xd8 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.TotalPgMajFault)) + } + if m.TotalInactiveAnon != 0 { + dAtA[i] = 0xe0 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.TotalInactiveAnon)) + } + if m.TotalActiveAnon != 0 { + dAtA[i] = 0xe8 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.TotalActiveAnon)) + } + if m.TotalInactiveFile != 0 { + dAtA[i] = 0xf0 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.TotalInactiveFile)) + } + if m.TotalActiveFile != 0 { + dAtA[i] = 0xf8 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.TotalActiveFile)) + } + if m.TotalUnevictable != 0 { + dAtA[i] = 0x80 + i++ + dAtA[i] = 0x2 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.TotalUnevictable)) + } + if m.Usage != nil { + dAtA[i] = 0x8a + i++ + dAtA[i] = 0x2 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Usage.Size())) + n9, err := m.Usage.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + if m.Swap != nil { + dAtA[i] = 0x92 + i++ + dAtA[i] = 0x2 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Swap.Size())) + n10, err := m.Swap.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 + } + if m.Kernel != nil { + dAtA[i] = 0x9a + i++ + dAtA[i] = 0x2 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Kernel.Size())) + n11, err := m.Kernel.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n11 + } + if m.KernelTCP != nil { + dAtA[i] = 0xa2 + i++ + dAtA[i] = 0x2 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.KernelTCP.Size())) + n12, err := m.KernelTCP.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n12 + } + 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)) + } + return i, nil +} + +func (m *BlkIOStat) 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 *BlkIOStat) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.IoServiceBytesRecursive) > 0 { + for _, msg := range m.IoServiceBytesRecursive { + dAtA[i] = 0xa + i++ + i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.IoServicedRecursive) > 0 { + for _, msg := range m.IoServicedRecursive { + dAtA[i] = 0x12 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.IoQueuedRecursive) > 0 { + for _, msg := range m.IoQueuedRecursive { + dAtA[i] = 0x1a + i++ + i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.IoServiceTimeRecursive) > 0 { + for _, msg := range m.IoServiceTimeRecursive { + dAtA[i] = 0x22 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.IoWaitTimeRecursive) > 0 { + for _, msg := range m.IoWaitTimeRecursive { + dAtA[i] = 0x2a + i++ + i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.IoMergedRecursive) > 0 { + for _, msg := range m.IoMergedRecursive { + dAtA[i] = 0x32 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.IoTimeRecursive) > 0 { + for _, msg := range m.IoTimeRecursive { + dAtA[i] = 0x3a + i++ + i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.SectorsRecursive) > 0 { + for _, msg := range m.SectorsRecursive { + dAtA[i] = 0x42 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *BlkIOEntry) 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 *BlkIOEntry) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Op) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintMetrics(dAtA, i, uint64(len(m.Op))) + i += copy(dAtA[i:], m.Op) + } + if len(m.Device) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(len(m.Device))) + i += copy(dAtA[i:], m.Device) + } + if m.Major != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Major)) + } + if m.Minor != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Minor)) + } + if m.Value != 0 { + dAtA[i] = 0x28 + i++ + i = encodeVarintMetrics(dAtA, i, uint64(m.Value)) + } + return i, nil +} + +func encodeFixed64Metrics(dAtA []byte, offset int, v uint64) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + dAtA[offset+4] = uint8(v >> 32) + dAtA[offset+5] = uint8(v >> 40) + dAtA[offset+6] = uint8(v >> 48) + dAtA[offset+7] = uint8(v >> 56) + return offset + 8 +} +func encodeFixed32Metrics(dAtA []byte, offset int, v uint32) int { + dAtA[offset] = uint8(v) + dAtA[offset+1] = uint8(v >> 8) + dAtA[offset+2] = uint8(v >> 16) + dAtA[offset+3] = uint8(v >> 24) + return offset + 4 +} +func encodeVarintMetrics(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *Metrics) Size() (n int) { + var l int + _ = l + if len(m.Hugetlb) > 0 { + for _, e := range m.Hugetlb { + l = e.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + } + if m.Pids != nil { + l = m.Pids.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + if m.CPU != nil { + l = m.CPU.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + if m.Memory != nil { + l = m.Memory.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + if m.Blkio != nil { + l = m.Blkio.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + return n +} + +func (m *HugetlbStat) Size() (n int) { + var l int + _ = l + 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)) + } + l = len(m.Pagesize) + if l > 0 { + n += 1 + l + sovMetrics(uint64(l)) + } + return n +} + +func (m *PidsStat) Size() (n int) { + var l int + _ = l + if m.Current != 0 { + n += 1 + sovMetrics(uint64(m.Current)) + } + if m.Limit != 0 { + n += 1 + sovMetrics(uint64(m.Limit)) + } + return n +} + +func (m *CPUStat) Size() (n int) { + var l int + _ = l + if m.Usage != nil { + l = m.Usage.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + if m.Throttling != nil { + l = m.Throttling.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + return n +} + +func (m *CPUUsage) Size() (n int) { + var l int + _ = l + if m.Total != 0 { + n += 1 + sovMetrics(uint64(m.Total)) + } + if m.Kernel != 0 { + n += 1 + sovMetrics(uint64(m.Kernel)) + } + if m.User != 0 { + n += 1 + sovMetrics(uint64(m.User)) + } + if len(m.PerCPU) > 0 { + l = 0 + for _, e := range m.PerCPU { + l += sovMetrics(uint64(e)) + } + n += 1 + sovMetrics(uint64(l)) + l + } + return n +} + +func (m *Throttle) Size() (n int) { + var l int + _ = l + if m.Periods != 0 { + n += 1 + sovMetrics(uint64(m.Periods)) + } + if m.ThrottledPeriods != 0 { + n += 1 + sovMetrics(uint64(m.ThrottledPeriods)) + } + if m.ThrottledTime != 0 { + n += 1 + sovMetrics(uint64(m.ThrottledTime)) + } + return n +} + +func (m *MemoryStat) Size() (n int) { + var l int + _ = l + if m.Cache != 0 { + n += 1 + sovMetrics(uint64(m.Cache)) + } + if m.RSS != 0 { + n += 1 + sovMetrics(uint64(m.RSS)) + } + if m.RSSHuge != 0 { + n += 1 + sovMetrics(uint64(m.RSSHuge)) + } + if m.MappedFile != 0 { + n += 1 + sovMetrics(uint64(m.MappedFile)) + } + if m.Dirty != 0 { + n += 1 + sovMetrics(uint64(m.Dirty)) + } + if m.Writeback != 0 { + n += 1 + sovMetrics(uint64(m.Writeback)) + } + if m.PgPgIn != 0 { + n += 1 + sovMetrics(uint64(m.PgPgIn)) + } + if m.PgPgOut != 0 { + n += 1 + sovMetrics(uint64(m.PgPgOut)) + } + if m.PgFault != 0 { + n += 1 + sovMetrics(uint64(m.PgFault)) + } + if m.PgMajFault != 0 { + n += 1 + sovMetrics(uint64(m.PgMajFault)) + } + if m.InactiveAnon != 0 { + n += 1 + sovMetrics(uint64(m.InactiveAnon)) + } + if m.ActiveAnon != 0 { + n += 1 + sovMetrics(uint64(m.ActiveAnon)) + } + if m.InactiveFile != 0 { + n += 1 + sovMetrics(uint64(m.InactiveFile)) + } + if m.ActiveFile != 0 { + n += 1 + sovMetrics(uint64(m.ActiveFile)) + } + if m.Unevictable != 0 { + n += 1 + sovMetrics(uint64(m.Unevictable)) + } + if m.HierarchicalMemoryLimit != 0 { + n += 2 + sovMetrics(uint64(m.HierarchicalMemoryLimit)) + } + if m.HierarchicalSwapLimit != 0 { + n += 2 + sovMetrics(uint64(m.HierarchicalSwapLimit)) + } + if m.TotalCache != 0 { + n += 2 + sovMetrics(uint64(m.TotalCache)) + } + if m.TotalRSS != 0 { + n += 2 + sovMetrics(uint64(m.TotalRSS)) + } + if m.TotalRSSHuge != 0 { + n += 2 + sovMetrics(uint64(m.TotalRSSHuge)) + } + if m.TotalMappedFile != 0 { + n += 2 + sovMetrics(uint64(m.TotalMappedFile)) + } + if m.TotalDirty != 0 { + n += 2 + sovMetrics(uint64(m.TotalDirty)) + } + if m.TotalWriteback != 0 { + n += 2 + sovMetrics(uint64(m.TotalWriteback)) + } + if m.TotalPgPgIn != 0 { + n += 2 + sovMetrics(uint64(m.TotalPgPgIn)) + } + if m.TotalPgPgOut != 0 { + n += 2 + sovMetrics(uint64(m.TotalPgPgOut)) + } + if m.TotalPgFault != 0 { + n += 2 + sovMetrics(uint64(m.TotalPgFault)) + } + if m.TotalPgMajFault != 0 { + n += 2 + sovMetrics(uint64(m.TotalPgMajFault)) + } + if m.TotalInactiveAnon != 0 { + n += 2 + sovMetrics(uint64(m.TotalInactiveAnon)) + } + if m.TotalActiveAnon != 0 { + n += 2 + sovMetrics(uint64(m.TotalActiveAnon)) + } + if m.TotalInactiveFile != 0 { + n += 2 + sovMetrics(uint64(m.TotalInactiveFile)) + } + if m.TotalActiveFile != 0 { + n += 2 + sovMetrics(uint64(m.TotalActiveFile)) + } + if m.TotalUnevictable != 0 { + n += 2 + sovMetrics(uint64(m.TotalUnevictable)) + } + if m.Usage != nil { + l = m.Usage.Size() + n += 2 + l + sovMetrics(uint64(l)) + } + if m.Swap != nil { + l = m.Swap.Size() + n += 2 + l + sovMetrics(uint64(l)) + } + if m.Kernel != nil { + l = m.Kernel.Size() + n += 2 + l + sovMetrics(uint64(l)) + } + if m.KernelTCP != nil { + l = m.KernelTCP.Size() + n += 2 + l + sovMetrics(uint64(l)) + } + return n +} + +func (m *MemoryEntry) Size() (n int) { + 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)) + } + return n +} + +func (m *BlkIOStat) Size() (n int) { + var l int + _ = l + if len(m.IoServiceBytesRecursive) > 0 { + for _, e := range m.IoServiceBytesRecursive { + l = e.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + } + if len(m.IoServicedRecursive) > 0 { + for _, e := range m.IoServicedRecursive { + l = e.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + } + if len(m.IoQueuedRecursive) > 0 { + for _, e := range m.IoQueuedRecursive { + l = e.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + } + if len(m.IoServiceTimeRecursive) > 0 { + for _, e := range m.IoServiceTimeRecursive { + l = e.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + } + if len(m.IoWaitTimeRecursive) > 0 { + for _, e := range m.IoWaitTimeRecursive { + l = e.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + } + if len(m.IoMergedRecursive) > 0 { + for _, e := range m.IoMergedRecursive { + l = e.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + } + if len(m.IoTimeRecursive) > 0 { + for _, e := range m.IoTimeRecursive { + l = e.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + } + if len(m.SectorsRecursive) > 0 { + for _, e := range m.SectorsRecursive { + l = e.Size() + n += 1 + l + sovMetrics(uint64(l)) + } + } + return n +} + +func (m *BlkIOEntry) Size() (n int) { + var l int + _ = l + l = len(m.Op) + if l > 0 { + n += 1 + l + sovMetrics(uint64(l)) + } + l = len(m.Device) + if l > 0 { + n += 1 + l + sovMetrics(uint64(l)) + } + if m.Major != 0 { + n += 1 + sovMetrics(uint64(m.Major)) + } + if m.Minor != 0 { + n += 1 + sovMetrics(uint64(m.Minor)) + } + if m.Value != 0 { + n += 1 + sovMetrics(uint64(m.Value)) + } + return n +} + +func sovMetrics(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozMetrics(x uint64) (n int) { + return sovMetrics(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Metrics) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Metrics{`, + `Hugetlb:` + strings.Replace(fmt.Sprintf("%v", this.Hugetlb), "HugetlbStat", "HugetlbStat", 1) + `,`, + `Pids:` + strings.Replace(fmt.Sprintf("%v", this.Pids), "PidsStat", "PidsStat", 1) + `,`, + `CPU:` + strings.Replace(fmt.Sprintf("%v", this.CPU), "CPUStat", "CPUStat", 1) + `,`, + `Memory:` + strings.Replace(fmt.Sprintf("%v", this.Memory), "MemoryStat", "MemoryStat", 1) + `,`, + `Blkio:` + strings.Replace(fmt.Sprintf("%v", this.Blkio), "BlkIOStat", "BlkIOStat", 1) + `,`, + `}`, + }, "") + return s +} +func (this *HugetlbStat) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&HugetlbStat{`, + `Usage:` + fmt.Sprintf("%v", this.Usage) + `,`, + `Max:` + fmt.Sprintf("%v", this.Max) + `,`, + `Failcnt:` + fmt.Sprintf("%v", this.Failcnt) + `,`, + `Pagesize:` + fmt.Sprintf("%v", this.Pagesize) + `,`, + `}`, + }, "") + return s +} +func (this *PidsStat) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PidsStat{`, + `Current:` + fmt.Sprintf("%v", this.Current) + `,`, + `Limit:` + fmt.Sprintf("%v", this.Limit) + `,`, + `}`, + }, "") + return s +} +func (this *CPUStat) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CPUStat{`, + `Usage:` + strings.Replace(fmt.Sprintf("%v", this.Usage), "CPUUsage", "CPUUsage", 1) + `,`, + `Throttling:` + strings.Replace(fmt.Sprintf("%v", this.Throttling), "Throttle", "Throttle", 1) + `,`, + `}`, + }, "") + return s +} +func (this *CPUUsage) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CPUUsage{`, + `Total:` + fmt.Sprintf("%v", this.Total) + `,`, + `Kernel:` + fmt.Sprintf("%v", this.Kernel) + `,`, + `User:` + fmt.Sprintf("%v", this.User) + `,`, + `PerCPU:` + fmt.Sprintf("%v", this.PerCPU) + `,`, + `}`, + }, "") + return s +} +func (this *Throttle) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Throttle{`, + `Periods:` + fmt.Sprintf("%v", this.Periods) + `,`, + `ThrottledPeriods:` + fmt.Sprintf("%v", this.ThrottledPeriods) + `,`, + `ThrottledTime:` + fmt.Sprintf("%v", this.ThrottledTime) + `,`, + `}`, + }, "") + return s +} +func (this *MemoryStat) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&MemoryStat{`, + `Cache:` + fmt.Sprintf("%v", this.Cache) + `,`, + `RSS:` + fmt.Sprintf("%v", this.RSS) + `,`, + `RSSHuge:` + fmt.Sprintf("%v", this.RSSHuge) + `,`, + `MappedFile:` + fmt.Sprintf("%v", this.MappedFile) + `,`, + `Dirty:` + fmt.Sprintf("%v", this.Dirty) + `,`, + `Writeback:` + fmt.Sprintf("%v", this.Writeback) + `,`, + `PgPgIn:` + fmt.Sprintf("%v", this.PgPgIn) + `,`, + `PgPgOut:` + fmt.Sprintf("%v", this.PgPgOut) + `,`, + `PgFault:` + fmt.Sprintf("%v", this.PgFault) + `,`, + `PgMajFault:` + fmt.Sprintf("%v", this.PgMajFault) + `,`, + `InactiveAnon:` + fmt.Sprintf("%v", this.InactiveAnon) + `,`, + `ActiveAnon:` + fmt.Sprintf("%v", this.ActiveAnon) + `,`, + `InactiveFile:` + fmt.Sprintf("%v", this.InactiveFile) + `,`, + `ActiveFile:` + fmt.Sprintf("%v", this.ActiveFile) + `,`, + `Unevictable:` + fmt.Sprintf("%v", this.Unevictable) + `,`, + `HierarchicalMemoryLimit:` + fmt.Sprintf("%v", this.HierarchicalMemoryLimit) + `,`, + `HierarchicalSwapLimit:` + fmt.Sprintf("%v", this.HierarchicalSwapLimit) + `,`, + `TotalCache:` + fmt.Sprintf("%v", this.TotalCache) + `,`, + `TotalRSS:` + fmt.Sprintf("%v", this.TotalRSS) + `,`, + `TotalRSSHuge:` + fmt.Sprintf("%v", this.TotalRSSHuge) + `,`, + `TotalMappedFile:` + fmt.Sprintf("%v", this.TotalMappedFile) + `,`, + `TotalDirty:` + fmt.Sprintf("%v", this.TotalDirty) + `,`, + `TotalWriteback:` + fmt.Sprintf("%v", this.TotalWriteback) + `,`, + `TotalPgPgIn:` + fmt.Sprintf("%v", this.TotalPgPgIn) + `,`, + `TotalPgPgOut:` + fmt.Sprintf("%v", this.TotalPgPgOut) + `,`, + `TotalPgFault:` + fmt.Sprintf("%v", this.TotalPgFault) + `,`, + `TotalPgMajFault:` + fmt.Sprintf("%v", this.TotalPgMajFault) + `,`, + `TotalInactiveAnon:` + fmt.Sprintf("%v", this.TotalInactiveAnon) + `,`, + `TotalActiveAnon:` + fmt.Sprintf("%v", this.TotalActiveAnon) + `,`, + `TotalInactiveFile:` + fmt.Sprintf("%v", this.TotalInactiveFile) + `,`, + `TotalActiveFile:` + fmt.Sprintf("%v", this.TotalActiveFile) + `,`, + `TotalUnevictable:` + fmt.Sprintf("%v", this.TotalUnevictable) + `,`, + `Usage:` + strings.Replace(fmt.Sprintf("%v", this.Usage), "MemoryEntry", "MemoryEntry", 1) + `,`, + `Swap:` + strings.Replace(fmt.Sprintf("%v", this.Swap), "MemoryEntry", "MemoryEntry", 1) + `,`, + `Kernel:` + strings.Replace(fmt.Sprintf("%v", this.Kernel), "MemoryEntry", "MemoryEntry", 1) + `,`, + `KernelTCP:` + strings.Replace(fmt.Sprintf("%v", this.KernelTCP), "MemoryEntry", "MemoryEntry", 1) + `,`, + `}`, + }, "") + 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) + `,`, + `}`, + }, "") + return s +} +func (this *BlkIOStat) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&BlkIOStat{`, + `IoServiceBytesRecursive:` + strings.Replace(fmt.Sprintf("%v", this.IoServiceBytesRecursive), "BlkIOEntry", "BlkIOEntry", 1) + `,`, + `IoServicedRecursive:` + strings.Replace(fmt.Sprintf("%v", this.IoServicedRecursive), "BlkIOEntry", "BlkIOEntry", 1) + `,`, + `IoQueuedRecursive:` + strings.Replace(fmt.Sprintf("%v", this.IoQueuedRecursive), "BlkIOEntry", "BlkIOEntry", 1) + `,`, + `IoServiceTimeRecursive:` + strings.Replace(fmt.Sprintf("%v", this.IoServiceTimeRecursive), "BlkIOEntry", "BlkIOEntry", 1) + `,`, + `IoWaitTimeRecursive:` + strings.Replace(fmt.Sprintf("%v", this.IoWaitTimeRecursive), "BlkIOEntry", "BlkIOEntry", 1) + `,`, + `IoMergedRecursive:` + strings.Replace(fmt.Sprintf("%v", this.IoMergedRecursive), "BlkIOEntry", "BlkIOEntry", 1) + `,`, + `IoTimeRecursive:` + strings.Replace(fmt.Sprintf("%v", this.IoTimeRecursive), "BlkIOEntry", "BlkIOEntry", 1) + `,`, + `SectorsRecursive:` + strings.Replace(fmt.Sprintf("%v", this.SectorsRecursive), "BlkIOEntry", "BlkIOEntry", 1) + `,`, + `}`, + }, "") + return s +} +func (this *BlkIOEntry) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&BlkIOEntry{`, + `Op:` + fmt.Sprintf("%v", this.Op) + `,`, + `Device:` + fmt.Sprintf("%v", this.Device) + `,`, + `Major:` + fmt.Sprintf("%v", this.Major) + `,`, + `Minor:` + fmt.Sprintf("%v", this.Minor) + `,`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `}`, + }, "") + return s +} +func valueToStringMetrics(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Metrics) 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: Metrics: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Metrics: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hugetlb", 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 > l { + return io.ErrUnexpectedEOF + } + m.Hugetlb = append(m.Hugetlb, &HugetlbStat{}) + if err := m.Hugetlb[len(m.Hugetlb)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pids", 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 > l { + return io.ErrUnexpectedEOF + } + if m.Pids == nil { + m.Pids = &PidsStat{} + } + if err := m.Pids.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CPU", 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 > l { + return io.ErrUnexpectedEOF + } + if m.CPU == nil { + m.CPU = &CPUStat{} + } + if err := m.CPU.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Memory", 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 > l { + return io.ErrUnexpectedEOF + } + if m.Memory == nil { + m.Memory = &MemoryStat{} + } + if err := m.Memory.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Blkio", 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 > l { + return io.ErrUnexpectedEOF + } + if m.Blkio == nil { + m.Blkio = &BlkIOStat{} + } + if err := m.Blkio.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) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HugetlbStat) 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: HugetlbStat: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HugetlbStat: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 2: + 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 3: + 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 + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagesize", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetrics + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pagesize = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMetrics(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMetrics + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PidsStat) 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: PidsStat: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PidsStat: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Current", wireType) + } + m.Current = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Current |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + 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 + } + } + default: + iNdEx = preIndex + skippy, err := skipMetrics(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMetrics + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CPUStat) 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: CPUStat: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CPUStat: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 > l { + return io.ErrUnexpectedEOF + } + if m.Usage == nil { + m.Usage = &CPUUsage{} + } + if err := m.Usage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Throttling", 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 > l { + return io.ErrUnexpectedEOF + } + if m.Throttling == nil { + m.Throttling = &Throttle{} + } + if err := m.Throttling.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) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CPUUsage) 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: CPUUsage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CPUUsage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) + } + m.Total = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Total |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Kernel", wireType) + } + m.Kernel = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Kernel |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + } + m.User = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.User |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.PerCPU = append(m.PerCPU, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthMetrics + } + postIndex := iNdEx + packedLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.PerCPU = append(m.PerCPU, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field PerCPU", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipMetrics(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMetrics + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Throttle) 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: Throttle: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Throttle: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Periods", wireType) + } + m.Periods = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Periods |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ThrottledPeriods", wireType) + } + m.ThrottledPeriods = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ThrottledPeriods |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ThrottledTime", wireType) + } + m.ThrottledTime = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ThrottledTime |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipMetrics(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMetrics + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MemoryStat) 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: MemoryStat: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MemoryStat: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Cache", wireType) + } + m.Cache = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Cache |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RSS", wireType) + } + m.RSS = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RSS |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RSSHuge", wireType) + } + m.RSSHuge = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RSSHuge |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MappedFile", wireType) + } + m.MappedFile = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MappedFile |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Dirty", wireType) + } + m.Dirty = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Dirty |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Writeback", wireType) + } + m.Writeback = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Writeback |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PgPgIn", wireType) + } + m.PgPgIn = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PgPgIn |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PgPgOut", wireType) + } + m.PgPgOut = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PgPgOut |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PgFault", wireType) + } + m.PgFault = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PgFault |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PgMajFault", wireType) + } + m.PgMajFault = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PgMajFault |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InactiveAnon", wireType) + } + m.InactiveAnon = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InactiveAnon |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ActiveAnon", wireType) + } + m.ActiveAnon = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ActiveAnon |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InactiveFile", wireType) + } + m.InactiveFile = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InactiveFile |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ActiveFile", wireType) + } + m.ActiveFile = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ActiveFile |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Unevictable", wireType) + } + m.Unevictable = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Unevictable |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 16: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HierarchicalMemoryLimit", wireType) + } + m.HierarchicalMemoryLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HierarchicalMemoryLimit |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 17: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HierarchicalSwapLimit", wireType) + } + m.HierarchicalSwapLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HierarchicalSwapLimit |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 18: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalCache", wireType) + } + m.TotalCache = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalCache |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 19: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalRSS", wireType) + } + m.TotalRSS = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalRSS |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 20: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalRSSHuge", wireType) + } + m.TotalRSSHuge = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalRSSHuge |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 21: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalMappedFile", wireType) + } + m.TotalMappedFile = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalMappedFile |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 22: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalDirty", wireType) + } + m.TotalDirty = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalDirty |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 23: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalWriteback", wireType) + } + m.TotalWriteback = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalWriteback |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 24: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalPgPgIn", wireType) + } + m.TotalPgPgIn = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalPgPgIn |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 25: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalPgPgOut", wireType) + } + m.TotalPgPgOut = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalPgPgOut |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 26: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalPgFault", wireType) + } + m.TotalPgFault = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalPgFault |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 27: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalPgMajFault", wireType) + } + m.TotalPgMajFault = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalPgMajFault |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 28: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalInactiveAnon", wireType) + } + m.TotalInactiveAnon = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalInactiveAnon |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 29: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalActiveAnon", wireType) + } + m.TotalActiveAnon = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalActiveAnon |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 30: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalInactiveFile", wireType) + } + m.TotalInactiveFile = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalInactiveFile |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 31: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalActiveFile", wireType) + } + m.TotalActiveFile = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalActiveFile |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 32: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalUnevictable", wireType) + } + m.TotalUnevictable = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TotalUnevictable |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 33: + 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 > 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 34: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Swap", 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 > l { + return io.ErrUnexpectedEOF + } + if m.Swap == nil { + m.Swap = &MemoryEntry{} + } + if err := m.Swap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 35: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Kernel", 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 > l { + return io.ErrUnexpectedEOF + } + if m.Kernel == nil { + m.Kernel = &MemoryEntry{} + } + if err := m.Kernel.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 36: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KernelTCP", 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 > l { + return io.ErrUnexpectedEOF + } + if m.KernelTCP == nil { + m.KernelTCP = &MemoryEntry{} + } + if err := m.KernelTCP.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) > l { + return io.ErrUnexpectedEOF + } + 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:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMetrics + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlkIOStat) 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: BlkIOStat: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlkIOStat: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IoServiceBytesRecursive", 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 > l { + return io.ErrUnexpectedEOF + } + m.IoServiceBytesRecursive = append(m.IoServiceBytesRecursive, &BlkIOEntry{}) + if err := m.IoServiceBytesRecursive[len(m.IoServiceBytesRecursive)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IoServicedRecursive", 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 > l { + return io.ErrUnexpectedEOF + } + m.IoServicedRecursive = append(m.IoServicedRecursive, &BlkIOEntry{}) + if err := m.IoServicedRecursive[len(m.IoServicedRecursive)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IoQueuedRecursive", 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 > l { + return io.ErrUnexpectedEOF + } + m.IoQueuedRecursive = append(m.IoQueuedRecursive, &BlkIOEntry{}) + if err := m.IoQueuedRecursive[len(m.IoQueuedRecursive)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IoServiceTimeRecursive", 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 > l { + return io.ErrUnexpectedEOF + } + m.IoServiceTimeRecursive = append(m.IoServiceTimeRecursive, &BlkIOEntry{}) + if err := m.IoServiceTimeRecursive[len(m.IoServiceTimeRecursive)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IoWaitTimeRecursive", 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 > l { + return io.ErrUnexpectedEOF + } + m.IoWaitTimeRecursive = append(m.IoWaitTimeRecursive, &BlkIOEntry{}) + if err := m.IoWaitTimeRecursive[len(m.IoWaitTimeRecursive)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IoMergedRecursive", 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 > l { + return io.ErrUnexpectedEOF + } + m.IoMergedRecursive = append(m.IoMergedRecursive, &BlkIOEntry{}) + if err := m.IoMergedRecursive[len(m.IoMergedRecursive)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IoTimeRecursive", 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 > l { + return io.ErrUnexpectedEOF + } + m.IoTimeRecursive = append(m.IoTimeRecursive, &BlkIOEntry{}) + if err := m.IoTimeRecursive[len(m.IoTimeRecursive)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SectorsRecursive", 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 > l { + return io.ErrUnexpectedEOF + } + m.SectorsRecursive = append(m.SectorsRecursive, &BlkIOEntry{}) + if err := m.SectorsRecursive[len(m.SectorsRecursive)-1].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) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BlkIOEntry) 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: BlkIOEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlkIOEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetrics + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Op = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Device", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetrics + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Device = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Major", wireType) + } + m.Major = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Major |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Minor", wireType) + } + m.Minor = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Minor |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + m.Value = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetrics + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Value |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipMetrics(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMetrics + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipMetrics(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetrics + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetrics + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetrics + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthMetrics + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetrics + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipMetrics(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthMetrics = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMetrics = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("github.com/containerd/cgroups/metrics.proto", fileDescriptorMetrics) } + +var fileDescriptorMetrics = []byte{ + // 1325 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x57, 0x4d, 0x6f, 0x1b, 0xb7, + 0x16, 0x8d, 0xac, 0xb1, 0x3e, 0xae, 0x6c, 0xc7, 0xa6, 0x13, 0x67, 0xec, 0x97, 0x27, 0x29, 0xb2, + 0xfd, 0x9e, 0x5b, 0x03, 0x32, 0x9a, 0x02, 0x41, 0x93, 0xa6, 0x28, 0x22, 0xb7, 0x41, 0x83, 0xd6, + 0x88, 0x32, 0xb2, 0x91, 0x76, 0x35, 0x18, 0x8d, 0x98, 0x31, 0xe3, 0xd1, 0x70, 0xc2, 0xe1, 0xc8, + 0x71, 0x57, 0xdd, 0xf5, 0x37, 0xf5, 0x1f, 0x64, 0xd9, 0x4d, 0x81, 0x76, 0x63, 0x34, 0xfa, 0x25, + 0x05, 0x2f, 0xe7, 0x4b, 0x49, 0xdc, 0x40, 0xbb, 0xb9, 0xbc, 0xe7, 0x1c, 0x5e, 0x5e, 0x1e, 0x8a, + 0x14, 0xec, 0x7b, 0x4c, 0x9e, 0xc6, 0xc3, 0xae, 0xcb, 0xc7, 0x07, 0x2e, 0x0f, 0xa4, 0xc3, 0x02, + 0x2a, 0x46, 0x07, 0xae, 0x27, 0x78, 0x1c, 0x46, 0x07, 0x63, 0x2a, 0x05, 0x73, 0xa3, 0x6e, 0x28, + 0xb8, 0xe4, 0xc4, 0x64, 0xbc, 0x9b, 0x83, 0xba, 0x09, 0xa8, 0x3b, 0xf9, 0x6c, 0xeb, 0x86, 0xc7, + 0x3d, 0x8e, 0xa0, 0x03, 0xf5, 0xa5, 0xf1, 0x9d, 0xdf, 0x16, 0xa0, 0x7a, 0xa4, 0x15, 0xc8, 0xd7, + 0x50, 0x3d, 0x8d, 0x3d, 0x2a, 0xfd, 0xa1, 0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, 0x6a, 0x22, 0x8a, 0x6c, 0x75, 0xba, 0xf4, 0x04, 0xbd, 0xc6, 0xf4, 0xb2, + 0x55, 0xb5, 0x06, 0x03, 0x65, 0x3b, 0xab, 0x2a, 0xa2, 0x48, 0x7d, 0x90, 0x16, 0x34, 0xc6, 0x4e, + 0x18, 0xd2, 0x91, 0xfd, 0x82, 0xf9, 0xda, 0x39, 0x86, 0x05, 0x7a, 0xe8, 0x31, 0xf3, 0xb1, 0xd3, + 0x23, 0x26, 0xe4, 0x05, 0x7a, 0xdc, 0xb0, 0x74, 0x40, 0x6e, 0x43, 0xfd, 0x5c, 0x30, 0x49, 0x87, + 0x8e, 0x7b, 0x66, 0x56, 0x30, 0x93, 0x0f, 0x10, 0x13, 0x6a, 0xa1, 0x67, 0x87, 0x9e, 0xcd, 0x02, + 0xb3, 0xaa, 0x77, 0x22, 0xf4, 0xfa, 0xde, 0x93, 0x80, 0x6c, 0x41, 0x5d, 0x67, 0x78, 0x2c, 0xcd, + 0x5a, 0xd2, 0x46, 0xaf, 0xef, 0x3d, 0x8d, 0x25, 0xd9, 0x44, 0xd6, 0x0b, 0x27, 0xf6, 0xa5, 0x59, + 0x4f, 0x53, 0x8f, 0x55, 0x48, 0xda, 0xb0, 0x14, 0x7a, 0xf6, 0xd8, 0x79, 0x99, 0xa4, 0x41, 0x97, + 0x19, 0x7a, 0x47, 0xce, 0x4b, 0x8d, 0xd8, 0x86, 0x65, 0x16, 0x38, 0xae, 0x64, 0x13, 0x6a, 0x3b, + 0x01, 0x0f, 0xcc, 0x06, 0x42, 0x96, 0xd2, 0xc1, 0x47, 0x01, 0x0f, 0xd4, 0x62, 0x8b, 0x90, 0x25, + 0xad, 0x52, 0x00, 0x14, 0x55, 0xb0, 0x1f, 0xcb, 0xb3, 0x2a, 0xd8, 0x91, 0x5c, 0x05, 0x21, 0x2b, + 0x45, 0x15, 0x04, 0xb4, 0xa1, 0x11, 0x07, 0x74, 0xc2, 0x5c, 0xe9, 0x0c, 0x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02, 0x75, 0x80, 0xa3, + 0x2c, 0xe0, 0x22, 0x39, 0x3b, 0x3a, 0x50, 0xa3, 0x13, 0xc7, 0x8f, 0x69, 0xfa, 0xe6, 0xc1, 0xa0, + 0x67, 0xbe, 0x79, 0xdb, 0xbc, 0xf6, 0xe7, 0xdb, 0xe6, 0xb5, 0x5f, 0xa6, 0xcd, 0xd2, 0x9b, 0x69, + 0xb3, 0xf4, 0xfb, 0xb4, 0x59, 0xfa, 0x7b, 0xda, 0x2c, 0x0d, 0x2b, 0xf8, 0x7f, 0xe8, 0xf3, 0x7f, + 0x02, 0x00, 0x00, 0xff, 0xff, 0xb2, 0x21, 0x0b, 0xcd, 0x6e, 0x0d, 0x00, 0x00, } diff --git a/vendor/github.com/containerd/cgroups/metrics.proto b/vendor/github.com/containerd/cgroups/metrics.proto index 8295d2fa9..8c3c3c4bd 100644 --- a/vendor/github.com/containerd/cgroups/metrics.proto +++ b/vendor/github.com/containerd/cgroups/metrics.proto @@ -1,19 +1,22 @@ syntax = "proto3"; -package cgroups; +package io.containerd.cgroups.v1; + +import "gogoproto/gogo.proto"; message Metrics { - map hugetlb = 1; + repeated HugetlbStat hugetlb = 1; PidsStat pids = 2; - CpuStat cpu = 3; + CPUStat cpu = 3 [(gogoproto.customname) = "CPU"]; MemoryStat memory = 4; - BlkioStat blkio = 5; + BlkIOStat blkio = 5; } message HugetlbStat { uint64 usage = 1; uint64 max = 2; uint64 failcnt = 3; + string pagesize = 4; } message PidsStat { @@ -21,17 +24,18 @@ message PidsStat { uint64 limit = 2; } -message CpuStat { - CpuUsage usage = 1; +message CPUStat { + CPUUsage usage = 1; Throttle throttling = 2; } -message CpuUsage { +message CPUUsage { // values in nanoseconds uint64 total = 1; uint64 kernel = 2; uint64 user = 3; - repeated uint64 per_cpu = 4; + repeated uint64 per_cpu = 4 [(gogoproto.customname) = "PerCPU"]; + } message Throttle { @@ -42,8 +46,8 @@ message Throttle { message MemoryStat { uint64 cache = 1; - uint64 rss = 2; - uint64 rss_huge = 3; + uint64 rss = 2 [(gogoproto.customname) = "RSS"]; + uint64 rss_huge = 3 [(gogoproto.customname) = "RSSHuge"]; uint64 mapped_file = 4; uint64 dirty = 5; uint64 writeback = 6; @@ -59,8 +63,8 @@ message MemoryStat { uint64 hierarchical_memory_limit = 16; uint64 hierarchical_swap_limit = 17; uint64 total_cache = 18; - uint64 total_rss = 19; - uint64 total_rss_huge = 20; + uint64 total_rss = 19 [(gogoproto.customname) = "TotalRSS"]; + uint64 total_rss_huge = 20 [(gogoproto.customname) = "TotalRSSHuge"]; uint64 total_mapped_file = 21; uint64 total_dirty = 22; uint64 total_writeback = 23; @@ -76,7 +80,7 @@ message MemoryStat { MemoryEntry usage = 33; MemoryEntry swap = 34; MemoryEntry kernel = 35; - MemoryEntry kernel_tcp = 36; + MemoryEntry kernel_tcp = 36 [(gogoproto.customname) = "KernelTCP"]; } @@ -87,18 +91,18 @@ message MemoryEntry { uint64 failcnt = 4; } -message BlkioStat { - repeated BlkioEntry io_service_bytes_recursive = 1; - repeated BlkioEntry io_serviced_recursive = 2; - repeated BlkioEntry io_queued_recursive = 3; - repeated BlkioEntry io_service_time_recursive = 4; - repeated BlkioEntry io_wait_time_recursive = 5; - repeated BlkioEntry io_merged_recursive = 6; - repeated BlkioEntry io_time_recursive = 7; - repeated BlkioEntry sectors_recursive = 8; +message BlkIOStat { + repeated BlkIOEntry io_service_bytes_recursive = 1; + repeated BlkIOEntry io_serviced_recursive = 2; + repeated BlkIOEntry io_queued_recursive = 3; + repeated BlkIOEntry io_service_time_recursive = 4; + repeated BlkIOEntry io_wait_time_recursive = 5; + repeated BlkIOEntry io_merged_recursive = 6; + repeated BlkIOEntry io_time_recursive = 7; + repeated BlkIOEntry sectors_recursive = 8; } -message BlkioEntry { +message BlkIOEntry { string op = 1; string device = 2; uint64 major = 3;