github.com/yankunsam/loki/v2@v2.6.3-0.20220817130409-389df5235c27/pkg/logproto/metrics.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: pkg/logproto/metrics.proto 3 4 package logproto 5 6 import ( 7 fmt "fmt" 8 _ "github.com/gogo/protobuf/gogoproto" 9 proto "github.com/gogo/protobuf/proto" 10 io "io" 11 math "math" 12 math_bits "math/bits" 13 reflect "reflect" 14 strconv "strconv" 15 strings "strings" 16 ) 17 18 // Reference imports to suppress errors if they are not otherwise used. 19 var _ = proto.Marshal 20 var _ = fmt.Errorf 21 var _ = math.Inf 22 23 // This is a compile-time assertion to ensure that this generated file 24 // is compatible with the proto package it is being compiled against. 25 // A compilation error at this line likely means your copy of the 26 // proto package needs to be updated. 27 const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 28 29 type WriteRequest_SourceEnum int32 30 31 const ( 32 API WriteRequest_SourceEnum = 0 33 RULE WriteRequest_SourceEnum = 1 34 ) 35 36 var WriteRequest_SourceEnum_name = map[int32]string{ 37 0: "API", 38 1: "RULE", 39 } 40 41 var WriteRequest_SourceEnum_value = map[string]int32{ 42 "API": 0, 43 "RULE": 1, 44 } 45 46 func (WriteRequest_SourceEnum) EnumDescriptor() ([]byte, []int) { 47 return fileDescriptor_d2388e514bd0aa0e, []int{0, 0} 48 } 49 50 type MetricMetadata_MetricType int32 51 52 const ( 53 UNKNOWN MetricMetadata_MetricType = 0 54 COUNTER MetricMetadata_MetricType = 1 55 GAUGE MetricMetadata_MetricType = 2 56 HISTOGRAM MetricMetadata_MetricType = 3 57 GAUGEHISTOGRAM MetricMetadata_MetricType = 4 58 SUMMARY MetricMetadata_MetricType = 5 59 INFO MetricMetadata_MetricType = 6 60 STATESET MetricMetadata_MetricType = 7 61 ) 62 63 var MetricMetadata_MetricType_name = map[int32]string{ 64 0: "UNKNOWN", 65 1: "COUNTER", 66 2: "GAUGE", 67 3: "HISTOGRAM", 68 4: "GAUGEHISTOGRAM", 69 5: "SUMMARY", 70 6: "INFO", 71 7: "STATESET", 72 } 73 74 var MetricMetadata_MetricType_value = map[string]int32{ 75 "UNKNOWN": 0, 76 "COUNTER": 1, 77 "GAUGE": 2, 78 "HISTOGRAM": 3, 79 "GAUGEHISTOGRAM": 4, 80 "SUMMARY": 5, 81 "INFO": 6, 82 "STATESET": 7, 83 } 84 85 func (MetricMetadata_MetricType) EnumDescriptor() ([]byte, []int) { 86 return fileDescriptor_d2388e514bd0aa0e, []int{3, 0} 87 } 88 89 type WriteRequest struct { 90 Timeseries []PreallocTimeseries `protobuf:"bytes,1,rep,name=timeseries,proto3,customtype=PreallocTimeseries" json:"timeseries"` 91 Source WriteRequest_SourceEnum `protobuf:"varint,2,opt,name=Source,proto3,enum=logproto.WriteRequest_SourceEnum" json:"Source,omitempty"` 92 Metadata []*MetricMetadata `protobuf:"bytes,3,rep,name=metadata,proto3" json:"metadata,omitempty"` 93 SkipLabelNameValidation bool `protobuf:"varint,1000,opt,name=skip_label_name_validation,json=skipLabelNameValidation,proto3" json:"skip_label_name_validation,omitempty"` 94 } 95 96 func (m *WriteRequest) Reset() { *m = WriteRequest{} } 97 func (*WriteRequest) ProtoMessage() {} 98 func (*WriteRequest) Descriptor() ([]byte, []int) { 99 return fileDescriptor_d2388e514bd0aa0e, []int{0} 100 } 101 func (m *WriteRequest) XXX_Unmarshal(b []byte) error { 102 return m.Unmarshal(b) 103 } 104 func (m *WriteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 105 if deterministic { 106 return xxx_messageInfo_WriteRequest.Marshal(b, m, deterministic) 107 } else { 108 b = b[:cap(b)] 109 n, err := m.MarshalToSizedBuffer(b) 110 if err != nil { 111 return nil, err 112 } 113 return b[:n], nil 114 } 115 } 116 func (m *WriteRequest) XXX_Merge(src proto.Message) { 117 xxx_messageInfo_WriteRequest.Merge(m, src) 118 } 119 func (m *WriteRequest) XXX_Size() int { 120 return m.Size() 121 } 122 func (m *WriteRequest) XXX_DiscardUnknown() { 123 xxx_messageInfo_WriteRequest.DiscardUnknown(m) 124 } 125 126 var xxx_messageInfo_WriteRequest proto.InternalMessageInfo 127 128 func (m *WriteRequest) GetSource() WriteRequest_SourceEnum { 129 if m != nil { 130 return m.Source 131 } 132 return API 133 } 134 135 func (m *WriteRequest) GetMetadata() []*MetricMetadata { 136 if m != nil { 137 return m.Metadata 138 } 139 return nil 140 } 141 142 func (m *WriteRequest) GetSkipLabelNameValidation() bool { 143 if m != nil { 144 return m.SkipLabelNameValidation 145 } 146 return false 147 } 148 149 type WriteResponse struct { 150 } 151 152 func (m *WriteResponse) Reset() { *m = WriteResponse{} } 153 func (*WriteResponse) ProtoMessage() {} 154 func (*WriteResponse) Descriptor() ([]byte, []int) { 155 return fileDescriptor_d2388e514bd0aa0e, []int{1} 156 } 157 func (m *WriteResponse) XXX_Unmarshal(b []byte) error { 158 return m.Unmarshal(b) 159 } 160 func (m *WriteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 161 if deterministic { 162 return xxx_messageInfo_WriteResponse.Marshal(b, m, deterministic) 163 } else { 164 b = b[:cap(b)] 165 n, err := m.MarshalToSizedBuffer(b) 166 if err != nil { 167 return nil, err 168 } 169 return b[:n], nil 170 } 171 } 172 func (m *WriteResponse) XXX_Merge(src proto.Message) { 173 xxx_messageInfo_WriteResponse.Merge(m, src) 174 } 175 func (m *WriteResponse) XXX_Size() int { 176 return m.Size() 177 } 178 func (m *WriteResponse) XXX_DiscardUnknown() { 179 xxx_messageInfo_WriteResponse.DiscardUnknown(m) 180 } 181 182 var xxx_messageInfo_WriteResponse proto.InternalMessageInfo 183 184 type TimeSeries struct { 185 Labels []LabelAdapter `protobuf:"bytes,1,rep,name=labels,proto3,customtype=LabelAdapter" json:"labels"` 186 // Sorted by time, oldest sample first. 187 Samples []LegacySample `protobuf:"bytes,2,rep,name=samples,proto3" json:"samples"` 188 } 189 190 func (m *TimeSeries) Reset() { *m = TimeSeries{} } 191 func (*TimeSeries) ProtoMessage() {} 192 func (*TimeSeries) Descriptor() ([]byte, []int) { 193 return fileDescriptor_d2388e514bd0aa0e, []int{2} 194 } 195 func (m *TimeSeries) XXX_Unmarshal(b []byte) error { 196 return m.Unmarshal(b) 197 } 198 func (m *TimeSeries) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 199 if deterministic { 200 return xxx_messageInfo_TimeSeries.Marshal(b, m, deterministic) 201 } else { 202 b = b[:cap(b)] 203 n, err := m.MarshalToSizedBuffer(b) 204 if err != nil { 205 return nil, err 206 } 207 return b[:n], nil 208 } 209 } 210 func (m *TimeSeries) XXX_Merge(src proto.Message) { 211 xxx_messageInfo_TimeSeries.Merge(m, src) 212 } 213 func (m *TimeSeries) XXX_Size() int { 214 return m.Size() 215 } 216 func (m *TimeSeries) XXX_DiscardUnknown() { 217 xxx_messageInfo_TimeSeries.DiscardUnknown(m) 218 } 219 220 var xxx_messageInfo_TimeSeries proto.InternalMessageInfo 221 222 func (m *TimeSeries) GetSamples() []LegacySample { 223 if m != nil { 224 return m.Samples 225 } 226 return nil 227 } 228 229 type MetricMetadata struct { 230 Type MetricMetadata_MetricType `protobuf:"varint,1,opt,name=type,proto3,enum=logproto.MetricMetadata_MetricType" json:"type,omitempty"` 231 MetricFamilyName string `protobuf:"bytes,2,opt,name=metric_family_name,json=metricFamilyName,proto3" json:"metric_family_name,omitempty"` 232 Help string `protobuf:"bytes,4,opt,name=help,proto3" json:"help,omitempty"` 233 Unit string `protobuf:"bytes,5,opt,name=unit,proto3" json:"unit,omitempty"` 234 } 235 236 func (m *MetricMetadata) Reset() { *m = MetricMetadata{} } 237 func (*MetricMetadata) ProtoMessage() {} 238 func (*MetricMetadata) Descriptor() ([]byte, []int) { 239 return fileDescriptor_d2388e514bd0aa0e, []int{3} 240 } 241 func (m *MetricMetadata) XXX_Unmarshal(b []byte) error { 242 return m.Unmarshal(b) 243 } 244 func (m *MetricMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 245 if deterministic { 246 return xxx_messageInfo_MetricMetadata.Marshal(b, m, deterministic) 247 } else { 248 b = b[:cap(b)] 249 n, err := m.MarshalToSizedBuffer(b) 250 if err != nil { 251 return nil, err 252 } 253 return b[:n], nil 254 } 255 } 256 func (m *MetricMetadata) XXX_Merge(src proto.Message) { 257 xxx_messageInfo_MetricMetadata.Merge(m, src) 258 } 259 func (m *MetricMetadata) XXX_Size() int { 260 return m.Size() 261 } 262 func (m *MetricMetadata) XXX_DiscardUnknown() { 263 xxx_messageInfo_MetricMetadata.DiscardUnknown(m) 264 } 265 266 var xxx_messageInfo_MetricMetadata proto.InternalMessageInfo 267 268 func (m *MetricMetadata) GetType() MetricMetadata_MetricType { 269 if m != nil { 270 return m.Type 271 } 272 return UNKNOWN 273 } 274 275 func (m *MetricMetadata) GetMetricFamilyName() string { 276 if m != nil { 277 return m.MetricFamilyName 278 } 279 return "" 280 } 281 282 func (m *MetricMetadata) GetHelp() string { 283 if m != nil { 284 return m.Help 285 } 286 return "" 287 } 288 289 func (m *MetricMetadata) GetUnit() string { 290 if m != nil { 291 return m.Unit 292 } 293 return "" 294 } 295 296 type Metric struct { 297 Labels []LabelAdapter `protobuf:"bytes,1,rep,name=labels,proto3,customtype=LabelAdapter" json:"labels"` 298 } 299 300 func (m *Metric) Reset() { *m = Metric{} } 301 func (*Metric) ProtoMessage() {} 302 func (*Metric) Descriptor() ([]byte, []int) { 303 return fileDescriptor_d2388e514bd0aa0e, []int{4} 304 } 305 func (m *Metric) XXX_Unmarshal(b []byte) error { 306 return m.Unmarshal(b) 307 } 308 func (m *Metric) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 309 if deterministic { 310 return xxx_messageInfo_Metric.Marshal(b, m, deterministic) 311 } else { 312 b = b[:cap(b)] 313 n, err := m.MarshalToSizedBuffer(b) 314 if err != nil { 315 return nil, err 316 } 317 return b[:n], nil 318 } 319 } 320 func (m *Metric) XXX_Merge(src proto.Message) { 321 xxx_messageInfo_Metric.Merge(m, src) 322 } 323 func (m *Metric) XXX_Size() int { 324 return m.Size() 325 } 326 func (m *Metric) XXX_DiscardUnknown() { 327 xxx_messageInfo_Metric.DiscardUnknown(m) 328 } 329 330 var xxx_messageInfo_Metric proto.InternalMessageInfo 331 332 func init() { 333 proto.RegisterEnum("logproto.WriteRequest_SourceEnum", WriteRequest_SourceEnum_name, WriteRequest_SourceEnum_value) 334 proto.RegisterEnum("logproto.MetricMetadata_MetricType", MetricMetadata_MetricType_name, MetricMetadata_MetricType_value) 335 proto.RegisterType((*WriteRequest)(nil), "logproto.WriteRequest") 336 proto.RegisterType((*WriteResponse)(nil), "logproto.WriteResponse") 337 proto.RegisterType((*TimeSeries)(nil), "logproto.TimeSeries") 338 proto.RegisterType((*MetricMetadata)(nil), "logproto.MetricMetadata") 339 proto.RegisterType((*Metric)(nil), "logproto.Metric") 340 } 341 342 func init() { proto.RegisterFile("pkg/logproto/metrics.proto", fileDescriptor_d2388e514bd0aa0e) } 343 344 var fileDescriptor_d2388e514bd0aa0e = []byte{ 345 // 631 bytes of a gzipped FileDescriptorProto 346 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xcd, 0x6e, 0xd3, 0x40, 347 0x10, 0xf6, 0x26, 0x69, 0x92, 0x4e, 0x7f, 0xb0, 0x56, 0x15, 0x98, 0x20, 0x6d, 0x8a, 0xe1, 0xd0, 348 0x03, 0x24, 0x52, 0x91, 0x40, 0x20, 0x2e, 0x09, 0x4a, 0x43, 0x45, 0xf3, 0xc3, 0xda, 0xa1, 0xa2, 349 0x97, 0x68, 0x93, 0x6e, 0xd3, 0x55, 0xed, 0xd8, 0xd8, 0x0e, 0x52, 0x6e, 0xbc, 0x00, 0x12, 0x67, 350 0x9e, 0x80, 0x27, 0xe0, 0x19, 0x7a, 0xec, 0xb1, 0xe2, 0x50, 0x51, 0xf7, 0xd2, 0x63, 0x1f, 0x01, 351 0x79, 0xed, 0xc4, 0x29, 0x12, 0x37, 0x4e, 0x9e, 0xf9, 0xbe, 0xf9, 0x66, 0x46, 0xdf, 0x78, 0xa1, 352 0xe4, 0x9e, 0x8c, 0xaa, 0x96, 0x33, 0x72, 0x3d, 0x27, 0x70, 0xaa, 0x36, 0x0f, 0x3c, 0x31, 0xf4, 353 0x2b, 0x32, 0xc3, 0xc5, 0x19, 0x5e, 0x7a, 0x3a, 0x12, 0xc1, 0xf1, 0x64, 0x50, 0x19, 0x3a, 0x76, 354 0x75, 0xe4, 0x8c, 0x9c, 0xaa, 0x84, 0x07, 0x93, 0x23, 0x99, 0xc5, 0xda, 0x28, 0x8a, 0x85, 0xa5, 355 0x07, 0xb7, 0x9a, 0xce, 0x82, 0x98, 0xd4, 0x7f, 0x66, 0x60, 0x75, 0xdf, 0x13, 0x01, 0xa7, 0xfc, 356 0xd3, 0x84, 0xfb, 0x01, 0xee, 0x02, 0x04, 0xc2, 0xe6, 0x3e, 0xf7, 0x04, 0xf7, 0x35, 0xb4, 0x99, 357 0xdd, 0x5a, 0xd9, 0xde, 0xa8, 0xcc, 0x55, 0xa6, 0xb0, 0xb9, 0x21, 0xb9, 0x7a, 0xe9, 0xf4, 0xa2, 358 0xac, 0xfc, 0xba, 0x28, 0xe3, 0xae, 0xc7, 0x99, 0x65, 0x39, 0x43, 0x73, 0xae, 0xa3, 0x0b, 0x3d, 359 0xf0, 0x4b, 0xc8, 0x1b, 0xce, 0xc4, 0x1b, 0x72, 0x2d, 0xb3, 0x89, 0xb6, 0xd6, 0xb7, 0x1f, 0xa6, 360 0xdd, 0x16, 0x27, 0x57, 0xe2, 0xa2, 0xc6, 0x78, 0x62, 0xd3, 0x44, 0x80, 0x5f, 0x41, 0xd1, 0xe6, 361 0x01, 0x3b, 0x64, 0x01, 0xd3, 0xb2, 0x72, 0x15, 0x2d, 0x15, 0xb7, 0xa4, 0x3d, 0xad, 0x84, 0xaf, 362 0xe7, 0x4e, 0x2f, 0xca, 0x88, 0xce, 0xeb, 0xf1, 0x6b, 0x28, 0xf9, 0x27, 0xc2, 0xed, 0x5b, 0x6c, 363 0xc0, 0xad, 0xfe, 0x98, 0xd9, 0xbc, 0xff, 0x99, 0x59, 0xe2, 0x90, 0x05, 0xc2, 0x19, 0x6b, 0xd7, 364 0x85, 0x4d, 0xb4, 0x55, 0xa4, 0xf7, 0xa2, 0x92, 0xbd, 0xa8, 0xa2, 0xcd, 0x6c, 0xfe, 0x61, 0xce, 365 0xeb, 0x65, 0x80, 0x74, 0x1f, 0x5c, 0x80, 0x6c, 0xad, 0xbb, 0xab, 0x2a, 0xb8, 0x08, 0x39, 0xda, 366 0xdb, 0x6b, 0xa8, 0x48, 0xbf, 0x03, 0x6b, 0xc9, 0xf6, 0xbe, 0xeb, 0x8c, 0x7d, 0xae, 0x7f, 0x45, 367 0x00, 0xa9, 0x3b, 0xb8, 0x09, 0x79, 0x39, 0x79, 0xe6, 0xe1, 0xfd, 0x74, 0xf1, 0x3d, 0x3e, 0x62, 368 0xc3, 0xa9, 0x9c, 0xda, 0x65, 0xc2, 0xab, 0x6f, 0x24, 0x46, 0xae, 0x4a, 0xa8, 0x76, 0xc8, 0xdc, 369 0x80, 0x7b, 0x34, 0x91, 0xe3, 0xe7, 0x50, 0xf0, 0x99, 0xed, 0x5a, 0xdc, 0xd7, 0x32, 0xb2, 0xd3, 370 0xdd, 0xbf, 0x3b, 0x19, 0x92, 0x96, 0x06, 0x28, 0x74, 0x56, 0xac, 0x7f, 0xcf, 0xc0, 0xfa, 0x6d, 371 0x8b, 0xf0, 0x0b, 0xc8, 0x05, 0x53, 0x97, 0x6b, 0x48, 0xde, 0xe1, 0xd1, 0xbf, 0xac, 0x4c, 0x52, 372 0x73, 0xea, 0x72, 0x2a, 0x05, 0xf8, 0x09, 0xe0, 0xf8, 0x67, 0xec, 0x1f, 0x31, 0x5b, 0x58, 0x53, 373 0x69, 0xa7, 0x3c, 0xe7, 0x32, 0x55, 0x63, 0x66, 0x47, 0x12, 0x91, 0x8b, 0x18, 0x43, 0xee, 0x98, 374 0x5b, 0xae, 0x96, 0x93, 0xbc, 0x8c, 0x23, 0x6c, 0x32, 0x16, 0x81, 0xb6, 0x14, 0x63, 0x51, 0xac, 375 0x4f, 0x01, 0xd2, 0x49, 0x78, 0x05, 0x0a, 0xbd, 0xf6, 0xbb, 0x76, 0x67, 0xbf, 0xad, 0x2a, 0x51, 376 0xf2, 0xa6, 0xd3, 0x6b, 0x9b, 0x0d, 0xaa, 0x22, 0xbc, 0x0c, 0x4b, 0xcd, 0x5a, 0xaf, 0xd9, 0x50, 377 0x33, 0x78, 0x0d, 0x96, 0xdf, 0xee, 0x1a, 0x66, 0xa7, 0x49, 0x6b, 0x2d, 0x35, 0x8b, 0x31, 0xac, 378 0x4b, 0x26, 0xc5, 0x72, 0x91, 0xd4, 0xe8, 0xb5, 0x5a, 0x35, 0xfa, 0x51, 0x5d, 0x8a, 0xee, 0xb5, 379 0xdb, 0xde, 0xe9, 0xa8, 0x79, 0xbc, 0x0a, 0x45, 0xc3, 0xac, 0x99, 0x0d, 0xa3, 0x61, 0xaa, 0x05, 380 0xfd, 0x3d, 0xe4, 0xe3, 0xd1, 0xff, 0xed, 0x4e, 0xf5, 0x83, 0xb3, 0x4b, 0xa2, 0x9c, 0x5f, 0x12, 381 0xe5, 0xe6, 0x92, 0xa0, 0x2f, 0x21, 0x41, 0x3f, 0x42, 0x82, 0x4e, 0x43, 0x82, 0xce, 0x42, 0x82, 382 0x7e, 0x87, 0x04, 0x5d, 0x87, 0x44, 0xb9, 0x09, 0x09, 0xfa, 0x76, 0x45, 0x94, 0xb3, 0x2b, 0xa2, 383 0x9c, 0x5f, 0x11, 0xe5, 0xe0, 0xf1, 0xe2, 0x5b, 0xf6, 0xd8, 0x11, 0x1b, 0xb3, 0xaa, 0xe5, 0x9c, 384 0x88, 0xea, 0xe2, 0xa3, 0x1d, 0xe4, 0xe5, 0xe7, 0xd9, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfb, 385 0x14, 0x52, 0xd7, 0x20, 0x04, 0x00, 0x00, 386 } 387 388 func (x WriteRequest_SourceEnum) String() string { 389 s, ok := WriteRequest_SourceEnum_name[int32(x)] 390 if ok { 391 return s 392 } 393 return strconv.Itoa(int(x)) 394 } 395 func (x MetricMetadata_MetricType) String() string { 396 s, ok := MetricMetadata_MetricType_name[int32(x)] 397 if ok { 398 return s 399 } 400 return strconv.Itoa(int(x)) 401 } 402 func (this *WriteRequest) Equal(that interface{}) bool { 403 if that == nil { 404 return this == nil 405 } 406 407 that1, ok := that.(*WriteRequest) 408 if !ok { 409 that2, ok := that.(WriteRequest) 410 if ok { 411 that1 = &that2 412 } else { 413 return false 414 } 415 } 416 if that1 == nil { 417 return this == nil 418 } else if this == nil { 419 return false 420 } 421 if len(this.Timeseries) != len(that1.Timeseries) { 422 return false 423 } 424 for i := range this.Timeseries { 425 if !this.Timeseries[i].Equal(that1.Timeseries[i]) { 426 return false 427 } 428 } 429 if this.Source != that1.Source { 430 return false 431 } 432 if len(this.Metadata) != len(that1.Metadata) { 433 return false 434 } 435 for i := range this.Metadata { 436 if !this.Metadata[i].Equal(that1.Metadata[i]) { 437 return false 438 } 439 } 440 if this.SkipLabelNameValidation != that1.SkipLabelNameValidation { 441 return false 442 } 443 return true 444 } 445 func (this *WriteResponse) Equal(that interface{}) bool { 446 if that == nil { 447 return this == nil 448 } 449 450 that1, ok := that.(*WriteResponse) 451 if !ok { 452 that2, ok := that.(WriteResponse) 453 if ok { 454 that1 = &that2 455 } else { 456 return false 457 } 458 } 459 if that1 == nil { 460 return this == nil 461 } else if this == nil { 462 return false 463 } 464 return true 465 } 466 func (this *TimeSeries) Equal(that interface{}) bool { 467 if that == nil { 468 return this == nil 469 } 470 471 that1, ok := that.(*TimeSeries) 472 if !ok { 473 that2, ok := that.(TimeSeries) 474 if ok { 475 that1 = &that2 476 } else { 477 return false 478 } 479 } 480 if that1 == nil { 481 return this == nil 482 } else if this == nil { 483 return false 484 } 485 if len(this.Labels) != len(that1.Labels) { 486 return false 487 } 488 for i := range this.Labels { 489 if !this.Labels[i].Equal(that1.Labels[i]) { 490 return false 491 } 492 } 493 if len(this.Samples) != len(that1.Samples) { 494 return false 495 } 496 for i := range this.Samples { 497 if !this.Samples[i].Equal(&that1.Samples[i]) { 498 return false 499 } 500 } 501 return true 502 } 503 func (this *MetricMetadata) Equal(that interface{}) bool { 504 if that == nil { 505 return this == nil 506 } 507 508 that1, ok := that.(*MetricMetadata) 509 if !ok { 510 that2, ok := that.(MetricMetadata) 511 if ok { 512 that1 = &that2 513 } else { 514 return false 515 } 516 } 517 if that1 == nil { 518 return this == nil 519 } else if this == nil { 520 return false 521 } 522 if this.Type != that1.Type { 523 return false 524 } 525 if this.MetricFamilyName != that1.MetricFamilyName { 526 return false 527 } 528 if this.Help != that1.Help { 529 return false 530 } 531 if this.Unit != that1.Unit { 532 return false 533 } 534 return true 535 } 536 func (this *Metric) Equal(that interface{}) bool { 537 if that == nil { 538 return this == nil 539 } 540 541 that1, ok := that.(*Metric) 542 if !ok { 543 that2, ok := that.(Metric) 544 if ok { 545 that1 = &that2 546 } else { 547 return false 548 } 549 } 550 if that1 == nil { 551 return this == nil 552 } else if this == nil { 553 return false 554 } 555 if len(this.Labels) != len(that1.Labels) { 556 return false 557 } 558 for i := range this.Labels { 559 if !this.Labels[i].Equal(that1.Labels[i]) { 560 return false 561 } 562 } 563 return true 564 } 565 func (this *WriteRequest) GoString() string { 566 if this == nil { 567 return "nil" 568 } 569 s := make([]string, 0, 8) 570 s = append(s, "&logproto.WriteRequest{") 571 s = append(s, "Timeseries: "+fmt.Sprintf("%#v", this.Timeseries)+",\n") 572 s = append(s, "Source: "+fmt.Sprintf("%#v", this.Source)+",\n") 573 if this.Metadata != nil { 574 s = append(s, "Metadata: "+fmt.Sprintf("%#v", this.Metadata)+",\n") 575 } 576 s = append(s, "SkipLabelNameValidation: "+fmt.Sprintf("%#v", this.SkipLabelNameValidation)+",\n") 577 s = append(s, "}") 578 return strings.Join(s, "") 579 } 580 func (this *WriteResponse) GoString() string { 581 if this == nil { 582 return "nil" 583 } 584 s := make([]string, 0, 4) 585 s = append(s, "&logproto.WriteResponse{") 586 s = append(s, "}") 587 return strings.Join(s, "") 588 } 589 func (this *TimeSeries) GoString() string { 590 if this == nil { 591 return "nil" 592 } 593 s := make([]string, 0, 6) 594 s = append(s, "&logproto.TimeSeries{") 595 s = append(s, "Labels: "+fmt.Sprintf("%#v", this.Labels)+",\n") 596 if this.Samples != nil { 597 vs := make([]*LegacySample, len(this.Samples)) 598 for i := range vs { 599 vs[i] = &this.Samples[i] 600 } 601 s = append(s, "Samples: "+fmt.Sprintf("%#v", vs)+",\n") 602 } 603 s = append(s, "}") 604 return strings.Join(s, "") 605 } 606 func (this *MetricMetadata) GoString() string { 607 if this == nil { 608 return "nil" 609 } 610 s := make([]string, 0, 8) 611 s = append(s, "&logproto.MetricMetadata{") 612 s = append(s, "Type: "+fmt.Sprintf("%#v", this.Type)+",\n") 613 s = append(s, "MetricFamilyName: "+fmt.Sprintf("%#v", this.MetricFamilyName)+",\n") 614 s = append(s, "Help: "+fmt.Sprintf("%#v", this.Help)+",\n") 615 s = append(s, "Unit: "+fmt.Sprintf("%#v", this.Unit)+",\n") 616 s = append(s, "}") 617 return strings.Join(s, "") 618 } 619 func (this *Metric) GoString() string { 620 if this == nil { 621 return "nil" 622 } 623 s := make([]string, 0, 5) 624 s = append(s, "&logproto.Metric{") 625 s = append(s, "Labels: "+fmt.Sprintf("%#v", this.Labels)+",\n") 626 s = append(s, "}") 627 return strings.Join(s, "") 628 } 629 func valueToGoStringMetrics(v interface{}, typ string) string { 630 rv := reflect.ValueOf(v) 631 if rv.IsNil() { 632 return "nil" 633 } 634 pv := reflect.Indirect(rv).Interface() 635 return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) 636 } 637 func (m *WriteRequest) Marshal() (dAtA []byte, err error) { 638 size := m.Size() 639 dAtA = make([]byte, size) 640 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 641 if err != nil { 642 return nil, err 643 } 644 return dAtA[:n], nil 645 } 646 647 func (m *WriteRequest) MarshalTo(dAtA []byte) (int, error) { 648 size := m.Size() 649 return m.MarshalToSizedBuffer(dAtA[:size]) 650 } 651 652 func (m *WriteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { 653 i := len(dAtA) 654 _ = i 655 var l int 656 _ = l 657 if m.SkipLabelNameValidation { 658 i-- 659 if m.SkipLabelNameValidation { 660 dAtA[i] = 1 661 } else { 662 dAtA[i] = 0 663 } 664 i-- 665 dAtA[i] = 0x3e 666 i-- 667 dAtA[i] = 0xc0 668 } 669 if len(m.Metadata) > 0 { 670 for iNdEx := len(m.Metadata) - 1; iNdEx >= 0; iNdEx-- { 671 { 672 size, err := m.Metadata[iNdEx].MarshalToSizedBuffer(dAtA[:i]) 673 if err != nil { 674 return 0, err 675 } 676 i -= size 677 i = encodeVarintMetrics(dAtA, i, uint64(size)) 678 } 679 i-- 680 dAtA[i] = 0x1a 681 } 682 } 683 if m.Source != 0 { 684 i = encodeVarintMetrics(dAtA, i, uint64(m.Source)) 685 i-- 686 dAtA[i] = 0x10 687 } 688 if len(m.Timeseries) > 0 { 689 for iNdEx := len(m.Timeseries) - 1; iNdEx >= 0; iNdEx-- { 690 { 691 size := m.Timeseries[iNdEx].Size() 692 i -= size 693 if _, err := m.Timeseries[iNdEx].MarshalTo(dAtA[i:]); err != nil { 694 return 0, err 695 } 696 i = encodeVarintMetrics(dAtA, i, uint64(size)) 697 } 698 i-- 699 dAtA[i] = 0xa 700 } 701 } 702 return len(dAtA) - i, nil 703 } 704 705 func (m *WriteResponse) Marshal() (dAtA []byte, err error) { 706 size := m.Size() 707 dAtA = make([]byte, size) 708 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 709 if err != nil { 710 return nil, err 711 } 712 return dAtA[:n], nil 713 } 714 715 func (m *WriteResponse) MarshalTo(dAtA []byte) (int, error) { 716 size := m.Size() 717 return m.MarshalToSizedBuffer(dAtA[:size]) 718 } 719 720 func (m *WriteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { 721 i := len(dAtA) 722 _ = i 723 var l int 724 _ = l 725 return len(dAtA) - i, nil 726 } 727 728 func (m *TimeSeries) Marshal() (dAtA []byte, err error) { 729 size := m.Size() 730 dAtA = make([]byte, size) 731 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 732 if err != nil { 733 return nil, err 734 } 735 return dAtA[:n], nil 736 } 737 738 func (m *TimeSeries) MarshalTo(dAtA []byte) (int, error) { 739 size := m.Size() 740 return m.MarshalToSizedBuffer(dAtA[:size]) 741 } 742 743 func (m *TimeSeries) MarshalToSizedBuffer(dAtA []byte) (int, error) { 744 i := len(dAtA) 745 _ = i 746 var l int 747 _ = l 748 if len(m.Samples) > 0 { 749 for iNdEx := len(m.Samples) - 1; iNdEx >= 0; iNdEx-- { 750 { 751 size, err := m.Samples[iNdEx].MarshalToSizedBuffer(dAtA[:i]) 752 if err != nil { 753 return 0, err 754 } 755 i -= size 756 i = encodeVarintMetrics(dAtA, i, uint64(size)) 757 } 758 i-- 759 dAtA[i] = 0x12 760 } 761 } 762 if len(m.Labels) > 0 { 763 for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { 764 { 765 size := m.Labels[iNdEx].Size() 766 i -= size 767 if _, err := m.Labels[iNdEx].MarshalTo(dAtA[i:]); err != nil { 768 return 0, err 769 } 770 i = encodeVarintMetrics(dAtA, i, uint64(size)) 771 } 772 i-- 773 dAtA[i] = 0xa 774 } 775 } 776 return len(dAtA) - i, nil 777 } 778 779 func (m *MetricMetadata) Marshal() (dAtA []byte, err error) { 780 size := m.Size() 781 dAtA = make([]byte, size) 782 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 783 if err != nil { 784 return nil, err 785 } 786 return dAtA[:n], nil 787 } 788 789 func (m *MetricMetadata) MarshalTo(dAtA []byte) (int, error) { 790 size := m.Size() 791 return m.MarshalToSizedBuffer(dAtA[:size]) 792 } 793 794 func (m *MetricMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { 795 i := len(dAtA) 796 _ = i 797 var l int 798 _ = l 799 if len(m.Unit) > 0 { 800 i -= len(m.Unit) 801 copy(dAtA[i:], m.Unit) 802 i = encodeVarintMetrics(dAtA, i, uint64(len(m.Unit))) 803 i-- 804 dAtA[i] = 0x2a 805 } 806 if len(m.Help) > 0 { 807 i -= len(m.Help) 808 copy(dAtA[i:], m.Help) 809 i = encodeVarintMetrics(dAtA, i, uint64(len(m.Help))) 810 i-- 811 dAtA[i] = 0x22 812 } 813 if len(m.MetricFamilyName) > 0 { 814 i -= len(m.MetricFamilyName) 815 copy(dAtA[i:], m.MetricFamilyName) 816 i = encodeVarintMetrics(dAtA, i, uint64(len(m.MetricFamilyName))) 817 i-- 818 dAtA[i] = 0x12 819 } 820 if m.Type != 0 { 821 i = encodeVarintMetrics(dAtA, i, uint64(m.Type)) 822 i-- 823 dAtA[i] = 0x8 824 } 825 return len(dAtA) - i, nil 826 } 827 828 func (m *Metric) Marshal() (dAtA []byte, err error) { 829 size := m.Size() 830 dAtA = make([]byte, size) 831 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 832 if err != nil { 833 return nil, err 834 } 835 return dAtA[:n], nil 836 } 837 838 func (m *Metric) MarshalTo(dAtA []byte) (int, error) { 839 size := m.Size() 840 return m.MarshalToSizedBuffer(dAtA[:size]) 841 } 842 843 func (m *Metric) MarshalToSizedBuffer(dAtA []byte) (int, error) { 844 i := len(dAtA) 845 _ = i 846 var l int 847 _ = l 848 if len(m.Labels) > 0 { 849 for iNdEx := len(m.Labels) - 1; iNdEx >= 0; iNdEx-- { 850 { 851 size := m.Labels[iNdEx].Size() 852 i -= size 853 if _, err := m.Labels[iNdEx].MarshalTo(dAtA[i:]); err != nil { 854 return 0, err 855 } 856 i = encodeVarintMetrics(dAtA, i, uint64(size)) 857 } 858 i-- 859 dAtA[i] = 0xa 860 } 861 } 862 return len(dAtA) - i, nil 863 } 864 865 func encodeVarintMetrics(dAtA []byte, offset int, v uint64) int { 866 offset -= sovMetrics(v) 867 base := offset 868 for v >= 1<<7 { 869 dAtA[offset] = uint8(v&0x7f | 0x80) 870 v >>= 7 871 offset++ 872 } 873 dAtA[offset] = uint8(v) 874 return base 875 } 876 func (m *WriteRequest) Size() (n int) { 877 if m == nil { 878 return 0 879 } 880 var l int 881 _ = l 882 if len(m.Timeseries) > 0 { 883 for _, e := range m.Timeseries { 884 l = e.Size() 885 n += 1 + l + sovMetrics(uint64(l)) 886 } 887 } 888 if m.Source != 0 { 889 n += 1 + sovMetrics(uint64(m.Source)) 890 } 891 if len(m.Metadata) > 0 { 892 for _, e := range m.Metadata { 893 l = e.Size() 894 n += 1 + l + sovMetrics(uint64(l)) 895 } 896 } 897 if m.SkipLabelNameValidation { 898 n += 3 899 } 900 return n 901 } 902 903 func (m *WriteResponse) Size() (n int) { 904 if m == nil { 905 return 0 906 } 907 var l int 908 _ = l 909 return n 910 } 911 912 func (m *TimeSeries) Size() (n int) { 913 if m == nil { 914 return 0 915 } 916 var l int 917 _ = l 918 if len(m.Labels) > 0 { 919 for _, e := range m.Labels { 920 l = e.Size() 921 n += 1 + l + sovMetrics(uint64(l)) 922 } 923 } 924 if len(m.Samples) > 0 { 925 for _, e := range m.Samples { 926 l = e.Size() 927 n += 1 + l + sovMetrics(uint64(l)) 928 } 929 } 930 return n 931 } 932 933 func (m *MetricMetadata) Size() (n int) { 934 if m == nil { 935 return 0 936 } 937 var l int 938 _ = l 939 if m.Type != 0 { 940 n += 1 + sovMetrics(uint64(m.Type)) 941 } 942 l = len(m.MetricFamilyName) 943 if l > 0 { 944 n += 1 + l + sovMetrics(uint64(l)) 945 } 946 l = len(m.Help) 947 if l > 0 { 948 n += 1 + l + sovMetrics(uint64(l)) 949 } 950 l = len(m.Unit) 951 if l > 0 { 952 n += 1 + l + sovMetrics(uint64(l)) 953 } 954 return n 955 } 956 957 func (m *Metric) Size() (n int) { 958 if m == nil { 959 return 0 960 } 961 var l int 962 _ = l 963 if len(m.Labels) > 0 { 964 for _, e := range m.Labels { 965 l = e.Size() 966 n += 1 + l + sovMetrics(uint64(l)) 967 } 968 } 969 return n 970 } 971 972 func sovMetrics(x uint64) (n int) { 973 return (math_bits.Len64(x|1) + 6) / 7 974 } 975 func sozMetrics(x uint64) (n int) { 976 return sovMetrics(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 977 } 978 func (this *WriteRequest) String() string { 979 if this == nil { 980 return "nil" 981 } 982 repeatedStringForMetadata := "[]*MetricMetadata{" 983 for _, f := range this.Metadata { 984 repeatedStringForMetadata += strings.Replace(f.String(), "MetricMetadata", "MetricMetadata", 1) + "," 985 } 986 repeatedStringForMetadata += "}" 987 s := strings.Join([]string{`&WriteRequest{`, 988 `Timeseries:` + fmt.Sprintf("%v", this.Timeseries) + `,`, 989 `Source:` + fmt.Sprintf("%v", this.Source) + `,`, 990 `Metadata:` + repeatedStringForMetadata + `,`, 991 `SkipLabelNameValidation:` + fmt.Sprintf("%v", this.SkipLabelNameValidation) + `,`, 992 `}`, 993 }, "") 994 return s 995 } 996 func (this *WriteResponse) String() string { 997 if this == nil { 998 return "nil" 999 } 1000 s := strings.Join([]string{`&WriteResponse{`, 1001 `}`, 1002 }, "") 1003 return s 1004 } 1005 func (this *TimeSeries) String() string { 1006 if this == nil { 1007 return "nil" 1008 } 1009 repeatedStringForSamples := "[]LegacySample{" 1010 for _, f := range this.Samples { 1011 repeatedStringForSamples += fmt.Sprintf("%v", f) + "," 1012 } 1013 repeatedStringForSamples += "}" 1014 s := strings.Join([]string{`&TimeSeries{`, 1015 `Labels:` + fmt.Sprintf("%v", this.Labels) + `,`, 1016 `Samples:` + repeatedStringForSamples + `,`, 1017 `}`, 1018 }, "") 1019 return s 1020 } 1021 func (this *MetricMetadata) String() string { 1022 if this == nil { 1023 return "nil" 1024 } 1025 s := strings.Join([]string{`&MetricMetadata{`, 1026 `Type:` + fmt.Sprintf("%v", this.Type) + `,`, 1027 `MetricFamilyName:` + fmt.Sprintf("%v", this.MetricFamilyName) + `,`, 1028 `Help:` + fmt.Sprintf("%v", this.Help) + `,`, 1029 `Unit:` + fmt.Sprintf("%v", this.Unit) + `,`, 1030 `}`, 1031 }, "") 1032 return s 1033 } 1034 func (this *Metric) String() string { 1035 if this == nil { 1036 return "nil" 1037 } 1038 s := strings.Join([]string{`&Metric{`, 1039 `Labels:` + fmt.Sprintf("%v", this.Labels) + `,`, 1040 `}`, 1041 }, "") 1042 return s 1043 } 1044 func valueToStringMetrics(v interface{}) string { 1045 rv := reflect.ValueOf(v) 1046 if rv.IsNil() { 1047 return "nil" 1048 } 1049 pv := reflect.Indirect(rv).Interface() 1050 return fmt.Sprintf("*%v", pv) 1051 } 1052 func (m *WriteRequest) Unmarshal(dAtA []byte) error { 1053 l := len(dAtA) 1054 iNdEx := 0 1055 for iNdEx < l { 1056 preIndex := iNdEx 1057 var wire uint64 1058 for shift := uint(0); ; shift += 7 { 1059 if shift >= 64 { 1060 return ErrIntOverflowMetrics 1061 } 1062 if iNdEx >= l { 1063 return io.ErrUnexpectedEOF 1064 } 1065 b := dAtA[iNdEx] 1066 iNdEx++ 1067 wire |= uint64(b&0x7F) << shift 1068 if b < 0x80 { 1069 break 1070 } 1071 } 1072 fieldNum := int32(wire >> 3) 1073 wireType := int(wire & 0x7) 1074 if wireType == 4 { 1075 return fmt.Errorf("proto: WriteRequest: wiretype end group for non-group") 1076 } 1077 if fieldNum <= 0 { 1078 return fmt.Errorf("proto: WriteRequest: illegal tag %d (wire type %d)", fieldNum, wire) 1079 } 1080 switch fieldNum { 1081 case 1: 1082 if wireType != 2 { 1083 return fmt.Errorf("proto: wrong wireType = %d for field Timeseries", wireType) 1084 } 1085 var msglen int 1086 for shift := uint(0); ; shift += 7 { 1087 if shift >= 64 { 1088 return ErrIntOverflowMetrics 1089 } 1090 if iNdEx >= l { 1091 return io.ErrUnexpectedEOF 1092 } 1093 b := dAtA[iNdEx] 1094 iNdEx++ 1095 msglen |= int(b&0x7F) << shift 1096 if b < 0x80 { 1097 break 1098 } 1099 } 1100 if msglen < 0 { 1101 return ErrInvalidLengthMetrics 1102 } 1103 postIndex := iNdEx + msglen 1104 if postIndex < 0 { 1105 return ErrInvalidLengthMetrics 1106 } 1107 if postIndex > l { 1108 return io.ErrUnexpectedEOF 1109 } 1110 m.Timeseries = append(m.Timeseries, PreallocTimeseries{}) 1111 if err := m.Timeseries[len(m.Timeseries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 1112 return err 1113 } 1114 iNdEx = postIndex 1115 case 2: 1116 if wireType != 0 { 1117 return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) 1118 } 1119 m.Source = 0 1120 for shift := uint(0); ; shift += 7 { 1121 if shift >= 64 { 1122 return ErrIntOverflowMetrics 1123 } 1124 if iNdEx >= l { 1125 return io.ErrUnexpectedEOF 1126 } 1127 b := dAtA[iNdEx] 1128 iNdEx++ 1129 m.Source |= WriteRequest_SourceEnum(b&0x7F) << shift 1130 if b < 0x80 { 1131 break 1132 } 1133 } 1134 case 3: 1135 if wireType != 2 { 1136 return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) 1137 } 1138 var msglen int 1139 for shift := uint(0); ; shift += 7 { 1140 if shift >= 64 { 1141 return ErrIntOverflowMetrics 1142 } 1143 if iNdEx >= l { 1144 return io.ErrUnexpectedEOF 1145 } 1146 b := dAtA[iNdEx] 1147 iNdEx++ 1148 msglen |= int(b&0x7F) << shift 1149 if b < 0x80 { 1150 break 1151 } 1152 } 1153 if msglen < 0 { 1154 return ErrInvalidLengthMetrics 1155 } 1156 postIndex := iNdEx + msglen 1157 if postIndex < 0 { 1158 return ErrInvalidLengthMetrics 1159 } 1160 if postIndex > l { 1161 return io.ErrUnexpectedEOF 1162 } 1163 m.Metadata = append(m.Metadata, &MetricMetadata{}) 1164 if err := m.Metadata[len(m.Metadata)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 1165 return err 1166 } 1167 iNdEx = postIndex 1168 case 1000: 1169 if wireType != 0 { 1170 return fmt.Errorf("proto: wrong wireType = %d for field SkipLabelNameValidation", wireType) 1171 } 1172 var v int 1173 for shift := uint(0); ; shift += 7 { 1174 if shift >= 64 { 1175 return ErrIntOverflowMetrics 1176 } 1177 if iNdEx >= l { 1178 return io.ErrUnexpectedEOF 1179 } 1180 b := dAtA[iNdEx] 1181 iNdEx++ 1182 v |= int(b&0x7F) << shift 1183 if b < 0x80 { 1184 break 1185 } 1186 } 1187 m.SkipLabelNameValidation = bool(v != 0) 1188 default: 1189 iNdEx = preIndex 1190 skippy, err := skipMetrics(dAtA[iNdEx:]) 1191 if err != nil { 1192 return err 1193 } 1194 if skippy < 0 { 1195 return ErrInvalidLengthMetrics 1196 } 1197 if (iNdEx + skippy) < 0 { 1198 return ErrInvalidLengthMetrics 1199 } 1200 if (iNdEx + skippy) > l { 1201 return io.ErrUnexpectedEOF 1202 } 1203 iNdEx += skippy 1204 } 1205 } 1206 1207 if iNdEx > l { 1208 return io.ErrUnexpectedEOF 1209 } 1210 return nil 1211 } 1212 func (m *WriteResponse) Unmarshal(dAtA []byte) error { 1213 l := len(dAtA) 1214 iNdEx := 0 1215 for iNdEx < l { 1216 preIndex := iNdEx 1217 var wire uint64 1218 for shift := uint(0); ; shift += 7 { 1219 if shift >= 64 { 1220 return ErrIntOverflowMetrics 1221 } 1222 if iNdEx >= l { 1223 return io.ErrUnexpectedEOF 1224 } 1225 b := dAtA[iNdEx] 1226 iNdEx++ 1227 wire |= uint64(b&0x7F) << shift 1228 if b < 0x80 { 1229 break 1230 } 1231 } 1232 fieldNum := int32(wire >> 3) 1233 wireType := int(wire & 0x7) 1234 if wireType == 4 { 1235 return fmt.Errorf("proto: WriteResponse: wiretype end group for non-group") 1236 } 1237 if fieldNum <= 0 { 1238 return fmt.Errorf("proto: WriteResponse: illegal tag %d (wire type %d)", fieldNum, wire) 1239 } 1240 switch fieldNum { 1241 default: 1242 iNdEx = preIndex 1243 skippy, err := skipMetrics(dAtA[iNdEx:]) 1244 if err != nil { 1245 return err 1246 } 1247 if skippy < 0 { 1248 return ErrInvalidLengthMetrics 1249 } 1250 if (iNdEx + skippy) < 0 { 1251 return ErrInvalidLengthMetrics 1252 } 1253 if (iNdEx + skippy) > l { 1254 return io.ErrUnexpectedEOF 1255 } 1256 iNdEx += skippy 1257 } 1258 } 1259 1260 if iNdEx > l { 1261 return io.ErrUnexpectedEOF 1262 } 1263 return nil 1264 } 1265 func (m *TimeSeries) Unmarshal(dAtA []byte) error { 1266 l := len(dAtA) 1267 iNdEx := 0 1268 for iNdEx < l { 1269 preIndex := iNdEx 1270 var wire uint64 1271 for shift := uint(0); ; shift += 7 { 1272 if shift >= 64 { 1273 return ErrIntOverflowMetrics 1274 } 1275 if iNdEx >= l { 1276 return io.ErrUnexpectedEOF 1277 } 1278 b := dAtA[iNdEx] 1279 iNdEx++ 1280 wire |= uint64(b&0x7F) << shift 1281 if b < 0x80 { 1282 break 1283 } 1284 } 1285 fieldNum := int32(wire >> 3) 1286 wireType := int(wire & 0x7) 1287 if wireType == 4 { 1288 return fmt.Errorf("proto: TimeSeries: wiretype end group for non-group") 1289 } 1290 if fieldNum <= 0 { 1291 return fmt.Errorf("proto: TimeSeries: illegal tag %d (wire type %d)", fieldNum, wire) 1292 } 1293 switch fieldNum { 1294 case 1: 1295 if wireType != 2 { 1296 return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) 1297 } 1298 var msglen int 1299 for shift := uint(0); ; shift += 7 { 1300 if shift >= 64 { 1301 return ErrIntOverflowMetrics 1302 } 1303 if iNdEx >= l { 1304 return io.ErrUnexpectedEOF 1305 } 1306 b := dAtA[iNdEx] 1307 iNdEx++ 1308 msglen |= int(b&0x7F) << shift 1309 if b < 0x80 { 1310 break 1311 } 1312 } 1313 if msglen < 0 { 1314 return ErrInvalidLengthMetrics 1315 } 1316 postIndex := iNdEx + msglen 1317 if postIndex < 0 { 1318 return ErrInvalidLengthMetrics 1319 } 1320 if postIndex > l { 1321 return io.ErrUnexpectedEOF 1322 } 1323 m.Labels = append(m.Labels, LabelAdapter{}) 1324 if err := m.Labels[len(m.Labels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 1325 return err 1326 } 1327 iNdEx = postIndex 1328 case 2: 1329 if wireType != 2 { 1330 return fmt.Errorf("proto: wrong wireType = %d for field Samples", wireType) 1331 } 1332 var msglen int 1333 for shift := uint(0); ; shift += 7 { 1334 if shift >= 64 { 1335 return ErrIntOverflowMetrics 1336 } 1337 if iNdEx >= l { 1338 return io.ErrUnexpectedEOF 1339 } 1340 b := dAtA[iNdEx] 1341 iNdEx++ 1342 msglen |= int(b&0x7F) << shift 1343 if b < 0x80 { 1344 break 1345 } 1346 } 1347 if msglen < 0 { 1348 return ErrInvalidLengthMetrics 1349 } 1350 postIndex := iNdEx + msglen 1351 if postIndex < 0 { 1352 return ErrInvalidLengthMetrics 1353 } 1354 if postIndex > l { 1355 return io.ErrUnexpectedEOF 1356 } 1357 m.Samples = append(m.Samples, LegacySample{}) 1358 if err := m.Samples[len(m.Samples)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 1359 return err 1360 } 1361 iNdEx = postIndex 1362 default: 1363 iNdEx = preIndex 1364 skippy, err := skipMetrics(dAtA[iNdEx:]) 1365 if err != nil { 1366 return err 1367 } 1368 if skippy < 0 { 1369 return ErrInvalidLengthMetrics 1370 } 1371 if (iNdEx + skippy) < 0 { 1372 return ErrInvalidLengthMetrics 1373 } 1374 if (iNdEx + skippy) > l { 1375 return io.ErrUnexpectedEOF 1376 } 1377 iNdEx += skippy 1378 } 1379 } 1380 1381 if iNdEx > l { 1382 return io.ErrUnexpectedEOF 1383 } 1384 return nil 1385 } 1386 func (m *MetricMetadata) Unmarshal(dAtA []byte) error { 1387 l := len(dAtA) 1388 iNdEx := 0 1389 for iNdEx < l { 1390 preIndex := iNdEx 1391 var wire uint64 1392 for shift := uint(0); ; shift += 7 { 1393 if shift >= 64 { 1394 return ErrIntOverflowMetrics 1395 } 1396 if iNdEx >= l { 1397 return io.ErrUnexpectedEOF 1398 } 1399 b := dAtA[iNdEx] 1400 iNdEx++ 1401 wire |= uint64(b&0x7F) << shift 1402 if b < 0x80 { 1403 break 1404 } 1405 } 1406 fieldNum := int32(wire >> 3) 1407 wireType := int(wire & 0x7) 1408 if wireType == 4 { 1409 return fmt.Errorf("proto: MetricMetadata: wiretype end group for non-group") 1410 } 1411 if fieldNum <= 0 { 1412 return fmt.Errorf("proto: MetricMetadata: illegal tag %d (wire type %d)", fieldNum, wire) 1413 } 1414 switch fieldNum { 1415 case 1: 1416 if wireType != 0 { 1417 return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) 1418 } 1419 m.Type = 0 1420 for shift := uint(0); ; shift += 7 { 1421 if shift >= 64 { 1422 return ErrIntOverflowMetrics 1423 } 1424 if iNdEx >= l { 1425 return io.ErrUnexpectedEOF 1426 } 1427 b := dAtA[iNdEx] 1428 iNdEx++ 1429 m.Type |= MetricMetadata_MetricType(b&0x7F) << shift 1430 if b < 0x80 { 1431 break 1432 } 1433 } 1434 case 2: 1435 if wireType != 2 { 1436 return fmt.Errorf("proto: wrong wireType = %d for field MetricFamilyName", wireType) 1437 } 1438 var stringLen uint64 1439 for shift := uint(0); ; shift += 7 { 1440 if shift >= 64 { 1441 return ErrIntOverflowMetrics 1442 } 1443 if iNdEx >= l { 1444 return io.ErrUnexpectedEOF 1445 } 1446 b := dAtA[iNdEx] 1447 iNdEx++ 1448 stringLen |= uint64(b&0x7F) << shift 1449 if b < 0x80 { 1450 break 1451 } 1452 } 1453 intStringLen := int(stringLen) 1454 if intStringLen < 0 { 1455 return ErrInvalidLengthMetrics 1456 } 1457 postIndex := iNdEx + intStringLen 1458 if postIndex < 0 { 1459 return ErrInvalidLengthMetrics 1460 } 1461 if postIndex > l { 1462 return io.ErrUnexpectedEOF 1463 } 1464 m.MetricFamilyName = string(dAtA[iNdEx:postIndex]) 1465 iNdEx = postIndex 1466 case 4: 1467 if wireType != 2 { 1468 return fmt.Errorf("proto: wrong wireType = %d for field Help", wireType) 1469 } 1470 var stringLen uint64 1471 for shift := uint(0); ; shift += 7 { 1472 if shift >= 64 { 1473 return ErrIntOverflowMetrics 1474 } 1475 if iNdEx >= l { 1476 return io.ErrUnexpectedEOF 1477 } 1478 b := dAtA[iNdEx] 1479 iNdEx++ 1480 stringLen |= uint64(b&0x7F) << shift 1481 if b < 0x80 { 1482 break 1483 } 1484 } 1485 intStringLen := int(stringLen) 1486 if intStringLen < 0 { 1487 return ErrInvalidLengthMetrics 1488 } 1489 postIndex := iNdEx + intStringLen 1490 if postIndex < 0 { 1491 return ErrInvalidLengthMetrics 1492 } 1493 if postIndex > l { 1494 return io.ErrUnexpectedEOF 1495 } 1496 m.Help = string(dAtA[iNdEx:postIndex]) 1497 iNdEx = postIndex 1498 case 5: 1499 if wireType != 2 { 1500 return fmt.Errorf("proto: wrong wireType = %d for field Unit", wireType) 1501 } 1502 var stringLen uint64 1503 for shift := uint(0); ; shift += 7 { 1504 if shift >= 64 { 1505 return ErrIntOverflowMetrics 1506 } 1507 if iNdEx >= l { 1508 return io.ErrUnexpectedEOF 1509 } 1510 b := dAtA[iNdEx] 1511 iNdEx++ 1512 stringLen |= uint64(b&0x7F) << shift 1513 if b < 0x80 { 1514 break 1515 } 1516 } 1517 intStringLen := int(stringLen) 1518 if intStringLen < 0 { 1519 return ErrInvalidLengthMetrics 1520 } 1521 postIndex := iNdEx + intStringLen 1522 if postIndex < 0 { 1523 return ErrInvalidLengthMetrics 1524 } 1525 if postIndex > l { 1526 return io.ErrUnexpectedEOF 1527 } 1528 m.Unit = string(dAtA[iNdEx:postIndex]) 1529 iNdEx = postIndex 1530 default: 1531 iNdEx = preIndex 1532 skippy, err := skipMetrics(dAtA[iNdEx:]) 1533 if err != nil { 1534 return err 1535 } 1536 if skippy < 0 { 1537 return ErrInvalidLengthMetrics 1538 } 1539 if (iNdEx + skippy) < 0 { 1540 return ErrInvalidLengthMetrics 1541 } 1542 if (iNdEx + skippy) > l { 1543 return io.ErrUnexpectedEOF 1544 } 1545 iNdEx += skippy 1546 } 1547 } 1548 1549 if iNdEx > l { 1550 return io.ErrUnexpectedEOF 1551 } 1552 return nil 1553 } 1554 func (m *Metric) Unmarshal(dAtA []byte) error { 1555 l := len(dAtA) 1556 iNdEx := 0 1557 for iNdEx < l { 1558 preIndex := iNdEx 1559 var wire uint64 1560 for shift := uint(0); ; shift += 7 { 1561 if shift >= 64 { 1562 return ErrIntOverflowMetrics 1563 } 1564 if iNdEx >= l { 1565 return io.ErrUnexpectedEOF 1566 } 1567 b := dAtA[iNdEx] 1568 iNdEx++ 1569 wire |= uint64(b&0x7F) << shift 1570 if b < 0x80 { 1571 break 1572 } 1573 } 1574 fieldNum := int32(wire >> 3) 1575 wireType := int(wire & 0x7) 1576 if wireType == 4 { 1577 return fmt.Errorf("proto: Metric: wiretype end group for non-group") 1578 } 1579 if fieldNum <= 0 { 1580 return fmt.Errorf("proto: Metric: illegal tag %d (wire type %d)", fieldNum, wire) 1581 } 1582 switch fieldNum { 1583 case 1: 1584 if wireType != 2 { 1585 return fmt.Errorf("proto: wrong wireType = %d for field Labels", wireType) 1586 } 1587 var msglen int 1588 for shift := uint(0); ; shift += 7 { 1589 if shift >= 64 { 1590 return ErrIntOverflowMetrics 1591 } 1592 if iNdEx >= l { 1593 return io.ErrUnexpectedEOF 1594 } 1595 b := dAtA[iNdEx] 1596 iNdEx++ 1597 msglen |= int(b&0x7F) << shift 1598 if b < 0x80 { 1599 break 1600 } 1601 } 1602 if msglen < 0 { 1603 return ErrInvalidLengthMetrics 1604 } 1605 postIndex := iNdEx + msglen 1606 if postIndex < 0 { 1607 return ErrInvalidLengthMetrics 1608 } 1609 if postIndex > l { 1610 return io.ErrUnexpectedEOF 1611 } 1612 m.Labels = append(m.Labels, LabelAdapter{}) 1613 if err := m.Labels[len(m.Labels)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 1614 return err 1615 } 1616 iNdEx = postIndex 1617 default: 1618 iNdEx = preIndex 1619 skippy, err := skipMetrics(dAtA[iNdEx:]) 1620 if err != nil { 1621 return err 1622 } 1623 if skippy < 0 { 1624 return ErrInvalidLengthMetrics 1625 } 1626 if (iNdEx + skippy) < 0 { 1627 return ErrInvalidLengthMetrics 1628 } 1629 if (iNdEx + skippy) > l { 1630 return io.ErrUnexpectedEOF 1631 } 1632 iNdEx += skippy 1633 } 1634 } 1635 1636 if iNdEx > l { 1637 return io.ErrUnexpectedEOF 1638 } 1639 return nil 1640 } 1641 func skipMetrics(dAtA []byte) (n int, err error) { 1642 l := len(dAtA) 1643 iNdEx := 0 1644 for iNdEx < l { 1645 var wire uint64 1646 for shift := uint(0); ; shift += 7 { 1647 if shift >= 64 { 1648 return 0, ErrIntOverflowMetrics 1649 } 1650 if iNdEx >= l { 1651 return 0, io.ErrUnexpectedEOF 1652 } 1653 b := dAtA[iNdEx] 1654 iNdEx++ 1655 wire |= (uint64(b) & 0x7F) << shift 1656 if b < 0x80 { 1657 break 1658 } 1659 } 1660 wireType := int(wire & 0x7) 1661 switch wireType { 1662 case 0: 1663 for shift := uint(0); ; shift += 7 { 1664 if shift >= 64 { 1665 return 0, ErrIntOverflowMetrics 1666 } 1667 if iNdEx >= l { 1668 return 0, io.ErrUnexpectedEOF 1669 } 1670 iNdEx++ 1671 if dAtA[iNdEx-1] < 0x80 { 1672 break 1673 } 1674 } 1675 return iNdEx, nil 1676 case 1: 1677 iNdEx += 8 1678 return iNdEx, nil 1679 case 2: 1680 var length int 1681 for shift := uint(0); ; shift += 7 { 1682 if shift >= 64 { 1683 return 0, ErrIntOverflowMetrics 1684 } 1685 if iNdEx >= l { 1686 return 0, io.ErrUnexpectedEOF 1687 } 1688 b := dAtA[iNdEx] 1689 iNdEx++ 1690 length |= (int(b) & 0x7F) << shift 1691 if b < 0x80 { 1692 break 1693 } 1694 } 1695 if length < 0 { 1696 return 0, ErrInvalidLengthMetrics 1697 } 1698 iNdEx += length 1699 if iNdEx < 0 { 1700 return 0, ErrInvalidLengthMetrics 1701 } 1702 return iNdEx, nil 1703 case 3: 1704 for { 1705 var innerWire uint64 1706 var start int = iNdEx 1707 for shift := uint(0); ; shift += 7 { 1708 if shift >= 64 { 1709 return 0, ErrIntOverflowMetrics 1710 } 1711 if iNdEx >= l { 1712 return 0, io.ErrUnexpectedEOF 1713 } 1714 b := dAtA[iNdEx] 1715 iNdEx++ 1716 innerWire |= (uint64(b) & 0x7F) << shift 1717 if b < 0x80 { 1718 break 1719 } 1720 } 1721 innerWireType := int(innerWire & 0x7) 1722 if innerWireType == 4 { 1723 break 1724 } 1725 next, err := skipMetrics(dAtA[start:]) 1726 if err != nil { 1727 return 0, err 1728 } 1729 iNdEx = start + next 1730 if iNdEx < 0 { 1731 return 0, ErrInvalidLengthMetrics 1732 } 1733 } 1734 return iNdEx, nil 1735 case 4: 1736 return iNdEx, nil 1737 case 5: 1738 iNdEx += 4 1739 return iNdEx, nil 1740 default: 1741 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 1742 } 1743 } 1744 panic("unreachable") 1745 } 1746 1747 var ( 1748 ErrInvalidLengthMetrics = fmt.Errorf("proto: negative length found during unmarshaling") 1749 ErrIntOverflowMetrics = fmt.Errorf("proto: integer overflow") 1750 )