Move metrics requests to services

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-09-05 17:34:10 -04:00
parent c07f7cab37
commit 4c5ed9c068
9 changed files with 436 additions and 436 deletions

View File

@@ -12,8 +12,6 @@
It has these top-level messages:
Descriptor
MetricsRequest
MetricsResponse
Metric
Mount
*/

View File

@@ -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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0x08, 0xb6, 0xd7, 0xce,
0x16, 0xee, 0x8e, 0x10, 0xd9, 0x95, 0x26, 0x6e, 0x86, 0xd5, 0xe0, 0xf0, 0x15, 0xc0, 0x96, 0xbb,
0xf3, 0x23, 0xd8, 0xd9, 0x08, 0x21, 0x30, 0x00, 0x61, 0x77, 0xd4, 0x27, 0x4e, 0x99, 0xd4, 0xca,
0xe4, 0xa1, 0x26, 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, 0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xb1, 0x81,
0xcd, 0x37, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x51, 0x36, 0x74, 0x83, 0x01, 0x00, 0x00,
}

View File

@@ -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;